add pdftron version to assets

This commit is contained in:
Dan Percic 2024-06-20 15:10:20 +03:00
parent 91ab867792
commit d0f95923a3
4 changed files with 39 additions and 37 deletions

View File

@ -50,7 +50,7 @@
{
"glob": "**/*",
"input": "node_modules/@pdftron/webviewer/public/",
"output": "/assets/wv-resources/"
"output": "/assets/wv-resources/10.10.1/"
},
{
"glob": "**/*",

View File

@ -1,6 +1,10 @@
import { AsyncPipe, NgClass, NgForOf, NgIf } from '@angular/common';
import { HttpClient } from '@angular/common/http';
import { ChangeDetectorRef, Component, ElementRef, inject, OnInit, ViewChild } from '@angular/core';
import { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms';
import { MatIcon } from '@angular/material/icon';
import { MatSlider, MatSliderThumb } from '@angular/material/slider';
import { MatTooltip } from '@angular/material/tooltip';
import { Router } from '@angular/router';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { environment } from '@environments/environment';
@ -15,6 +19,7 @@ import {
} from '@iqser/common-ui';
import { getCurrentUser } from '@iqser/common-ui/lib/users';
import { AsControl, Debounce, getParam, trackByFactory, UI_ROOT_PATH_FN } from '@iqser/common-ui/lib/utils';
import { TranslateModule } from '@ngx-translate/core';
import WebViewer, { WebViewerInstance } from '@pdftron/webviewer';
import {
AppConfig,
@ -37,15 +42,10 @@ import { watermarkTranslations } from '@translations/watermark-translations';
import { Roles } from '@users/roles';
import { UserPreferenceService } from '@users/user-preference.service';
import { stampPDFPage } from '@utils/page-stamper';
import { ColorPickerModule } from 'ngx-color-picker';
import { BehaviorSubject, firstValueFrom, Observable, of } from 'rxjs';
import { tap } from 'rxjs/operators';
import { PaginatorComponent } from '../paginator/paginator.component';
import { AsyncPipe, NgClass, NgForOf, NgIf } from '@angular/common';
import { TranslateModule } from '@ngx-translate/core';
import { MatTooltip } from '@angular/material/tooltip';
import { MatIcon } from '@angular/material/icon';
import { MatSlider, MatSliderThumb } from '@angular/material/slider';
import { ColorPickerModule } from 'ngx-color-picker';
export const DEFAULT_WATERMARK: Partial<IWatermark> = {
text: 'Watermark',
@ -93,6 +93,13 @@ interface WatermarkForm {
],
})
export class WatermarkScreenComponent implements OnInit {
@ViewChild('viewer', { static: true }) private readonly _viewer: ElementRef<HTMLDivElement>;
readonly #loaded$ = new BehaviorSubject(false);
readonly #dossierTemplateId = getParam(DOSSIER_TEMPLATE_ID);
readonly #watermarkId = Number(getParam(WATERMARK_ID));
readonly #config = getConfig<AppConfig>();
#watermark: Partial<IWatermark> = {};
readonly #convertPath = inject(UI_ROOT_PATH_FN);
readonly iconButtonTypes = IconButtonTypes;
readonly translations = watermarkTranslations;
readonly trackBy = trackByFactory();
@ -110,13 +117,6 @@ export class WatermarkScreenComponent implements OnInit {
readonly watermarkHorizontalAlignments = Object.values(WATERMARK_HORIZONTAL_ALIGNMENTS);
readonly watermarkVerticalAlignments = Object.values(WATERMARK_VERTICAL_ALIGNMENTS);
currentAlignment: WatermarkAlignment;
@ViewChild('viewer', { static: true }) private readonly _viewer: ElementRef<HTMLDivElement>;
readonly #loaded$ = new BehaviorSubject(false);
readonly #dossierTemplateId = getParam(DOSSIER_TEMPLATE_ID);
readonly #watermarkId = Number(getParam(WATERMARK_ID));
readonly #config = getConfig<AppConfig>();
#watermark: Partial<IWatermark> = {};
readonly #convertPath = inject(UI_ROOT_PATH_FN);
constructor(
private readonly _http: HttpClient,
@ -249,7 +249,7 @@ export class WatermarkScreenComponent implements OnInit {
this.instance = await WebViewer(
{
licenseKey: this._licenseService.activeLicenseKey,
path: this.#convertPath('/assets/wv-resources'),
path: this.#convertPath('/assets/wv-resources/10.10.1'),
css: this.#convertPath('/assets/pdftron/stylesheet.css'),
fullAPI: true,
isReadOnly: true,

View File

@ -25,6 +25,25 @@ import TextTool = Core.Tools.TextTool;
@Injectable()
export class PdfViewer {
#instance: WebViewerInstance;
readonly #convertPath = inject(UI_ROOT_PATH_FN);
readonly #licenseKey = inject(LicenseService).activeLicenseKey;
readonly #config = getConfig<AppConfig>();
readonly #isCompareMode = signal(false);
readonly #isCompareMode$ = toObservable(this.#isCompareMode);
readonly #searchButton: IHeaderElement = {
type: 'actionButton',
img: this.#convertPath('/assets/icons/general/pdftron-action-search.svg'),
title: inject(TranslateService).instant(_('pdf-viewer.text-popup.actions.search')),
onClick: () => {
setTimeout(() => {
this.#searchForSelectedText();
this.#focusSearch();
}, 250);
},
};
readonly #destroyRef = inject(DestroyRef);
readonly #totalPages = signal<number>(0);
readonly currentPage$ = inject(ActivatedRoute).queryParamMap.pipe(
map(params => Number(params.get('page') ?? '1')),
shareDistinctLast(),
@ -45,25 +64,6 @@ export class PdfViewer {
ambientString: true, // return ambient string as part of the result
};
selectedText = '';
#instance: WebViewerInstance;
readonly #convertPath = inject(UI_ROOT_PATH_FN);
readonly #licenseKey = inject(LicenseService).activeLicenseKey;
readonly #config = getConfig<AppConfig>();
readonly #isCompareMode = signal(false);
readonly #isCompareMode$ = toObservable(this.#isCompareMode);
readonly #searchButton: IHeaderElement = {
type: 'actionButton',
img: this.#convertPath('/assets/icons/general/pdftron-action-search.svg'),
title: inject(TranslateService).instant(_('pdf-viewer.text-popup.actions.search')),
onClick: () => {
setTimeout(() => {
this.#searchForSelectedText();
this.#focusSearch();
}, 250);
},
};
readonly #destroyRef = inject(DestroyRef);
readonly #totalPages = signal<number>(0);
constructor(
private readonly _logger: NGXLogger,
@ -357,7 +357,7 @@ export class PdfViewer {
const options: WebViewerOptions = {
licenseKey: this.#licenseKey,
fullAPI: true,
path: this.#convertPath('/assets/wv-resources'),
path: this.#convertPath('/assets/wv-resources/10.10.1'),
css: this.#convertPath('/assets/pdftron/stylesheet.css'),
backendType: 'ems',
};

View File

@ -23,7 +23,9 @@
"!/**/*.*",
"!/**/*__*",
"!/**/*__*/**",
"!/ui/assets/wv-resources/core/webviewer-core.min.js",
"!/ui/assets/wv-resources/ui/webviewer-ui.min.js"
"!/ui/assets/wv-resources/**/webviewer-core.min.js",
"!/ui/assets/wv-resources/**/webviewer-ui.min.js",
"!/assets/wv-resources/**/webviewer-core.min.js",
"!/assets/wv-resources/**/webviewer-ui.min.js"
]
}