views:

297

answers:

1

The question probably sounds a little odd, but the actual task is relatively simple, I swear!

I'm automatically generating some PDFs from a webform, using PDFCreator to merge a generated FDF into a preexisting PDF. I created the preexisting PDF in NitroPDF. This setup works great - almost. The problem is that when you view the generated PDFs in Adobe Reader 9 (the most common reader) a subset of the fields are just blank. The information is still there; using previous versions of Adobe Reader or a different reader like Foxit Reader shows the entire PDF. No clue what's going on, and Adobe tech support was useless since I didn't create the PDF with Adobe software. (If you'd like to help fix this problem instead of the following, feel free to email me.)

However, if I take the resultant PDF and print it to a fresh PDF using a PDF printer driver, it works great everywhere. This is time-consuming and annoying for our sales department to do themselves, so I want to perform this step automagically upon creating the first PDF.

I'm in ubuntu, and have command-line root access to the server. The program is written in PHP, and can easily make system calls. I'm just having trouble figuring out how to tie things together properly so that I can automatically print a known file using a specific printer driver to another known file.

+1  A: 

You could try putting your PDF files through Ghostscript. I have found that this is enough to fix many problematic PDFs.

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output.pdf input.pdf

(The same command can also be used to merge several PDF files into one, just specify multiple input files.)

Jukka Matilainen
Awesome, that worked wonders. Just verified, and all the fields of my generated pdf that don't show up Reader 9.1 *do* show up in the file after I pass it through your command. Thanks!
Xanthir