rkusa / pdfjs

A Portable Document Format (PDF) generation library targeting both the server- and client-side.
MIT License
772 stars 143 forks source link

PDF Version backward compatibility #280

Open wildhart opened 2 years ago

wildhart commented 2 years ago

Hi, first thanks for this awesome library - I've been using it on a particular project for years.

I have a new requirement on this project to digitally sign PDFs generated with pdfjs, and have been tyring to use node-signpdf. Problem is, that library doesn't work well with streams or PDF version > 1.3. If I use an online converter to downgrade the file to PDF version 1.3 then it works fine.

Is it possible to make pdfjs save files in PDF 1.3 format, or without using streams?

rkusa commented 2 years ago

pdfjs isn't creating object streams itself. You'll only end up with object streams if you append pages from external documents that use object streams. I am not entirely sure from the top of my head, but I think pdfjs might be using some features around fonts that are from newer PDF versions than 1.3. There is currently no option to change the version except patching this line https://github.com/rkusa/pdfjs/blob/main/lib/document.js#L39.

alexvrv commented 2 years ago

Any chance to add that option to change the PDF version, please? I have the same issue... i can't digital sign even with adobe.

UPDATE: it's not from the version, i've tried with 1.3 and 1.4 but i get error 23 with Adobe Reader while trying to digital sign the document. If i convert it to the same version or any other version it works perfectly.