A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Remove ng2-pdf-viewer and use only native viewer
Michael Shamoon706b1f46220f
diff --git a/src-ui/package.json b/src-ui/package.jsonindex 14d828483..a7cef2581 100644--- a/src-ui/package.json+++ b/src-ui/package.json@@ -24,7 +24,6 @@"@ng-select/ng-select": "^5.0.9","bootstrap": "^4.5.0","ng-bootstrap": "^1.6.3",- "ng2-pdf-viewer": "^6.3.2","ngx-cookie-service": "^10.1.1","ngx-file-drop": "^10.0.0","ngx-infinite-scroll": "^9.1.0",diff --git a/src-ui/src/app/app.module.ts b/src-ui/src/app/app.module.tsindex 49e937c0b..d63d34306 100644--- a/src-ui/src/app/app.module.ts+++ b/src-ui/src/app/app.module.ts@@ -48,7 +48,6 @@ import { SavedViewWidgetComponent } from './components/dashboard/widgets/saved-vimport { StatisticsWidgetComponent } from './components/dashboard/widgets/statistics-widget/statistics-widget.component';import { UploadFileWidgetComponent } from './components/dashboard/widgets/upload-file-widget/upload-file-widget.component';import { WidgetFrameComponent } from './components/dashboard/widgets/widget-frame/widget-frame.component';-import { PdfViewerModule } from 'ng2-pdf-viewer';import { WelcomeWidgetComponent } from './components/dashboard/widgets/welcome-widget/welcome-widget.component';import { YesNoPipe } from './pipes/yes-no.pipe';import { FileSizePipe } from './pipes/file-size.pipe';@@ -129,7 +128,6 @@ registerLocaleData(localeDe)ReactiveFormsModule,NgxFileDropModule,InfiniteScrollModule,- PdfViewerModule,NgSelectModule],providers: [diff --git a/src-ui/src/app/components/document-detail/document-detail.component.html b/src-ui/src/app/components/document-detail/document-detail.component.htmlindex 2814a1242..9db571708 100644--- a/src-ui/src/app/components/document-detail/document-detail.component.html+++ b/src-ui/src/app/components/document-detail/document-detail.component.html@@ -1,14 +1,4 @@<app-page-header [(title)]="title">- <div class="input-group input-group-sm mr-5 d-none d-md-flex" *ngIf="getContentType() == 'application/pdf' && !useNativePdfViewer">- <div class="input-group-prepend">- <div class="input-group-text" i18n>Page</div>- </div>- <input class="form-control flex-grow-0 w-auto" type="number" min="1" [max]="previewNumPages" [(ngModel)]="previewCurrentPage" />- <div class="input-group-append">- <div class="input-group-text" i18n>of {{previewNumPages}}</div>- </div>- </div>-<button type="button" class="btn btn-sm btn-outline-danger mr-2 ml-auto" (click)="delete()"><svg class="buttonicon" fill="currentColor"><use xlink:href="assets/bootstrap-icons.svg#trash" />@@ -135,12 +125,7 @@<div class="col-md-6 col-xl-8 mb-3"><ng-container *ngIf="getContentType() == 'application/pdf'">- <div class="preview-sticky pdf-viewer-container" *ngIf="!useNativePdfViewer ; else nativePdfViewer">- <pdf-viewer [src]="previewUrl" [original-size]="false" [show-borders]="true" [show-all]="true" [(page)]="previewCurrentPage" [render-text-mode]="2" (after-load-complete)="pdfPreviewLoaded($event)"></pdf-viewer>- </div>- <ng-template #nativePdfViewer>- <object [data]="previewUrl | safe" type="application/pdf" class="preview-sticky" width="100%"></object>- </ng-template>+ <object [data]="previewUrl | safe" class="preview-sticky" width="100%">If error</object></ng-container><ng-container *ngIf="getContentType() == 'text/plain'"><object [data]="previewUrl | safe" type="text/plain" class="preview-sticky" width="100%"></object>diff --git a/src-ui/src/app/components/document-detail/document-detail.component.ts b/src-ui/src/app/components/document-detail/document-detail.component.tsindex a7cce715e..d7c875be5 100644--- a/src-ui/src/app/components/document-detail/document-detail.component.ts+++ b/src-ui/src/app/components/document-detail/document-detail.component.ts@@ -15,7 +15,6 @@ import { DocumentService } from 'src/app/services/rest/document.service';import { ConfirmDialogComponent } from '../common/confirm-dialog/confirm-dialog.component';import { CorrespondentEditDialogComponent } from '../manage/correspondent-list/correspondent-edit-dialog/correspondent-edit-dialog.component';import { DocumentTypeEditDialogComponent } from '../manage/document-type-list/document-type-edit-dialog/document-type-edit-dialog.component';-import { PDFDocumentProxy } from 'ng2-pdf-viewer';import { ToastService } from 'src/app/services/toast.service';import { TextComponent } from '../common/input/text/text.component';import { SettingsService, SETTINGS_KEYS } from 'src/app/services/settings.service';@@ -61,9 +60,6 @@ export class DocumentDetailComponent implements OnInit {tags: new FormControl([])})- previewCurrentPage: number = 1- previewNumPages: number = 1-constructor(private documentsService: DocumentService,private route: ActivatedRoute,@@ -77,10 +73,6 @@ export class DocumentDetailComponent implements OnInit {private toastService: ToastService,private settings: SettingsService) { }- get useNativePdfViewer(): boolean {- return this.settings.get(SETTINGS_KEYS.USE_NATIVE_PDF_VIEWER)- }-getContentType() {return this.metadata?.has_archive_version ? 'application/pdf' : this.metadata?.original_mime_type}@@ -222,8 +214,4 @@ export class DocumentDetailComponent implements OnInit {return this.documentListViewService.hasNext(this.documentId)}- pdfPreviewLoaded(pdf: PDFDocumentProxy) {- this.previewNumPages = pdf.numPages- }-}diff --git a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.htmlindex ca27fb697..1881a85ee 100644--- a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html+++ b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html@@ -47,15 +47,9 @@</a><ng-template #previewContent><ng-container *ngIf="getContentType() == 'application/pdf'">- <div class="preview pdf-viewer-container" *ngIf="!useNativePdfViewer ; else nativePdfViewer">- <div class="spinner-border text-primary spinner-border-sm" role="status">- <span class="sr-only">Loading...</span>- </div>- <pdf-viewer [src]="previewUrl" [original-size]="false" [show-borders]="false" [show-all]="true" [render-text-mode]="2"></pdf-viewer>+ <div class="preview">+ <object [data]="previewUrl | safe" class="preview" width="100%"></object></div>- <ng-template #nativePdfViewer>- <object [data]="previewUrl | safe" type="application/pdf" class="preview" width="100%"></object>- </ng-template></ng-container><ng-container *ngIf="getContentType() == 'text/plain'"><object [data]="previewUrl | safe" type="text/plain" class="preview" width="100%"></object>diff --git a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.ts b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.tsindex 02eb5e0eb..b84dfcd9c 100644--- a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.ts+++ b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.ts@@ -70,10 +70,6 @@ export class DocumentCardSmallComponent implements OnInit {)}- get useNativePdfViewer(): boolean {- return this.settings.get(SETTINGS_KEYS.USE_NATIVE_PDF_VIEWER)- }-getContentType() {return this.metadata?.has_archive_version ? 'application/pdf' : this.metadata?.original_mime_type}diff --git a/src-ui/src/app/components/manage/settings/settings.component.ts b/src-ui/src/app/components/manage/settings/settings.component.tsindex 47c7b8d7b..368a01027 100644--- a/src-ui/src/app/components/manage/settings/settings.component.ts+++ b/src-ui/src/app/components/manage/settings/settings.component.ts@@ -21,7 +21,6 @@ export class SettingsComponent implements OnInit {'documentListItemPerPage': new FormControl(this.settings.get(SETTINGS_KEYS.DOCUMENT_LIST_SIZE)),'darkModeUseSystem': new FormControl(this.settings.get(SETTINGS_KEYS.DARK_MODE_USE_SYSTEM)),'darkModeEnabled': new FormControl(this.settings.get(SETTINGS_KEYS.DARK_MODE_ENABLED)),- 'useNativePdfViewer': new FormControl(this.settings.get(SETTINGS_KEYS.USE_NATIVE_PDF_VIEWER)),'savedViews': this.savedViewGroup,'displayLanguage': new FormControl(this.settings.getLanguage()),'dateLocale': new FormControl(this.settings.get(SETTINGS_KEYS.DATE_LOCALE)),@@ -74,7 +73,6 @@ export class SettingsComponent implements OnInit {this.settings.set(SETTINGS_KEYS.DOCUMENT_LIST_SIZE, this.settingsForm.value.documentListItemPerPage)this.settings.set(SETTINGS_KEYS.DARK_MODE_USE_SYSTEM, this.settingsForm.value.darkModeUseSystem)this.settings.set(SETTINGS_KEYS.DARK_MODE_ENABLED, (this.settingsForm.value.darkModeEnabled == true).toString())- this.settings.set(SETTINGS_KEYS.USE_NATIVE_PDF_VIEWER, this.settingsForm.value.useNativePdfViewer)this.settings.set(SETTINGS_KEYS.DATE_LOCALE, this.settingsForm.value.dateLocale)this.settings.set(SETTINGS_KEYS.DATE_FORMAT, this.settingsForm.value.dateFormat)this.settings.set(SETTINGS_KEYS.NOTIFICATIONS_CONSUMER_NEW_DOCUMENT, this.settingsForm.value.notificationsConsumerNewDocument)diff --git a/src-ui/src/app/services/settings.service.ts b/src-ui/src/app/services/settings.service.tsindex f3e437ada..c8b657300 100644--- a/src-ui/src/app/services/settings.service.ts+++ b/src-ui/src/app/services/settings.service.ts@@ -21,7 +21,6 @@ export const SETTINGS_KEYS = {DOCUMENT_LIST_SIZE: 'general-settings:documentListSize',DARK_MODE_USE_SYSTEM: 'general-settings:dark-mode:use-system',DARK_MODE_ENABLED: 'general-settings:dark-mode:enabled',- USE_NATIVE_PDF_VIEWER: 'general-settings:document-details:native-pdf-viewer',DATE_LOCALE: 'general-settings:date-display:date-locale',DATE_FORMAT: 'general-settings:date-display:date-format',NOTIFICATIONS_CONSUMER_NEW_DOCUMENT: 'general-settings:notifications:consumer-new-documents',@@ -36,7 +35,6 @@ const SETTINGS: PaperlessSettings[] = [{key: SETTINGS_KEYS.DOCUMENT_LIST_SIZE, type: "number", default: 50},{key: SETTINGS_KEYS.DARK_MODE_USE_SYSTEM, type: "boolean", default: true},{key: SETTINGS_KEYS.DARK_MODE_ENABLED, type: "boolean", default: false},- {key: SETTINGS_KEYS.USE_NATIVE_PDF_VIEWER, type: "boolean", default: false},{key: SETTINGS_KEYS.DATE_LOCALE, type: "string", default: ""},{key: SETTINGS_KEYS.DATE_FORMAT, type: "string", default: "mediumDate"},{key: SETTINGS_KEYS.NOTIFICATIONS_CONSUMER_NEW_DOCUMENT, type: "boolean", default: true},