nbesli/pdf-merger-js

Have trouble when pdf file has limited permissions

Opened this issue · 0 comments

Hi, I had trouble when using pdf-merger-js with file pdf have limited permission to access

image

const merger = new PDFMerger();
const fileError = [];

for (const file of files) {
  await merger.add(file.file).catch((e) => {
    console.log('files', file);
    fileError.push(file);
  });
}

If permission blocks Content copying, the lib will have an error reference with pageNumber, so I can try catch the error to handle it. But it will pass when permission is applied for Content copying but block other roles like this:

image

File example:
pdf-a.pdf

I can't share files with more limited permissions because it is a private file.

React version: 17.0.2
pdf-merger-js: 5.1.1
Node version: 16.20.0