|
@@ -14,6 +14,8 @@ const Docxtemplater = require("docxtemplater");
|
|
|
import { Chromiumly } from "chromiumly";
|
|
|
// Chromiumly.configure({ endpoint: "http://8.140.98.43/docs" });
|
|
|
Chromiumly.configure({ endpoint: "http://123.57.204.89/docs" });
|
|
|
+
|
|
|
+import { PDFEngines } from "chromiumly";
|
|
|
const { LibreOffice } = require("chromiumly");
|
|
|
// const { PDFEngines } = require("chromiumly");
|
|
|
const tempDir = path.join(__dirname , "temp");
|
|
@@ -277,8 +279,11 @@ export async function mergePdfListReduce(pdfList,convertOpts){
|
|
|
let file = pdfList.shift();
|
|
|
// console.log(file,index,length)
|
|
|
if(!file) break;
|
|
|
- let files = [file,pdfList.shift(),pdfList.shift(),pdfList.shift(),pdfList.shift(),pdfList.shift()
|
|
|
- // ,pdfList.shift(),pdfList.shift(),pdfList.shift()
|
|
|
+ let files = [file,pdfList.shift(),pdfList.shift(),pdfList.shift()
|
|
|
+ ,pdfList.shift()
|
|
|
+ ,pdfList.shift()
|
|
|
+ ,pdfList.shift(),pdfList.shift(),pdfList.shift()
|
|
|
+ ,pdfList.shift(),pdfList.shift(),pdfList.shift()
|
|
|
// ,pdfList.shift(),pdfList.shift(),pdfList.shift(),pdfList.shift()
|
|
|
]; // 每次合并四个
|
|
|
files=files?.filter(item=>item);
|
|
@@ -292,9 +297,11 @@ export async function mergePdfListReduce(pdfList,convertOpts){
|
|
|
}
|
|
|
resolve(onefile);
|
|
|
}else{ // 多文件合并
|
|
|
+ convertOpts = {}
|
|
|
convertOpts.files = files;
|
|
|
// console.log("多文件合并",convertOpts)
|
|
|
- let mergeBuffer = await LibreOffice.convert(convertOpts);
|
|
|
+ let mergeBuffer = await PDFEngines.merge(convertOpts)
|
|
|
+ // let mergeBuffer = await LibreOffice.convert(convertOpts);
|
|
|
resolve({data:mergeBuffer,ext:"pdf"})
|
|
|
}
|
|
|
}))
|