|
@@ -10,7 +10,7 @@ let ComPDFKitJS = {
|
|
|
ComPDFKitDownloadFont,
|
|
|
ComPDFKitDownloadFontA,
|
|
|
FontNameList: [],
|
|
|
- FontCount: 120,
|
|
|
+ FontCount: 1,
|
|
|
opened_image: [],
|
|
|
opened_files: [],
|
|
|
opened_cert: [],
|
|
@@ -73,18 +73,12 @@ function readFileAsync(url) {
|
|
|
}
|
|
|
|
|
|
function ComPDFKitDownloadFont(index){
|
|
|
- if (index === 0) {
|
|
|
- return ComPDFKitJS.opened_Font[index];
|
|
|
- }
|
|
|
if (ComPDFKitJS.opened_Font[index]) {
|
|
|
return ComPDFKitJS.opened_Font[index]
|
|
|
}
|
|
|
return fontFile
|
|
|
}
|
|
|
function ComPDFKitDownloadFontA(index){
|
|
|
- if (index === 0) {
|
|
|
- return ComPDFKitJS.opened_Font[index];
|
|
|
- }
|
|
|
if (ComPDFKitJS.opened_Font[index]) {
|
|
|
return ComPDFKitJS.opened_Font[index]
|
|
|
}
|
|
@@ -160,13 +154,22 @@ class CPDFWorker {
|
|
|
|
|
|
if (data.fileList) {
|
|
|
ComPDFKitJS.opened_Font[0] = data.fileList
|
|
|
+ }
|
|
|
|
|
|
- if (data.webFontURL !== 'https://www.compdf.com/fonts/') {
|
|
|
- webFontURL = data.webFontURL
|
|
|
- }
|
|
|
+ if (data.webFontURL !== 'https://www.compdf.com/fonts/') {
|
|
|
+ webFontURL = data.webFontURL
|
|
|
+ }
|
|
|
+
|
|
|
+ if (data.fontsJson) {
|
|
|
fontsJson = data.fontsJson
|
|
|
|
|
|
- Module._InitComPDFkitFont()
|
|
|
+ const compress = !!ComPDFKitJS.opened_Font[0]
|
|
|
+ ComPDFKitJS.FontCount = (compress ? (data.fontsJson.length + 1) : data.fontsJson.length)
|
|
|
+ if (!compress && data.fontsJson.length === 1) {
|
|
|
+ const fontFile = readFileAsync(webFontURL + data.fontsJson[0].filePath)
|
|
|
+ ComPDFKitJS.opened_Font[0] = fontFile
|
|
|
+ }
|
|
|
+ Module._InitComPDFkitFont(compress)
|
|
|
}
|
|
|
|
|
|
if (data.enableDefaultFont && !ComPDFKitJS.opened_DefFont[0]) {
|
|
@@ -406,7 +409,7 @@ class CPDFWorker {
|
|
|
|
|
|
DataArray = []
|
|
|
|
|
|
- const embedded = !!fontsJson || ComPDFKitJS.opened_DefFont[0]
|
|
|
+ const embedded = !!fontsJson || !!ComPDFKitJS.opened_DefFont[0]
|
|
|
Module._SaveDocumentByStream(doc, 2, embedded)
|
|
|
|
|
|
const addResult = Module._AddSignSaveDocument(doc, signaturePtr, certPtr)
|
|
@@ -3072,7 +3075,7 @@ function addToTrustedCertificates(data) {
|
|
|
async function copyDocument(doc, password) {
|
|
|
DataArray = []
|
|
|
|
|
|
- const embedded = !!fontsJson || ComPDFKitJS.opened_DefFont[0]
|
|
|
+ const embedded = !!fontsJson || !!ComPDFKitJS.opened_DefFont[0]
|
|
|
Module._SaveDocumentByStream(doc, 2, embedded);
|
|
|
let pdfData = []
|
|
|
for (let i = 0; i < DataArray.length; i++) {
|
|
@@ -3097,7 +3100,7 @@ function saveDocument(doc, saveType) {
|
|
|
DataArray = []
|
|
|
saveType === 1 && DataArray.push(ComPDFKitJS.opened_files[0])
|
|
|
|
|
|
- const embedded = !!fontsJson || ComPDFKitJS.opened_DefFont[0]
|
|
|
+ const embedded = !!fontsJson || !!ComPDFKitJS.opened_DefFont[0]
|
|
|
Module._SaveDocumentByStream(doc, saveType, embedded)
|
|
|
let pdfData = []
|
|
|
for (let i = 0; i < DataArray.length; i++) {
|