- 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

@@ -2,8 +2,8 @@ import { ClassicPreset } from 'rete';
import { BaseWorkflowNode } from './base-node';
import { pdfSocket } from '../sockets';
import type { PDFData, SocketData } from '../types';
import { PDFDocument } from 'pdf-lib';
import { loadPyMuPDF } from '../../utils/pymupdf-loader.js';
import { loadPdfDocument } from '../../utils/load-pdf-document.js';
export class ImageInputNode extends BaseWorkflowNode {
readonly category = 'Input' as const;
@@ -57,7 +57,7 @@ export class ImageInputNode extends BaseWorkflowNode {
const pymupdf = await loadPyMuPDF();
const pdfBlob = await pymupdf.imagesToPdf(this.files);
const bytes = new Uint8Array(await pdfBlob.arrayBuffer());
const document = await PDFDocument.load(bytes);
const document = await loadPdfDocument(bytes);
const result: PDFData = {
type: 'pdf',