|
@@ -160,13 +160,14 @@ class CPDFWorker {
|
|
|
|
|
|
if (data.fileList) {
|
|
|
ComPDFKitJS.opened_Font[0] = data.fileList
|
|
|
- }
|
|
|
- if (data.webFontURL !== 'https://www.compdf.com/fonts/') {
|
|
|
- webFontURL = data.webFontURL
|
|
|
- }
|
|
|
- fontsJson = data.fontsJson
|
|
|
|
|
|
- Module._InitComPDFkitFont()
|
|
|
+ if (data.webFontURL !== 'https://www.compdf.com/fonts/') {
|
|
|
+ webFontURL = data.webFontURL
|
|
|
+ }
|
|
|
+ fontsJson = data.fontsJson
|
|
|
+
|
|
|
+ Module._InitComPDFkitFont()
|
|
|
+ }
|
|
|
const doc = Module._InitDocument()
|
|
|
|
|
|
return doc
|
|
@@ -405,7 +406,9 @@ class CPDFWorker {
|
|
|
const signaturePtr = Module._InitSignature2(annotPtr)
|
|
|
|
|
|
DataArray = []
|
|
|
- Module._SaveDocumentByStream(doc, 2)
|
|
|
+
|
|
|
+ const embedded = !!fontsJson
|
|
|
+ Module._SaveDocumentByStream(doc, 2, embedded)
|
|
|
|
|
|
const addResult = Module._AddSignSaveDocument(doc, signaturePtr, certPtr)
|
|
|
|
|
@@ -713,11 +716,9 @@ class CPDFWorker {
|
|
|
messageHandler.on('GetSelectionForWordAtPos', (data) => {
|
|
|
const { pagePtr, textPtr, start, end } = data
|
|
|
Rect = {}
|
|
|
- Module._GetSelectionForWordAtPos(pagePtr, textPtr, start.x, start.y, end.x, end.y, 5, 5)
|
|
|
PDFRange = {}
|
|
|
- Module._GetCharsRangeAtPos(pagePtr, textPtr, Rect.Left, Rect.Top, Rect.Right, Rect.Bottom, 5, 5)
|
|
|
+ const rawTextContent = Module._GetSelectionForWordAtPos(pagePtr, textPtr, start.x, start.y, 5, 5)
|
|
|
|
|
|
- const rawTextContent = Module._GetTextContent(textPtr, PDFRange.Location, PDFRange.Length)
|
|
|
const textContent = UTF8ToString(rawTextContent)
|
|
|
TextRectArray = []
|
|
|
Module._GetRects(pagePtr, textPtr, PDFRange.Location, PDFRange.Length)
|
|
@@ -3035,7 +3036,9 @@ function addToTrustedCertificates(data) {
|
|
|
|
|
|
async function copyDocument(doc, password) {
|
|
|
DataArray = []
|
|
|
- Module._SaveDocumentByStream(doc, 2);
|
|
|
+
|
|
|
+ const embedded = !!fontsJson
|
|
|
+ Module._SaveDocumentByStream(doc, 2, embedded);
|
|
|
let pdfData = []
|
|
|
for (let i = 0; i < DataArray.length; i++) {
|
|
|
let subArray = new Uint8Array(DataArray[i])
|
|
@@ -3058,7 +3061,9 @@ async function copyDocument(doc, password) {
|
|
|
function saveDocument(doc, saveType) {
|
|
|
DataArray = []
|
|
|
saveType === 1 && DataArray.push(ComPDFKitJS.opened_files[0])
|
|
|
- Module._SaveDocumentByStream(doc, saveType)
|
|
|
+
|
|
|
+ const embedded = !!fontsJson
|
|
|
+ Module._SaveDocumentByStream(doc, saveType, embedded)
|
|
|
let pdfData = []
|
|
|
for (let i = 0; i < DataArray.length; i++) {
|
|
|
let subArray = new Uint8Array(DataArray[i])
|