- Refactor PDF loading across workflow nodes to use loadPdfDocument utility

- Replaced direct calls to PDFDocument.load with loadPdfDocument in multiple nodes to standardize PDF loading process.
This commit is contained in:
alam00000
2026-03-26 13:40:21 +05:30
parent 9d362b1cf8
commit 9278774b8a
110 changed files with 1413 additions and 1196 deletions

View File

@@ -4,6 +4,7 @@ import { createIcons, icons } from 'lucide';
import { PDFDocument as PDFLibDocument, degrees, PageSizes } from 'pdf-lib';
import * as pdfjsLib from 'pdfjs-dist';
import { loadPdfWithPasswordPrompt } from '../utils/password-prompt.js';
import { loadPdfDocument } from '../utils/load-pdf-document.js';
pdfjsLib.GlobalWorkerOptions.workerSrc = new URL(
'pdfjs-dist/build/pdf.worker.mjs',
@@ -98,7 +99,7 @@ async function updateUI() {
pageState.pdfBytes = new Uint8Array(result.bytes);
pageState.pdfjsDoc = result.pdf;
pageState.pdfDoc = await PDFLibDocument.load(pageState.pdfBytes, {
pageState.pdfDoc = await loadPdfDocument(pageState.pdfBytes, {
throwOnInvalidObject: false,
});
@@ -430,7 +431,7 @@ async function createBooklet() {
showLoader('Creating Booklet...');
try {
const sourceDoc = await PDFLibDocument.load(pageState.pdfBytes.slice());
const sourceDoc = await loadPdfDocument(pageState.pdfBytes.slice());
const rotationMode =
(
document.querySelector(