|
@@ -283,6 +283,17 @@ const sizeOf = require("image-size");
|
|
*/
|
|
*/
|
|
export async function mergePdfListReduce(pdfList,convertOpts){
|
|
export async function mergePdfListReduce(pdfList,convertOpts){
|
|
console.log("pdfList",pdfList)
|
|
console.log("pdfList",pdfList)
|
|
|
|
+ // 所有非PDF转PDF
|
|
|
|
+ for (let index = 0; index < pdfList.length; index++) {
|
|
|
|
+ let file = pdfList[index];
|
|
|
|
+ if(file?.toLocaleLowerCase()?.indexOf("pdf")==-1){
|
|
|
|
+ convertOpts.files = [file];
|
|
|
|
+ let pdfBuffer = await LibreOffice.convert(convertOpts);
|
|
|
|
+ fs.writeFileSync(file+".pdf",pdfBuffer)
|
|
|
|
+ pdfList[index] = file+".pdf"
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
let mergeList = []
|
|
let mergeList = []
|
|
let plist = []
|
|
let plist = []
|
|
let length = pdfList.length
|
|
let length = pdfList.length
|