|
@@ -27,6 +27,7 @@ class ComPDFKitViewer {
|
|
|
#oldPwd = ''
|
|
|
#textSearch = null
|
|
|
#activeSearchIndex = 0
|
|
|
+ #fonFile = null
|
|
|
constructor(options) {
|
|
|
this.config = options
|
|
|
this.viewerContainer = null
|
|
@@ -155,6 +156,11 @@ class ComPDFKitViewer {
|
|
|
});
|
|
|
|
|
|
if (verified) {
|
|
|
+ if (!this.webviewerServer) {
|
|
|
+ const response = await fetch('/lib/DroidSansFallbackFull.ttf')
|
|
|
+ const blob = await response.blob()
|
|
|
+ this.#fonFile = new File([blob], 'DroidSansFallbackFull.ttf', { type: blob.type })
|
|
|
+ }
|
|
|
await this.init()
|
|
|
}
|
|
|
return verified
|
|
@@ -704,7 +710,7 @@ class ComPDFKitViewer {
|
|
|
annotation.isBold = rawAnnotation.textStyle.blod === 'true'
|
|
|
annotation.isItalic = rawAnnotation.textStyle.italic === 'true'
|
|
|
annotation.isMultiLine = rawAnnotation.textStyle.multiLine === 'true' ? 1 : 0
|
|
|
- annotation.isHidden = (!rawAnnotation.flag || rawAnnotation.flag === 'invisible') ? 1 : 0
|
|
|
+ annotation.isHidden = (!rawAnnotation.flags || rawAnnotation.flags === 'invisible') ? 1 : 0
|
|
|
break
|
|
|
case 'checkbox':
|
|
|
case 'radiobutton':
|
|
@@ -713,7 +719,7 @@ class ComPDFKitViewer {
|
|
|
annotation.borderWidth = (rawAnnotation.width && round(rawAnnotation.width, 2)) || 1
|
|
|
rawAnnotation['border-color'] && (annotation.borderColor = rawAnnotation['border-color'])
|
|
|
annotation.fieldName = rawAnnotation.fieldname
|
|
|
- annotation.isHidden = (!rawAnnotation.flag || rawAnnotation.flag === 'invisible') ? 1 : 0
|
|
|
+ annotation.isHidden = (!rawAnnotation.flags || rawAnnotation.flags === 'invisible') ? 1 : 0
|
|
|
annotation.isChecked = rawAnnotation.value === 'Yes' ? 1 : 0
|
|
|
annotation.checkStyle = Number(rawAnnotation.styleCA)
|
|
|
break
|
|
@@ -732,7 +738,7 @@ class ComPDFKitViewer {
|
|
|
annotation.isBold = rawAnnotation.textStyle.blod === 'true'
|
|
|
annotation.isItalic = rawAnnotation.textStyle.italic === 'true'
|
|
|
annotation.isMultiLine = rawAnnotation.textStyle.multiLine === 'true' ? 1 : 0
|
|
|
- annotation.isHidden = !rawAnnotation.flag && rawAnnotation.flag === 'invisible' ? 1 : 0
|
|
|
+ annotation.isHidden = !rawAnnotation.flags && rawAnnotation.flags === 'invisible' ? 1 : 0
|
|
|
annotation.items = this.#getItems(rawAnnotation)
|
|
|
annotation.selected = round(rawAnnotation.select, 0)
|
|
|
break
|
|
@@ -764,7 +770,7 @@ class ComPDFKitViewer {
|
|
|
annotation.isBold = rawAnnotation.textStyle.blod === 'true'
|
|
|
annotation.isItalic = rawAnnotation.textStyle.italic === 'true'
|
|
|
annotation.title = rawAnnotation.styleCA
|
|
|
- annotation.isHidden = !rawAnnotation.flag && rawAnnotation.flag === 'invisible' ? 1 : 0
|
|
|
+ annotation.isHidden = !rawAnnotation.flags && rawAnnotation.flags === 'invisible' ? 1 : 0
|
|
|
break
|
|
|
}
|
|
|
|
|
@@ -2194,9 +2200,9 @@ class ComPDFKitViewer {
|
|
|
async setToolMode(mode) {
|
|
|
const oldMode = this.toolMode;
|
|
|
this.toolMode = mode;
|
|
|
- // if (mode === 'editor' && !this.fontFileInited) {
|
|
|
- // await this.initFontFile()
|
|
|
- // }
|
|
|
+ if (mode === 'editor' && !this.fontFileInited) {
|
|
|
+ await this.initFontFile()
|
|
|
+ }
|
|
|
this.eventBus.dispatch("toolModeChanged", mode);
|
|
|
|
|
|
if (oldMode === 'editor' && this.toolMode !== 'editor') {
|
|
@@ -2496,10 +2502,7 @@ class ComPDFKitViewer {
|
|
|
|
|
|
async initFontFile() {
|
|
|
try {
|
|
|
- const response = await fetch('/lib/DroidSansFallbackFull.ttf')
|
|
|
- const blob = await response.blob()
|
|
|
- const file = new File([blob], 'DroidSansFallbackFull.ttf', { type: blob.type })
|
|
|
- this.pdfViewer.setFontFile(file)
|
|
|
+ this.pdfViewer.setFontFile(this.#fonFile)
|
|
|
this.fontFileInited = true
|
|
|
} catch (error) {
|
|
|
console.log(error)
|