[gs-cvs] rev 8725 - trunk/gs/lib

alexcher at ghostscript.com alexcher at ghostscript.com
Sat May 10 15:02:04 PDT 2008


Author: alexcher
Date: 2008-05-10 15:02:03 -0700 (Sat, 10 May 2008)
New Revision: 8725

Modified:
   trunk/gs/lib/pdf_main.ps
Log:
Ignore OutputIntent attribute if it is not an array; recover a broken PDF file.
Bug 689831.

DIFFERENCES:
None


Modified: trunk/gs/lib/pdf_main.ps
===================================================================
--- trunk/gs/lib/pdf_main.ps	2008-05-09 16:44:54 UTC (rev 8724)
+++ trunk/gs/lib/pdf_main.ps	2008-05-10 22:02:03 UTC (rev 8725)
@@ -1802,41 +1802,47 @@
 
 % Write OutputIntents to device if the device handles it
 /writeoutputintents {
-  currentdevice 1 dict dup /OutputIntent null put readonly
+  currentdevice 1 dict dup /OutputIntent //null put readonly
   .getdeviceparams
   mark ne { pop pop
     % device supports OutputIntent parameter
     Trailer /Root oget /OutputIntents knownoget {
-      {	% process all output profiles present
-        oforce
-        dup length dict .copydict
-	dup /DestOutputProfile knownoget {
-	  PDFfile fileposition exch
-	  mark exch { oforce } forall .dicttomark
-	  true resolvestream
-	  [ { counttomark 1 add index
-	      64000 string readstring
-	      not { exit} if
-	    } loop
-	  ] exch closefile
-	  0 1 index { length add } forall .bytestring
-	  0 3 2 roll {
+      dup type /arraytype eq {
+        {	% process all output profiles present
+          oforce
+          dup length dict .copydict
+	  dup /DestOutputProfile knownoget {
+  	    PDFfile fileposition exch
+	    mark exch { oforce } forall .dicttomark
+	    //true resolvestream
+	    [ { counttomark 1 add index
+	        64000 string readstring
+	        not { exit } if
+	      } loop
+	    ] exch closefile
+	    0 1 index { length add } forall .bytestring
+	    0 3 2 roll {
 	      3 copy putinterval
 	      length add
-	  } forall pop
-	  exch PDFfile exch setfileposition
-	  1 index /DestOutputProfile 3 2 roll put
-	} if
-	% Convert to string array because it's easier for the device
-	[ 1 index /OutputCondition knownoget not { () } if
-	  2 index /OutputConditionIdentifier knownoget not { () } if
-	  3 index /RegistryName knownoget not { () } if
-	  4 index /Info knownoget not { () } if
-	  5 index /DestOutputProfile knownoget not { () } if
-	]
-	[ /OutputIntent 3 2 roll .pdfputparams pop pop
-        pop	  % done with this OutputIntent dictionary
-      } forall
+	    } forall pop
+	    exch PDFfile exch setfileposition
+	    1 index /DestOutputProfile 3 2 roll put
+	  } if
+	  % Convert to string array because it's easier for the device
+	  [ 1 index /OutputCondition knownoget not { () } if
+	    2 index /OutputConditionIdentifier knownoget not { () } if
+	    3 index /RegistryName knownoget not { () } if
+	    4 index /Info knownoget not { () } if
+	    5 index /DestOutputProfile knownoget not { () } if
+	  ]
+	  [ /OutputIntent 3 2 roll .pdfputparams pop pop
+          pop	  % done with this OutputIntent dictionary
+        } forall
+      } {
+        pop
+        (   **** Warning: OutputIntent attribute of a wrong type is ignored.\n)
+        pdfformaterror
+      } ifelse
     } if	% OutputIntents known
     % tell device there are no more OutputIntents
     [ /OutputIntent [ ] .pdfputparams pop pop



More information about the gs-cvs mailing list