GhostScript requires that a PDF file start with ``%PDF-n.m'' but Adobe's PDF Reference stipulates: ``Acrobat viewers require only that the header appear somewhere within the first 1024 bytes of the file.'' A similar stipulation exists for ``%%EOF'' appearing in the last 1024 bytes of a file. Now some applications generate PDF's that are wrapped in a GPG signature or include a header that turns the document into a self-extracting archive. They can be read by both Acroread and Xpdf, but not by GhostScript. The obvious workaround is to filter such files before they are fed to GhostScript for viewing. But the best long term solution would be to make GhostScript adhere to Adobe's notion of a floating header. The required bug-fix would likely impact on past fixes that dealt with problems where a PS file was incorrectly identified as a PDF file.
Please attach an example file.
Created attachment 354 [details] test of PDF floating header The bug can be reproduced with any PDF file. Simply prepend a PDF by a blank line, or a few lines of text, then try viewing the modified file with Acroread, Xpdf and Ghostscript. This attachment, for example, prepends four lines to the file ``annots.pdf'' shipped with GhostScript v8.11. It can be viewed with Acroread and Xpdf, but not by Ghostsript. For a realistic example of a PDF file with text before the document header, see: http://www.amrita-ebook.org/download/AMRITAv2.25
*** Bug 687601 has been marked as a duplicate of this bug. ***
*** Bug 688630 has been marked as a duplicate of this bug. ***
Created attachment 2868 [details] patch Increase the size of %stdin buffer to support larger lookahead requests and look for for %PDF- tag in the first 1024 bytes of the file. Ignore annotations without /Subtype hey to process one of the samp[le files. DIFFERENCES: No CET or Comparefiles differences.
The patch is committed as rev. 7835 and 7835.