summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlgs/lib/pdf_rbld.ps
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/tlgs/lib/pdf_rbld.ps')
-rw-r--r--Master/tlpkg/tlgs/lib/pdf_rbld.ps20
1 files changed, 14 insertions, 6 deletions
diff --git a/Master/tlpkg/tlgs/lib/pdf_rbld.ps b/Master/tlpkg/tlgs/lib/pdf_rbld.ps
index 8732be478e3..d21b93c876d 100644
--- a/Master/tlpkg/tlgs/lib/pdf_rbld.ps
+++ b/Master/tlpkg/tlgs/lib/pdf_rbld.ps
@@ -13,7 +13,7 @@
% contact Artifex Software, Inc., 101 Lucas Valley Road #110,
% San Rafael, CA 94903, U.S.A., +1(415)492-9861.
-% $Id: pdf_rbld.ps 8022 2007-06-05 22:23:38Z giles $
+% $Id: pdf_rbld.ps 8472 2008-01-01 14:28:30Z alexcher $
% pdf_rbld.ps - Rebuilding of broken PDF files (xref errors)
% This module contains routines that are used if we detect an error
@@ -31,10 +31,17 @@
% Note: This procedure is also used by non-rebuild code.
% Store a line in the xref array (Actually Objects and Generations arrays)
-% <obj num> (strm num> <obj loc> <gen num> setxrefentry <obj num> strm num>
-% <obj loc> <gen num>
+% <obj num> (strm num> <obj loc> <gen num> <rebuild>
+% setxrefentry <obj num> strm num> <obj loc> <gen num>
/setxrefentry
-{ % We store generation numbers as value + 1
+{
+ 5 1 roll
+ dup 65535 or 65535 ne {
+ ( **** Warning: Generation number out of 0..65535 range, assuming 0.\n)
+ pdfformaterror
+ pop 0
+ } if
+ % We store generation numbers as value + 1
% We reserve 0 to indicate an free xref entry
1 add % increment generation number
% To save space, generations numbers are stored in a lstring unless we
@@ -70,7 +77,7 @@
} if
% Set error flag if we have equal object and generation numbers
Generations 4 index lget 1 index eq { /dup_obj_gen_num true def } if
- } ifelse
+ } 8 -1 roll { ifelse } { pop if } ifelse % Run 'else' only when rebuilding.
} bind def
% Print the contents of the xref array. This actually consists of three
@@ -207,6 +214,7 @@
exch 2 div lt { search_start_trailer } { search_end_trailer } ifelse
% get the trailer
PDFfile exch setfileposition % set to the specified trailer location
+ /dictlevelcount 0 def
PDFfile traileropdict .pdfrun % read trailer info
/Trailer exch def
} bind def
@@ -274,7 +282,7 @@
% save xref parameters into ObjectStream, Objects and Generations
1 index 0 % rearrange parms for setxrefentry
4 index PDFoffset sub 3 index
- setxrefentry % save parameters
+ //true setxrefentry % save parameters
pop pop pop pop % clear parameters
} if % check if name is 'obj'
} if % check if we got 'obj" string