pdftops with -preload option is creating an invalid PostScript file when OCG errors are present
Submitted by Joseph Karolchik
Assigned to poppler-bugs
Description
I am working with several large GeoPDF files from the US Geological Survey that are causing a problem when converted to a PostScript output file using pdftops. For this example, I used the latest stable release, but the problem exists in earlier releases as well.
pdftops -v pdftops version 0.16.7 Copyright 2005-2011 The Poppler Developers - http://poppler.freedesktop.org Copyright 1996-2004 Glyph & Cog, LLC
I generate the output PostScript file using the following command:
pdftops -preload geoFile.pdf geoFile.ps
The file contains layered data defined in Optional Content Groups, and some of the OCGs cause an error message to be output, as follows:
Error: Could not find a OCG with Ref (65:0)
Error: Could not find a OCG with Ref (70:0)
Error: Could not find a OCG with Ref (75:0)
Error: Could not find a OCG with Ref (78:0)
Error: Could not find a OCG with Ref (89:0)
Error: Could not find a OCG with Ref (92:0)
Error: Could not find a OCG with Ref (93:0)
<etc>
Also, this error sometimes is output:
Error: XObject 'Tile_0000_0000' is unknown
Error: XObject 'Tile_0000_0001' is unknown
Error: XObject 'Tile_0000_0002' is unknown
Error: XObject 'Tile_0000_0003' is unknown
Error: XObject 'Tile_0001_0000' is unknown
Error: XObject 'Tile_0001_0001' is unknown
Error: XObject 'Tile_0001_0002' is unknown
Error: XObject 'Tile_0001_0003' is unknown
<etc>
If I try to open the file in a graphics viewer, it hangs when I try to open it (or creates a blank screen). If I use ghostScript to interpret the file using ps2pdf, it will generate either a rangecheck or stack overflow error.
Note that if I don't use the "-preload" option that the PostScript output file is usable, but missing some of the layers.