Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to modify PDF file, make sure that output file target is available and that it is not protected #389

Open
LudvikWiejowski opened this issue Jul 8, 2024 · 1 comment

Comments

@LudvikWiejowski
Copy link

LudvikWiejowski commented Jul 8, 2024

Hi,

I use pdfWriter = muhammara.createWriterToModify(localPdfPath,{modifiedFilePath:destPdfPath}); to create my pdfWriter so I can read and add an annotations. It worked perfectly until now, when I encountered protected pdf file with not allowed page extraction.
PDF File is then locked and I need to restart my node.js api service.
pdfWriter is not initialized so can't use .end().
(Maybe it's some small bug in createWriterToModify routine.)

Please, is there any way how to make it work, is there any quick way?
Or is it possible to read all pages and recreated the pdf file without protection?
Any hint or example is very much welcome.

I can send the pdf file as well, but I do not want to upload it publicly, as it is an invoice of my client's supplier.

Thanks
Ludvik

image

EDIT:
I tried pdf online validator tool pdf-online.com and got following output for problem PDF file.

File: 20240708114004_cma-cgm_com_1cb81728ba320cf8e0630a00ba4f89e0.pdf

Compliance: pdf1.4

Result: Document does not conform to PDF/A.

Details: Validating file "20240708114004_cma-cgm_com_1cb81728ba320cf8e0630a00ba4f89e0.pdf" for conformance level pdf1.4
The 'xref' keyword was not found or the xref table is malformed.
The file trailer dictionary is missing or invalid.
The "Length" key of the stream object is wrong.
The "Length" key of the stream object is wrong.
The document does not conform to the requested standard.
The file format (header, trailer, objects, xref, streams) is corrupted.
The document does not conform to the PDF 1.4 standard.Done.

It looks like this will be the cause of the issues. Will be glad for confirmation anyway. :)

@julianhille
Copy link
Owner

Would you mind trying dev branch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants