red-3800 fixed uncaught error of pdfnet initialize

This commit is contained in:
Timo Bejan 2023-01-25 22:20:47 +07:00
parent 92f35fb399
commit 56cde365cf

View File

@ -52,6 +52,7 @@ export class PdfViewer {
private readonly _injector: Injector, private readonly _injector: Injector,
private readonly _activatedRoute: ActivatedRoute, private readonly _activatedRoute: ActivatedRoute,
private readonly _licenseService: LicenseService, private readonly _licenseService: LicenseService,
private readonly _errorService: ErrorService,
private readonly _translateService: TranslateService, private readonly _translateService: TranslateService,
private readonly _userPreferenceService: UserPreferenceService, private readonly _userPreferenceService: UserPreferenceService,
@Inject(BASE_HREF_FN) private readonly _convertPath: BaseHrefFn, @Inject(BASE_HREF_FN) private readonly _convertPath: BaseHrefFn,
@ -133,7 +134,13 @@ export class PdfViewer {
async init(htmlElement: HTMLElement) { async init(htmlElement: HTMLElement) {
this.#instance = await this.#getInstance(htmlElement); this.#instance = await this.#getInstance(htmlElement);
await this.PDFNet.initialize(this._licenseService.activeLicenseKey); try {
await this.PDFNet.initialize(this._licenseService.activeLicenseKey);
} catch (e) {
this._errorService.set(e);
throw e;
}
this.#instance.UI.setTheme(this._userPreferenceService.getTheme()); this.#instance.UI.setTheme(this._userPreferenceService.getTheme());
this._logger.info('[PDF] Initialized'); this._logger.info('[PDF] Initialized');