import { GcPdfViewer } from '@mescius/dspdfviewer'; import { UofxFileDownloadHelper, UofxFileModel } from '@uofx/app-components/file-helper'; import { UofxI18NService } from '@uofx/core'; import { Subject } from 'rxjs'; import { PdfOpenStatus, UofxPdfViewerSettingInfoModel, UofxWatermarkSettingModel } from './../api/pdf.model'; import { UofxPdfService } from './../api/pdf.service'; import * as i0 from "@angular/core"; export declare class UofxPdfLogic { private downloadHelper; private pdfService; private i18nService; /** 用來判斷是否重複開啟一樣的檔案的file id */ tempFileId: string; /** 用來開啟pdf的url */ viewUrl: string; /** 用來下載的pdf url */ pdfUrl: string; /** 開啟pdf的狀態 */ openPdfStatus$: Subject; /** 當前的file name */ fileName: string; /** 開啟檔案所需的AES KEY */ private readonly AES_KEY; /** 開啟檔案所需的AES IV */ private readonly AES_IV; /** 葡萄城GcPdfViewer授權 */ private readonly GCPDFVIEWER_LICENSE_KEY; /** * 沒有浮水印時的上方工具列 * > reference: https://developer.mescius.com/document-solutions/javascript-pdf-viewer/api/classes/GcPdfViewer.html#toolbarLayout */ private readonly DEFAULT_TOOLBAR; /** 有浮水印時的上方工具列 (不支援選取文字) */ private readonly WATERMARK_TOOLBAR; /** * 文件檢視器相關的多語系翻譯 * > reference: https://developer.mescius.com/document-solutions/javascript-pdf-viewer/demos/ui-customization/localization/purejs */ private readonly TRANSLATION_SETTING; /** toolbar的開窗滿版按鈕的key */ private readonly CUSTOM_FULLSCREEN_KEY; /** toolbar的下載檔案按鈕的key */ private readonly CUSTOM_DOWNLOAD_KEY; private mcoreConfig; /** smart zoom 事件清除函式列表 */ private cleanupFns; constructor(downloadHelper: UofxFileDownloadHelper, pdfService: UofxPdfService, i18nService: UofxI18NService); /** 產生pdf viewer物件 */ generateGcPdfViewer(setting: UofxPdfViewerSettingInfoModel): Promise; /** viewer的panel & toolbar設定 */ private panelAndToolbarSetting; /** new一個新的viewer */ private newGcPdfViewer; /** 註冊viewer after open事件 */ private registerAfterOpen; /** 開啟viewer之後要處理的相關設定 */ private afterOpenSetting; /** * 對內容按右鍵的設定 * - * 1. 是否要顯示選單 (return false代表不顯示選單,反之則顯示) * 2. 選單內部顯示列印 */ private contextMenuSetting; /** 開啟pdf之前的判斷邏輯 */ beforeOpenPdf(viewer: GcPdfViewer, file: UofxFileModel, watermarkSetting: UofxWatermarkSettingModel, enabledDownloadPdf: boolean): void; /** * 檢查是否有檔案 * - * 如果沒檔案則直接執行openPdfLogic() */ private checkHasFile; /** * 取得pdf所需相關資訊並開啟pdf * 1. 取得pdf下載的url * 2. 取得打開pdf的密碼:目前機制,我們一律都會對pdf上密碼,需呼叫api取得密碼暗碼再做AES解密取得明碼 * 3. 開啟pdf */ getInfoAndOpenPdf(viewer: GcPdfViewer, file: UofxFileModel, watermarkSetting: UofxWatermarkSettingModel, enabledDownloadPdf: boolean): void; /** * 處理取得的pdf密碼及觀看url相關邏輯 * @private * @param {[string, UofxPdfUrlReponseModel]} results 兩個api取得的結果 * @memberof UofxPdfViewerComponent */ private handlePwdAndViewUrl; /** 打開pdf */ private openPdfLogic; /** viewer的apply行為 */ viewerApply(viewer: GcPdfViewer): void; /** 是否有檔案及url */ private hasFile; /** 是否有viewUrl */ private hasViewUrl; /** 是否允許浮水印 */ private enabledWatermark; /** 客製的toolbar按鈕onUpdate callback事件 */ private customOnUpdateCallback; /** onUpdate callback邏輯 */ private onUpdateCallbackLogic; /** 新增下載檔案的toolbar item */ private addToolbarDownloadItem; /** * 下載檔案 * - * 1. if: web下載檔案 * 2. else: app下載檔案 */ downloadPdf(isPdfUrl: boolean, downloadUrl: string, url: string): void; /** * 自行客製新增toolbar item * @param {GcPdfViewer} viewer 當前viewer * @param {string} title 按鈕的tooltip * @param {string} key toolbar key * @param {string} svgDrawnStr icon的path d參數 * @param {*} action * @memberof UofxPdfLogic */ addToolbarItem(viewer: GcPdfViewer, key: string, svgDrawnStr: string, action: any): void; /** 取得toolbar的開窗滿版按鈕的key */ getCustomFullscreenKey(): string; /** 取得toolbar的下載檔案按鈕的key */ getCustomDownloadKey(): string; /** 單純根據已現有的pdfUrl開啟viewer,不需經過加密 */ simpleOpen(viewer: GcPdfViewer, file: any): void; /** 走simpleOpen(不加密),但要先取得組好浮水印設定的pdfUrl,再開啟viewer */ simpleOpenWithWatermark(viewer: GcPdfViewer, file: UofxFileModel, watermarkSetting: UofxWatermarkSettingModel, enabledDownloadPdf: boolean): void; /** * 以滑鼠游標位置或兩指中點為錨點縮放 * - * 預設的zoomByMouseWheel是以viewport中心點為錨點縮放,會有游標位置與縮放位置不一致的問題 */ registerZoomAtPoint(viewer: GcPdfViewer): void; /** 清除所有 smart zoom 事件監聽 */ cleanupZoom(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; }