|
@@ -62,6 +62,7 @@ class ComPDFKitViewer {
|
|
|
this.color = 'color'
|
|
|
this.pagesPtr = []
|
|
|
this.saveAction = null
|
|
|
+ this.webFontURL = './lib/fonts/'
|
|
|
this.optionUrl = {
|
|
|
// baseUrl: 'https://test-compdf.kdan.cn',
|
|
|
baseUrl: 'https://wms.compdf.com',
|
|
@@ -266,12 +267,36 @@ class ComPDFKitViewer {
|
|
|
// this.webviewerServer = true
|
|
|
|
|
|
if (verified) {
|
|
|
+ if (options.webFontURL) {
|
|
|
+ this.webFontURL = options.webFontURL
|
|
|
+ }
|
|
|
if (!this.webviewerServer) {
|
|
|
- const response = await fetch('./lib/font.ff')
|
|
|
- const resData = await response.arrayBuffer()
|
|
|
- this.#fileList = new Uint8Array(resData)
|
|
|
- const fileData = await fetch('./lib/fonts.json')
|
|
|
- this.fontsJson = await fileData.json()
|
|
|
+ const webFontURL = this.webFontURL
|
|
|
+
|
|
|
+ const response = await fetch(webFontURL + 'font.ff')
|
|
|
+ if (response.ok) {
|
|
|
+ const resData = await response.arrayBuffer()
|
|
|
+ this.#fileList = new Uint8Array(resData)
|
|
|
+ } else {
|
|
|
+ console.error('Invalid webFontURL')
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.#fileList) {
|
|
|
+ const fileData = await fetch(webFontURL + 'fonts.json')
|
|
|
+ if (fileData.ok) {
|
|
|
+ this.fontsJson = await fileData.json()
|
|
|
+ } else {
|
|
|
+ console.error('Invalid webFontURL')
|
|
|
+ }
|
|
|
+
|
|
|
+ const notoSansFontResponse = await fetch(webFontURL + 'NotoSansSC-Regular.otf.brotli')
|
|
|
+ if (notoSansFontResponse.ok) {
|
|
|
+ const notoSansFontData = await notoSansFontResponse.arrayBuffer()
|
|
|
+ this.notoSansFont = new Uint8Array(notoSansFontData)
|
|
|
+ } else {
|
|
|
+ console.error('Invalid webFontURL')
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
this.messageHandler.on('LoadFont', data => {
|
|
|
const fontFamily = data.fontFamily
|
|
@@ -518,8 +543,10 @@ class ComPDFKitViewer {
|
|
|
doc: this.doc,
|
|
|
pagesPtr: this.pagesPtr,
|
|
|
buffer,
|
|
|
+ webFontURL: this.webFontURL,
|
|
|
fileList: this.#fileList,
|
|
|
fontsJson: this.fontsJson,
|
|
|
+ notoSansFont: this.notoSansFont,
|
|
|
})
|
|
|
|
|
|
this.doc = doc
|
|
@@ -3806,7 +3833,6 @@ class ComPDFKitViewer {
|
|
|
doc: this.doc,
|
|
|
signaturePtr: signature.signaturePtr
|
|
|
})
|
|
|
- console.log('deleteSignature', signature)
|
|
|
this.eventBus.dispatch('updateSignatureFieldAp', signature.signaturePtr)
|
|
|
|
|
|
annotationStore.signatures.splice(signature.index, 1)
|