pdfme icon indicating copy to clipboard operation
pdfme copied to clipboard

Generated pdf doesn't open in Adobe Reader

Open kiamesdavies opened this issue 1 year ago • 4 comments

Describe the bug

The PDF created from the Playground does not open in Adobe Reader. This issue persists with other PDFs that were similarly generated from code.

To Reproduce

Please visit https://playground.pdfme.com/ to generate the invoice PDF. After creating it, attempt to save it to your local system. Next, try to open this file using Adobe Reader. The same PDF has been attached for your reference.

c10a5726-2bc5-461e-945a-ab39f2c6c6be.pdf

Expected behavior

I expect the generated pdf to be opened from all pdf viewers

Your Environment

- pdfme package(@pdfme/generator or @pdfme/ui): 
- pdfme version: 
- Operating system: MacOS
- Node.js version or Browser name & version:

Your Error Log

None

Additional context

No response

kiamesdavies avatar Jul 02 '24 12:07 kiamesdavies

I was able to get around this by using https://www.ghostscript.com/ to convert the pdf to version 1.4

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=dist/test2.pdf dist/test.pdf 

kiamesdavies avatar Jul 02 '24 19:07 kiamesdavies

ghostscript does a lot more than convert the version - its does a complete rewrite of the PDF, so it's unlikely to be the version that's causing the issue. There's probably something that it ignores within the PDF when reading and subsequently doesn't write it on output.

peteward avatar Jul 02 '24 19:07 peteward

duplicate of #480

peteward avatar Jul 02 '24 20:07 peteward

Indeed, it interprets and rewrite the PDF. The PDF version 1.7 has been in circulation since 2016, definitely not the problem. Just a temporary solution for now. Thanks for pointing out the duplicate.

Another thing that I observed about the PDFs that don't work with Adobe is that on MacOS, these PDFs do not display the number of pages when using the file command, unlike the functional PDFs.

kiamesdavies avatar Jul 03 '24 05:07 kiamesdavies

A PR has been opened to resolve this issue: https://github.com/pdfme/pdfme/pull/493

peteward avatar Jul 13 '24 10:07 peteward

This issue has been resolved in version 4.1.0, so I'm closing it. If you still experience problems with the latest version, please let us know.

hand-dot avatar Jul 17 '24 12:07 hand-dot