Преглед изворни кода

fix: 内容编辑新增内嵌字体

liutian пре 2 месеци
родитељ
комит
0d47821726
2 измењених фајлова са 6 додато и 7 уклоњено
  1. 2 1
      .gitignore
  2. 4 6
      packages/core/src/worker/compdfkit_worker.js

+ 2 - 1
.gitignore

@@ -4,4 +4,5 @@ node_modules
 dist
 lib
 components.d.ts
-fonts
+fonts*
+pso

+ 4 - 6
packages/core/src/worker/compdfkit_worker.js

@@ -405,7 +405,7 @@ class CPDFWorker {
       const signaturePtr = Module._InitSignature2(annotPtr)
 
       DataArray = []
-      Module._SaveDocumentByStream(doc, 2)
+      Module._SaveDocumentByStream(doc, 2, true)
 
       const addResult = Module._AddSignSaveDocument(doc, signaturePtr, certPtr)
 
@@ -713,11 +713,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 +3033,7 @@ function addToTrustedCertificates(data) {
 
 async function copyDocument(doc, password) {
   DataArray = []
-  Module._SaveDocumentByStream(doc, 2);
+  Module._SaveDocumentByStream(doc, 2, true);
   let pdfData = []
   for (let i = 0; i < DataArray.length; i++) {
     let subArray = new Uint8Array(DataArray[i])
@@ -3058,7 +3056,7 @@ async function copyDocument(doc, password) {
 function saveDocument(doc, saveType) {
   DataArray = []
   saveType === 1 && DataArray.push(ComPDFKitJS.opened_files[0])
-  Module._SaveDocumentByStream(doc, saveType)
+  Module._SaveDocumentByStream(doc, saveType, true)
   let pdfData = []
   for (let i = 0; i < DataArray.length; i++) {
     let subArray = new Uint8Array(DataArray[i])