-
-
Notifications
You must be signed in to change notification settings - Fork 613
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
PowerPoint PDF data loaded into PDF-Lib does not open in Adobe Acrobat Pro DC #1206
Comments
I have determined that the reason for the issue is related to License text that is being embedded with the font. The license text contains pdf keywords that are confusing the Stream Parser in pdf-lib. I'm working on an improvement that would make pdf-lib resilient to this particular issue. |
@Trapfether I see your PR has been open for over 3 weeks now. Do you know if it is likely to merged and released soon? |
@ahaganDEV a new release of pdf-lib is cut every few months as needed. I havn't yet received any contact or feedback from the maintainer so doubt it will be release soon. In the mean time, you can apply my changes to your local copy depending on how you use pdf-lib. I use the browser-based version and so run the build myself and use the resulting files. If you're using the backend version, you can use NPM Link or maintain your own repository and install the package from that repository instead of this one. However, you would want to check back periodically and switch back to using this repository once the change has been merged so you also get patches. |
What were you trying to do?
Given some PDF file data retrieved from our API, pass them through into PDF-Lib to manipulate them (draw stamps etc) and merge them into one PDF document to output to disk. Then the PDF should be opened in Adobe Acrobat Pro DC.
How did you attempt to do it?
Initially we receive PDF data from an API that returns it in UInt8Array format.
Load the data into PDF-Lib:
const embedDoc = await PDFDocument.load(pdfFileData);
Embed the pages into the document:
What actually happened?
The PDF generated can be opened in native PDF readers on Windows, MacOS and Ubuntu. However when trying to open it in Adobe Acrobat Pro DC, it fails to open, giving the following error:
When run through this PDF Checker tool https://www.pdf-online.com/osa/repair.aspx it outputs the followoing error:
When repaired, this PDF can then be opened in Adobe Acrobat Pro DC.
When Opened in RUPS here is the basic structure and the stream length of the above object:
Here is the RUPS view of the repaired PDF (notice the differing stream length highlighted)
What did you expect to happen?
The PDF file opens up correctly in Adobe Actobat Pro DC
How can we reproduce the issue?
Here is the original PowerPoint PDF file that is retrieved from our API (this PDF itself opens fine in Adobe Acrobat)
simple_ppt.pdf
Here is the generated PDF after it is passed through PDF-Lib and has gone through the merge process (this does NOT open in Adobe Acrobat)
Generated_Merged_File.pdf
Here is the output of the repaired PDF using the tool https://www.pdf-online.com/osa/repair.aspx (this does open in Adobe Acrobat)
Generated_Merged_File.pdf_recovered.pdf
Example code snippets are shown above.
Version
1.16.0
What environment are you running pdf-lib in?
Node
Checklist
Additional Notes
No response
The text was updated successfully, but these errors were encountered: