cantoo-scribe / pdf-lib

Create and modify PDF documents in any JavaScript environment
https://pdf-lib.js.org
MIT License
136 stars 27 forks source link

Request: Support non PDF/A compliant PDFs #27

Open pheidler opened 1 year ago

pheidler commented 1 year ago

Describe your idea

Are there any plans to try and support non PDF/A compliant PDFs? I noticed that support was added for password protected documents, and was curious if this was on the roadmap.

How could this be implemented?

I haven't had the chance to research this one myself, just thought I'd ask here first since it's under active development.

What problem are you trying to solve?

Load PDFs like the following: Assa.Abloy.-.Q3.2022.-.Conference.Call.Deck.pdf 01_ResidentialLIP.pdf test_merge.pdf

Why does this matter to you?

Numerous open issues in https://github.com/Hopding/pdf-lib

See here: https://github.com/Hopding/pdf-lib/issues?q=Error%3A+Trying+to+parse+invalid+object

Would others find this helpful?

Yes, see here: https://github.com/Hopding/pdf-lib/issues?q=Error%3A+Trying+to+parse+invalid+object

Are you interested in implementing your proposal?

No

Why are you submitting a proposal?

Just curious. Thanks!

Additional Notes

No response

Sharcoux commented 1 year ago

Do these pdf open in pdf.js?

pheidler commented 1 year ago

Yes

Sharcoux commented 1 year ago

I'd be glad to add support for those. Can you teach me a bit about non PDF/A compliant PDFs? I see that the pdf you provided won't load in pdf-lib, but for now I have no idea why. But I can investigate if I know what I'm looking for.

Sharcoux commented 1 year ago

@pheidler would you still be ok to help me understand the problem?

pheidler commented 1 year ago

PDF/A might be a little misleading here- my understanding is that PDF/A imposes certain restrictions that allow these PDFs to be read by pdf-lib.

In the example documents, I believe 01_ResidentialLIP.pdf fails to load because of the form fields.

Assa.Abloy.-.Q3.2022.-.Conference.Call.Deck.pdf and test_merge.pdf are likely failing due to file permissions.

I don't have that much knowledge on the subject-just trying to find a way to support a broader range of PDFs for my own use case.

Sharcoux commented 1 year ago

"failing due to file permissions" => What file permission are you talking about exactly?

pheidler commented 1 year ago

image

Sharcoux commented 11 months ago

If people with more knowledge about pdf specs want to help, that would be greatly appreciated. Meanwhile, we'll try to see what we can do on the matter.

Sharcoux commented 5 months ago

Could someone open a PR about this thanks to this ?