compressed PDF not displayd correctly in OSX preview
See original GitHub issueUsing the jsPDF to construct a PDF file and for reduced size it is compressed. Works fine in most places but when opened in OSX preview, the text is all jumbled up.
When validating the PDF with: https://www.pdf-online.com/osa/validate.aspx i get `
Compliance | pdf1.4 |
---|---|
Result | Document does not conform to PDF/A. |
Details | Validating file “cert(2).pdf” for conformance level pdf1.4Error in Flate stream: data error.The document does not conform to the requested standard.The document doesn’t conform to the PDF reference (missing required entries, wrong value types, etc.).The document does not conform to the PDF 1.4 standard.Done. |
`
I used //@ts-ignore doc.__private__.setPdfVersion("1.4");
in hopes of maybe resolving the issue. But it seems its not the issue with PDF version but with the compression algorithm. Is there a workaround for this issue?
I have worked with mozillas PDF.js libary and there i also had to implement compression. We needed to modify/extend the PDF.js libary to accomodate our signing logic. There i used pako libary to deflate a data stream. Maybe look into what pako has done? https://github.com/nodeca/pako
Issue Analytics
- State:
- Created 3 years ago
- Comments:19 (9 by maintainers)
Top GitHub Comments
a workaround (for garbled text when using compression) I have found is using
filters: ['ASCIIHexEncode', 'FlateEncode']
when creating a new jsPDF instance
Fixed in #2944.