mirror of
https://github.com/alam00000/bentopdf.git
synced 2026-11-08 16:57:14 +01:00
- 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:
1 parent
9d362b1cf8
commit
9278774b8a
110 files changed
+1413
-1196
No files matched your search
@@ -4,7 +4,7 @@ import { pdfSocket } from '../sockets';
|
||||
import type { SocketData } from '../types';
|
||||
import { requirePdfInput, processBatch } from '../types';
|
||||
import { deletePdfPages, parseDeletePages } from '../../utils/pdf-operations';
|
||||
import { PDFDocument } from 'pdf-lib';
|
||||
import { loadPdfDocument } from '../../utils/load-pdf-document.js';
|
||||
|
||||
export class DeletePagesNode extends BaseWorkflowNode {
|
||||
readonly category = 'Organize & Manage' as const;
|
||||
@@ -32,11 +32,11 @@ export class DeletePagesNode extends BaseWorkflowNode {
|
||||
|
||||
return {
|
||||
pdf: await processBatch(pdfInputs, async (input) => {
|
||||
const srcDoc = await PDFDocument.load(input.bytes);
|
||||
const srcDoc = await loadPdfDocument(input.bytes);
|
||||
const totalPages = srcDoc.getPageCount();
|
||||
const pagesToDelete = parseDeletePages(deleteStr, totalPages);
|
||||
const resultBytes = await deletePdfPages(input.bytes, pagesToDelete);
|
||||
const resultDoc = await PDFDocument.load(resultBytes);
|
||||
const resultDoc = await loadPdfDocument(resultBytes);
|
||||
return {
|
||||
type: 'pdf',
|
||||
document: resultDoc,
|
||||
|
||||
Reference in new issue
Block a user