Support for pdf/a pdf formats in merging pdfs
jaslam-ca opened this issue · 2 comments
jaslam-ca commented
The library's(new PDFMerger()).add() function throws error "Expected instance of PDFDict, but got instance of undefined" when used with pdf/a files.
Following doesn't work with a pdf/a format:
pdf-a.pdf
npx pdf-merger-cli out.pdf pdf-a.pdf pdf-a.pdf
Following does work without a pdf/a format:
pdf-woa.pdf
npx pdf-merger-cli out.pdf pdf-woa.pdf pdf-woa.pdf
jaslam-ca commented
Another such file can be downloaded from https://www.manulife.ca/content/dam/consumer-portal/documents/en/forms/grs/other/GP0770.pdf
biennui1998mu commented
I met the same issue when using merger.add() to merge some of the files. @jaslam-ca @mojoaxel any idea for this?
- My code:
const render = async () => {
const merger = new PDFMerger();
for (const file of files) {
console.log("sonnn", file);
await merger.add(file.file).catch(e => {
console.log("sonnn", e);
});
}
const mergedPdf = await merger.saveAsBlob();
const url = URL.createObjectURL(mergedPdf);
return setPdf(url);
};
- My error log: