mirror of
https://github.com/alam00000/bentopdf.git
synced 2026-11-10 09:14:34 +01:00
fix(workflow): pass wasmUrl to pdf.js so JPEG2000 pages stop rendering blank, and fix Remove Blank Pages node failing on every PDF
This commit is contained in:
1 parent
ed197274e9
commit
f0a1868526
12 files changed
+24
-31
No files matched your search
@@ -4,7 +4,7 @@ import { pdfSocket } from '../sockets';
|
||||
import type { SocketData } from '../types';
|
||||
import { requirePdfInput, processBatch } from '../types';
|
||||
import { PDFDocument } from 'pdf-lib';
|
||||
import * as pdfjsLib from 'pdfjs-dist';
|
||||
import { getPDFDocument } from '../../utils/helpers.js';
|
||||
import { wfError } from '../errors';
|
||||
|
||||
export class PosterizeNode extends BaseWorkflowNode {
|
||||
@@ -45,8 +45,7 @@ export class PosterizeNode extends BaseWorkflowNode {
|
||||
|
||||
return {
|
||||
pdf: await processBatch(pdfInputs, async (input) => {
|
||||
const pdfjsDoc = await pdfjsLib.getDocument({ data: input.bytes })
|
||||
.promise;
|
||||
const pdfjsDoc = await getPDFDocument({ data: input.bytes }).promise;
|
||||
const newDoc = await PDFDocument.create();
|
||||
|
||||
for (let i = 1; i <= pdfjsDoc.numPages; i++) {
|
||||
|
||||
Reference in new issue
Block a user