I have a server that generates a PDF, I have no access or ability to change the settings on the server.
When the server produces the pdf it embeds the following javascript code into the file so that when any PDF reader/viewer opens it, the PRINT DOCUMENT screen automatically opens. This is very inconvenient and frustrating.
The code inside the file at the very start looks like this:
%PDF-1.4
%âãÏÓ
1 0 obj
<</S/JavaScript/JS(this.print\(true , 0,this.numPages-1,false\);\r)>>
endobj
3 0 obj
<</Length 10/Filter/FlateDecode>>stream
xœ+ä
SNIP
I thought it would be an easy task just to remove the javascript line and prevent the auto print screen from popping up.
I have tried this (just did a string search and replace and removed line 4). This DOES stop the print screen appearing - BUT when opened in a few PDF viewers (goodreader etc) instantly flags up as a corrupted PDF.
I can click the repair option and everything works fine, but I would like to know, is there anything I could do to replace the javascript code with some sort of NOOP code to keep the file from being corrupt whilst still preventing the print page?
Here's a link to a source file: https://www.dropbox.com/s/kziy6evi57cfhb3/2014-04-04_EIKY.pdf (800k)
Is there a way to nullify a pdf object or something similar?
Thank you.