Changes to splitPDF() function

This commit is contained in:
2026-07-28 09:58:09 +02:00
parent 46eb5d02dc
commit df6110fc59
+13 -7
View File
@@ -245,19 +245,25 @@ async function splitPDF(numRows, inputFile, tempFiles) {
// if there are duplicates (back to back duplicates), I only have to print one copy
if (pagesNumber > numRows) { // comparison between the number of pages of the pdf file and those of the excel file
let displayNumPage = 1;
let i;
for (i = 1; i < pagesNumber && displayNumPage <= numRows; i += 2) {
if (result.pages[i].text.trim() === result.pages[i - 1].text.trim()) {
continue;
}
let lastPrintedText = null;
/*console.log(`--- PAGE ${ displayNumPage } ---`);
console.log(result.pages[i].text);
for (let i = 0; i < pagesNumber; i++) {
let pageText = result.pages[i].text.trim();
// Only print if the current page is different from the immediate previous page
if (pageText !== lastPrintedText) {
/*console.log(`--- PAGE ${displayNumPage} ---`);
console.log(pageText);
console.log("\n");*/
// Remember this text for the next iteration
lastPrintedText = pageText;
await processPage(srcPdf, i, tempFiles);
displayNumPage++;
}
i++;
}
}
else {
for (let i = 0; i < pagesNumber; i++) {