|
@@ -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)
|