Browse Source

update: 字体文件 url 可配置

liutian 3 months ago
parent
commit
5cd169b6cf
2 changed files with 3 additions and 3 deletions
  1. 1 1
      packages/core/src/index.js
  2. 2 2
      packages/core/src/worker/compdfkit_worker.js

+ 1 - 1
packages/core/src/index.js

@@ -63,7 +63,7 @@ class ComPDFKitViewer {
     this.color = 'color'
     this.color = 'color'
     this.pagesPtr = []
     this.pagesPtr = []
     this.saveAction = null
     this.saveAction = null
-    this.webFontURL = './lib/fonts/'
+    this.webFontURL = 'https://www.compdf.com/fonts/'
     this.optionUrl = {
     this.optionUrl = {
       // baseUrl: 'https://test-compdf.kdan.cn',
       // baseUrl: 'https://test-compdf.kdan.cn',
       baseUrl: 'https://wms.compdf.com',
       baseUrl: 'https://wms.compdf.com',

+ 2 - 2
packages/core/src/worker/compdfkit_worker.js

@@ -47,7 +47,7 @@ let DiffInfoArray = []
 let AnnotArray = []
 let AnnotArray = []
 let fontsJson = null
 let fontsJson = null
 let fontFile = null
 let fontFile = null
-let webFontURL = './fonts/'
+let webFontURL = 'https://www.compdf.com/fonts/'
 
 
 import MessageHandler from "../message_handler"
 import MessageHandler from "../message_handler"
 import { convertFileToBuffer, convertBase64ToBytes } from '../fileHandler';
 import { convertFileToBuffer, convertBase64ToBytes } from '../fileHandler';
@@ -161,7 +161,7 @@ class CPDFWorker {
       if (data.fileList) {
       if (data.fileList) {
         ComPDFKitJS.opened_Font[0] = data.fileList
         ComPDFKitJS.opened_Font[0] = data.fileList
       }
       }
-      if (data.webFontURL !== './lib/fonts/') {
+      if (data.webFontURL !== 'https://www.compdf.com/fonts/') {
         webFontURL = data.webFontURL
         webFontURL = data.webFontURL
       }
       }
       fontsJson = data.fontsJson
       fontsJson = data.fontsJson