Browse Source

fix: 合并 PDF 接口合并的指定位置 bug 修复

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

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

@@ -1158,9 +1158,10 @@ class CPDFWorker {
 
     messageHandler.on('MergePDFs', async (data) => {
       const { files } = data
-      const { doc, pagesCount: insertPageIndex } = await handleDocument(files[0])
+      const { doc } = await handleDocument(files[0])
       let result = null
       for (let i = 1; i < files.length; i++) {
+        const insertPageIndex = Module._GetPageCount(doc)
         const { doc: importDoc, pagesCount } = await handleDocument(files[i])
         const importRange = stringToNewUTF8('1-' + pagesCount)
         Module._ImportPagesAtIndex(doc, importDoc, importRange, insertPageIndex)