[Gs-code-review] Additional PDF format error noise
Ray Johnston
ray at artifex.com
Tue Feb 5 14:08:14 PST 2002
Reviewers,
Since I agree with Peter that we should be noisy about producer of
bad PDF files, I have added the error messages he suggested when the
q/Q operators are imbalanced.
Proposed log message (for HEAD only):
Add error message complaints when q (gsave) and Q (grestore) operators
do not balance.
Regards,
Ray
_______________________________________________________________________
Index: pdf_main.ps
===================================================================
RCS file: /cvsroot/ghostscript/gs/lib/pdf_main.ps,v
retrieving revision 1.38
diff -c -r1.38 pdf_main.ps
*** pdf_main.ps 2002/02/05 20:50:25 1.38
--- pdf_main.ps 2002/02/05 22:11:12
***************
*** 341,347 ****
**** Please notify the author of the software that produced this file
)
} {
! ( **** The file was produced by ) stderrprint
% Handle a Unicode Producer.
(\376\377) anchorsearch {
pop dup length 2 idiv string 0 1 2 index length 1 sub {
--- 341,347 ----
**** Please notify the author of the software that produced this file
)
} {
! ( **** The file was produced by: \n **** >>>> ) stderrprint
% Handle a Unicode Producer.
(\376\377) anchorsearch {
pop dup length 2 idiv string 0 1 2 index length 1 sub {
***************
*** 350,356 ****
} for exch pop
} if
stderrprint
! (:
**** please notify the author of this software
)
} ifelse stderrprint
--- 350,356 ----
} for exch pop
} if
stderrprint
! ( <<<<
**** please notify the author of this software
)
} ifelse stderrprint
***************
*** 589,595 ****
pdfshowpage_finish
% Some PDF files don't have matching q/Q (gsave/grestore) so we need
% to clean up any left over dicts from the dictstack
! countdictstack PDFdictstackcount sub { end } repeat
(after exec) VMDEBUG
PDFSave restore
} bind def
--- 589,601 ----
pdfshowpage_finish
% Some PDF files don't have matching q/Q (gsave/grestore) so we need
% to clean up any left over dicts from the dictstack
! countdictstack PDFdictstackcount sub dup 0 ne {
! (\n **** File has imbalanced q/Q operators \(too many q's\) ****\n)
! pdfformaterror
! { end } repeat
! } {
! pop
! } ifelse
(after exec) VMDEBUG
PDFSave restore
} bind def
Index: pdf_ops.ps
===================================================================
RCS file: /cvsroot/ghostscript/gs/lib/pdf_ops.ps,v
retrieving revision 1.19
diff -c -r1.19 pdf_ops.ps
*** pdf_ops.ps 2001/12/22 07:24:50 1.19
--- pdf_ops.ps 2002/02/05 22:11:13
***************
*** 98,104 ****
} bdef
% Some PDF files have excess Q operators!
/Q {
! currentdict /self .knownget { exec //nodict eq { end grestore } if } if
} bdef
% ---------------- Color setting ---------------- %
--- 98,111 ----
} bdef
% Some PDF files have excess Q operators!
/Q {
! currentdict /self .knownget {
! exec //nodict eq { end grestore false } { true } ifelse
! } {
! true % formaterror -- not a gsave dict
! } ifelse
! { (\n **** File has imbalanced q/Q operators \(too many Q's\) ****\n)
! pdfformaterror
! } if
} bdef
% ---------------- Color setting ---------------- %
More information about the gs-code-review
mailing list