[gs-cvs] rev 8120 - trunk/gs/lib
alexcher at ghostscript.com
alexcher at ghostscript.com
Thu Jul 12 18:10:57 PDT 2007
Author: alexcher
Date: 2007-07-12 18:10:56 -0700 (Thu, 12 Jul 2007)
New Revision: 8120
Modified:
trunk/gs/lib/pdfwrite.ps
Log:
Make PDF post-processing utilities tolerant to missing Length attribute in
the strean dictionary. Our PDF parser undefines incorrect Length attributes.
Modified: trunk/gs/lib/pdfwrite.ps
===================================================================
--- trunk/gs/lib/pdfwrite.ps 2007-07-12 13:34:24 UTC (rev 8119)
+++ trunk/gs/lib/pdfwrite.ps 2007-07-13 01:10:56 UTC (rev 8120)
@@ -213,9 +213,18 @@
dup dup length dict copy
% Stack: origdict dict
dup /File undef dup /FilePosition undef dup /StreamKey undef
- dup /Length get dup oforce ne {
- dup /Length 2 copy oget put
- } if
+ dup /Length known {
+ dup /Length get dup oforce ne {
+ dup /Length 2 copy oget put
+ } if
+ } {
+ 1 index /File get dup
+ 3 index /FilePosition get setfileposition
+ dup 0 (endstream) /SubFileDecode filter flushfile
+ .fileposition 9 sub
+ 2 index /FilePosition get sub
+ 1 index exch /Length exch put
+ } ifelse
exch dup /File get dup 3 -1 roll /FilePosition get setfileposition
pdfcopystream
} bind def
More information about the gs-cvs
mailing list