Dynamically generated PDF files working in most readers except Adobe Reader
- by Shane
I'm trying to dynamically generate PDFs from user input, where I basically print the user input and overlay it on an existing PDF that I did not create.
It works, with one major exception. Adobe Reader doesn't read it properly, on Windows or on Linux. QuickOffice on my phone doesn't read it either. So I thought I'd trace the path of me creating the files -
1 - Original PDF of background
PDF 1.2 made with Adobe Distiller with the LZW encoding. I didn't make this.
2 - PDF of background
PDF 1.4 made with Ghostscript. I used pdf2ps then ps2pdf on the above to strip LZW so that the reportlab and pyPDF libraries would recognize it. Note that this file looks "fuzzy," like a bad scan, in Adobe Reader, but looks fine in other readers.
3 - PDF of user-input text formatted to be combined with background
PDF 1.3 made with Reportlab from user input. Opens properly and looks good in every reader I've tried.
4 - Finished PDF
PDF 1.3 made from PyPDF's mergePage() function on 2 and 3.
Does not open in:
Adobe Reader for Windows
Adobe Reader for Linux
QuickOffice for Android
Opens perfectly in:
Google Docs' PDF viewer on the web
evince for linux
ghostscript viewer for linux
Foxit reader for Windows
Preview for Mac
Are there known issues that I should know about? I don't know exactly what "flate" is, but from the internet I gather that it's some sort of open source alternative to LZW for PDF compression? Could that be causing my problem? If so, are there any libraries I could use to fix the cause in my code?