fix(xps): repair scanner XPS packages that MuPDF fails to parse

This commit is contained in:
alam00000 committed 2026-10-25 13:19:57 +05:30
1 parent 4edb1718cc
commit f7a8a60440
4 files changed
+209 -7

No files matched your search

+2 -1
View File
@@ -3,6 +3,7 @@ import { BaseWorkflowNode } from './base-node';
import { pdfSocket } from '../sockets';
import type { PDFData, SocketData, MultiPDFData } from '../types';
import { loadPyMuPDF } from '../../utils/pymupdf-loader.js';
import { convertXpsToPdf } from '../../utils/xps-repair.js';
import { loadPdfDocument } from '../../utils/load-pdf-document.js';
import { wfError } from '../errors';
@@ -53,7 +54,7 @@ export class XpsToPdfNode extends BaseWorkflowNode {
const pymupdf = await loadPyMuPDF();
const results: PDFData[] = [];
for (const file of this.files) {
const blob = await pymupdf.convertToPdf(file, { filetype: 'xps' });
const blob = await convertXpsToPdf(pymupdf, file);
const bytes = new Uint8Array(await blob.arrayBuffer());
const document = await loadPdfDocument(bytes);
results.push({