summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinhard Kotucha <reinhard.kotucha@web.de>2021-09-29 01:02:39 +0000
committerReinhard Kotucha <reinhard.kotucha@web.de>2021-09-29 01:02:39 +0000
commit032fbe3299ba69dfde0e6b488c63d7172f5526cc (patch)
tree609e446095e13bafd341617218852c3db3bb254c
parent73f30335fe2918b048eaaedddc30503169fb8be9 (diff)
Upgrade gs-9.54.0 -> gs-9.55.0
git-svn-id: svn://tug.org/texlive/trunk@60648 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/source/ghostscript-9.55.0.tar.xz (renamed from Master/source/ghostscript-9.54.0.tar.xz)bin56001768 -> 67417724 bytes
-rw-r--r--Master/tlpkg/tlgs/README.TEXLIVE11
-rw-r--r--Master/tlpkg/tlgs/Resource/Font/README2
-rw-r--r--Master/tlpkg/tlgs/Resource/Init/gs_cmap.ps55
-rw-r--r--Master/tlpkg/tlgs/Resource/Init/gs_epsf.ps5
-rw-r--r--Master/tlpkg/tlgs/Resource/Init/gs_init.ps6
-rw-r--r--Master/tlpkg/tlgs/Resource/Init/gs_lev2.ps29
-rw-r--r--Master/tlpkg/tlgs/Resource/Init/gs_ll3.ps4
-rw-r--r--Master/tlpkg/tlgs/Resource/Init/gs_pdfwr.ps10
-rw-r--r--Master/tlpkg/tlgs/Resource/Init/gs_res.ps4
-rw-r--r--Master/tlpkg/tlgs/Resource/Init/gs_setpd.ps2
-rw-r--r--Master/tlpkg/tlgs/Resource/Init/gs_statd.ps4
-rw-r--r--Master/tlpkg/tlgs/Resource/Init/gs_ttf.ps28
-rw-r--r--Master/tlpkg/tlgs/Resource/Init/pdf_draw.ps112
-rw-r--r--Master/tlpkg/tlgs/Resource/Init/pdf_font.ps25
-rw-r--r--Master/tlpkg/tlgs/Resource/Init/pdf_main.ps1543
-rw-r--r--Master/tlpkg/tlgs/Resource/Init/pdf_ops.ps32
-rw-r--r--Master/tlpkg/tlgs/lib/Fontmap2
-rw-r--r--Master/tlpkg/tlgs/lib/Fontmap.TeXLive216
-rw-r--r--Master/tlpkg/tlgs/lib/PDFA_def.ps40
-rw-r--r--Master/tlpkg/tlgs/lib/afmdiff.awk302
-rw-r--r--Master/tlpkg/tlgs/lib/cidfmap2
-rw-r--r--Master/tlpkg/tlgs/lib/cidfmap.TeXLive624
-rw-r--r--Master/tlpkg/tlgs/lib/gslp.ps79
-rw-r--r--Master/tlpkg/tlgs/lib/viewgif.ps6
-rw-r--r--Master/tlpkg/tlgs/lib/zugferd.ps452
26 files changed, 2382 insertions, 1213 deletions
diff --git a/Master/source/ghostscript-9.54.0.tar.xz b/Master/source/ghostscript-9.55.0.tar.xz
index 1ff034bdb02..384e7a7a8df 100644
--- a/Master/source/ghostscript-9.54.0.tar.xz
+++ b/Master/source/ghostscript-9.55.0.tar.xz
Binary files differ
diff --git a/Master/tlpkg/tlgs/README.TEXLIVE b/Master/tlpkg/tlgs/README.TEXLIVE
index 797d36b8fad..5603b289651 100644
--- a/Master/tlpkg/tlgs/README.TEXLIVE
+++ b/Master/tlpkg/tlgs/README.TEXLIVE
@@ -1,17 +1,8 @@
-This directory contains a subset of the Ghostscript 9.54.0 distribution
+This directory contains a subset of the Ghostscript 9.55.0 distribution
for Windows. The only purpose of this package is to support programs
shipped with TeX Live. It's not intended for general use.
-The following patch is applied:
-
-From 50dd527e638463fe036fec4b38915151aab9f940 Mon Sep 17 00:00:00 2001
-From: Ken Sharp <ken.sharp@artifex.com>
-Date: Mon, 19 Apr 2021 10:59:02 +0100
-Subject: [PATCH] pdfwrite - defer freeing annotations which are named objects
-
-Bug 703783 "Segmentation fault with named ANN pdfmark"
-
Changes:
* The directories "doc", "examples", "libpng", "trio", "zlib",
diff --git a/Master/tlpkg/tlgs/Resource/Font/README b/Master/tlpkg/tlgs/Resource/Font/README
index a17e115bfa7..e63a1cb1c80 100644
--- a/Master/tlpkg/tlgs/Resource/Font/README
+++ b/Master/tlpkg/tlgs/Resource/Font/README
@@ -1 +1 @@
-This otherwise-empty directory is needed.
+This otherwise-empty directory is needed.
diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_cmap.ps b/Master/tlpkg/tlgs/Resource/Init/gs_cmap.ps
index 0c2e1421565..b836c6384f5 100644
--- a/Master/tlpkg/tlgs/Resource/Init/gs_cmap.ps
+++ b/Master/tlpkg/tlgs/Resource/Init/gs_cmap.ps
@@ -224,11 +224,19 @@
/beginbfchar { % <count> beginbfchar -
pop mark
} bind def
-/endbfchar { % <code> <to_code|charname> ... endbfchar
- counttomark 2 idiv {
- counttomark -2 roll % process in correct order
- .addbfchar
- } repeat 1 .appendmap
+/endbfchar { % [ <code> <to_code|charname> ... endbfchar
+ ] [ //true % [<da><ta>] [ true
+ 3 -1 roll % [ true [<da><ta>]
+ {
+ exch {
+ //false % [ <da> false
+ } { % [ <da> <ta>
+ .addbfchar % [ prefix params key value font_index
+ //true
+ } ifelse
+ } forall
+ pop
+ 1 .appendmap
} bind def
/beginbfrange { % <count> beginbfrange -
@@ -236,26 +244,35 @@
} bind def
/endbfrange { % <code_lo> <code_hi> <to_code|(charname*)> ...
% endbfrange -
- counttomark 3 idiv {
- counttomark -3 roll % process in correct order
- dup type dup /arraytype eq exch /packedarraytype eq or {
+ ] [ 0 % [<da><ta><set>] [ 0
+ 3 -1 roll % [ 0 [<da><ta><set>]
+ {
+ exch % [ <da> 0
+ { 1 2
+ {
+ dup type dup /arraytype eq exch /packedarraytype eq or {
% Array value, split up.
- exch pop {
+ exch pop {
% Stack: code to_code|charname
- 1 index exch .addbfchar
+ 1 index exch .addbfchar
% Increment the code. As noted above, we require
% that only the last byte vary, but we still must
% mask it after incrementing, in case the last
% value was 0xff.
% Stack: code prefix params key value fontindex
- 6 -1 roll dup length string copy
- dup dup length 1 sub 2 copy get 1 add 255 and put
- } forall pop
- } {
+ 6 -1 roll dup length string copy
+ dup dup length 1 sub 2 copy get 1 add 255 and put
+ } forall pop
+ } {
% Single value, handle directly.
- .addbfrange
- } ifelse
- } repeat 1 .appendmap
+ .addbfrange
+ } ifelse
+ 0
+ }
+ } exch get exec
+ } forall
+ pop
+ 1 .appendmap
} bind def
/.addbfchar { % <code> <to_code|charname> .addbfchar
@@ -349,7 +366,7 @@
4 -1 roll % <prefix> <param'> <key> <cid>
.endmapvalue % <prefix> <param'> <key> <hex_cid> <font_idx>
% prefix params keys value fontindex
- counttomark 5 gt { % 2 (or more) ranges (1 range = 5 item)
+ counttomark 9 gt { % 2 (or more) ranges (1 range = 5 item)
4 index 10 index eq % compare prefix
4 index 10 index eq and % compare params
1 index 7 index eq and % compare fontindex
@@ -462,7 +479,7 @@
% See if we can merge with the previous value.
% The prefix, params, and font index must match.
% prefix params keys value fontindex
- counttomark 5 gt { % 2 (or more) ranges (1 range = 5 item)
+ counttomark 9 gt { % 2 (or more) ranges (1 range = 5 item)
4 index 10 index eq % compare prefix
4 index 10 index eq and % compare params
1 index 7 index eq and % compare fontindex
diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_epsf.ps b/Master/tlpkg/tlgs/Resource/Init/gs_epsf.ps
index 47b68bba9be..7f2329d6ab3 100644
--- a/Master/tlpkg/tlgs/Resource/Init/gs_epsf.ps
+++ b/Master/tlpkg/tlgs/Resource/Init/gs_epsf.ps
@@ -270,13 +270,14 @@
/.runNoEPS /run load def
/.runEPS { % file OR string --
+ .updatematrices
/runEPS_save save def
/runEPS_dict_count countdictstack def
/runEPS_op_count count 2 sub def
- /runEPS_page_count currentpagedevice /PageCount get def
+ /runEPS_page_count .currentshowpagecount not {0} if def
0 EPSBoundingBoxSetState
//.runNoEPS
- currentpagedevice /PageCount get runEPS_page_count sub 0 eq
+ .currentshowpagecount not {0} if runEPS_page_count sub 0 eq
{ /showpage load exec } if
count runEPS_op_count sub {pop} repeat
countdictstack runEPS_dict_count sub {end} repeat
diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_init.ps b/Master/tlpkg/tlgs/Resource/Init/gs_init.ps
index 088c8583e3e..e3d65ecad80 100644
--- a/Master/tlpkg/tlgs/Resource/Init/gs_init.ps
+++ b/Master/tlpkg/tlgs/Resource/Init/gs_init.ps
@@ -34,7 +34,7 @@
% Interpreter library version number
% NOTE: the interpreter code requires that the first non-comment token
% in this file be an integer, and that it match the compiled-in version!
-9540
+9550
% Check the interpreter revision.
dup revision ne
@@ -476,6 +476,7 @@ userdict /#copies 1 put
% We have to guard against the BeginPage procedure not popping its operand.
% This is really stupid, but the Genoa CET does it.
/.beginpage { % - .beginpage -
+ .updatematrices
.currentshowpagecount {
.currentpagedevice pop
dup //null ne { /BeginPage .knownget } { pop //false } ifelse {
@@ -491,6 +492,7 @@ userdict /#copies 1 put
% Guard similarly against EndPage not popping its operand.
/.endpage { % <reason> .endpage <print_bool>
+ .updatematrices
.currentshowpagecount {
1 index .currentpagedevice pop
dup //null ne { /EndPage .knownget } { pop //false } ifelse {
@@ -2415,7 +2417,7 @@ currentdict /.locksafeglobal .undef
[
/.bitadd /.charboxpath /.cond /.runandhide /.popdevicefilter
/.execfile /.filenamesplit /.file_name_parent
- /.setdefaultmatrix /.isprocfilter /.unread /.psstringencode
+ /.setdefaultmatrix /.updatematrices /.isprocfilter /.unread /.psstringencode
/.buildsampledfunction /.isencapfunction /.currentaccuratecurves /.currentcurvejoin /.currentdashadapt /.currentdotlength
/.currentlimitclamp /.dotorientation /.setaccuratecurves /.setcurvejoin /.setdashadapt /.setdotorientation
/.setlimitclamp /.currentscreenlevels /.dashpath /.pathbbox /.identeq /.identne /.tokenexec /.forgetsave /.pantonecallback
diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_lev2.ps b/Master/tlpkg/tlgs/Resource/Init/gs_lev2.ps
index 54849370d5c..ecd49370f1c 100644
--- a/Master/tlpkg/tlgs/Resource/Init/gs_lev2.ps
+++ b/Master/tlpkg/tlgs/Resource/Init/gs_lev2.ps
@@ -201,7 +201,7 @@ end
[ /GenericResourceDir /FontResourceDir /GenericResourcePathSep ] {
2 copy .knownget {
exch //pssystemparams exch .knownget {
- ne { /setsystemparams /invalidaccess signalerror } if
+ ne { /setsystemparams cvx /invalidaccess signalerror } if
} {
pop
} ifelse
@@ -279,7 +279,7 @@ end
/.checkFilePermitparams {
type /arraytype eq {
currentuserparams /LockFilePermissions get {
- 5 { pop } repeat /setuserparams /invalidaccess signalerror
+ 5 { pop } repeat /setuserparams cvx /invalidaccess signalerror
}{
% in addition to validating the value, ensure the value is read/only
dup { readonly exch } forall
@@ -288,7 +288,7 @@ end
}
ifelse
} {
- 5 { pop } repeat /setuserparams /typecheck signalerror
+ 5 { pop } repeat /setuserparams cvx /typecheck signalerror
}
ifelse
//true
@@ -534,7 +534,7 @@ serverdict begin
/exitserver { % <password> exitserver -
//true exch { .startnewjob } .startjob not {
- /exitserver /invalidaccess signalerror
+ /exitserver cvx /invalidaccess signalerror
} if
} bind def
@@ -621,13 +621,13 @@ currentuserparams /WaitTimeout known
.dicttomark setpagedevice
} bind def
/setresolution
- { count 1 lt { /setresolution /stackunderflow signalerror } if
+ { count 1 lt { /setresolution cvx /stackunderflow signalerror } if
dup type dup /integertype eq exch /realtype eq or not
{
- /setresolution /typecheck signalerror
+ /setresolution cvx /typecheck signalerror
} if
dup 2 array astore /HWResolution //.pair2dict exec { setpagedevice } stopped {
- pop /setresolution $error /errorname get signalerror
+ pop /setresolution cvx $error /errorname get signalerror
} if
} bind def
%END PAGEDEVICE
@@ -1139,13 +1139,14 @@ def
}{
% Check that the tint is a number between 0 and 1
dup type dup /integertype eq exch /realtype eq or not {
- /setcustomcolor /typecheck cvx signalerror
+ /setcustomcolor cvx /typecheck signalerror
} if
+ % Bug 703869. Apparently Adobe (at least Acrobat Pro) silently clamps values
dup 1 le not {
- /setcustomcolor /rangecheck cvx signalerror
+ pop 1
} if
dup 0 ge not {
- /setcustomcolor /rangecheck cvx signalerror
+ pop 0
} if
% The array is supposed to be the result of fundcmykcustomcolor. Our
@@ -1157,20 +1158,20 @@ def
{
1 index exch get dup
type dup /integertype eq exch /realtype eq or not {
- /setcustomcolor /typecheck cvx signalerror
+ /setcustomcolor cvx /typecheck signalerror
} if
dup
1 le not {
- /setcustomcolor /rangecheck cvx signalerror
+ /setcustomcolor cvx /rangecheck signalerror
} if
0 ge not {
- /setcustomcolor /rangecheck cvx signalerror
+ /setcustomcolor cvx /rangecheck signalerror
} if
} for
% Finally, check the last element of the array, which must be a string.
dup length 1 sub get type /stringtype eq not {
- /setcustomcolor /typecheck cvx signalerror
+ /setcustomcolor cvx /typecheck signalerror
} if
exch //buildcolorspacearray exec
diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_ll3.ps b/Master/tlpkg/tlgs/Resource/Init/gs_ll3.ps
index 98e2a65fb5f..00ec8bca24f 100644
--- a/Master/tlpkg/tlgs/Resource/Init/gs_ll3.ps
+++ b/Master/tlpkg/tlgs/Resource/Init/gs_ll3.ps
@@ -113,9 +113,9 @@ currentdict /.bind_ undef
} bind def
/.bigstring { % <size> .bigstring <string|bytestring>
- count 1 lt { /.bigstring /stackunderflow signalerror } if
+ count 1 lt { /.bigstring cvx /stackunderflow signalerror } if
dup type /integertype ne {
- /.bigstring /typecheck signalerror
+ /.bigstring cvx /typecheck signalerror
} if
dup 65400 gt { .bytestring } { string } ifelse
} bind def
diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_pdfwr.ps b/Master/tlpkg/tlgs/Resource/Init/gs_pdfwr.ps
index 9386339b0ac..ef468522cde 100644
--- a/Master/tlpkg/tlgs/Resource/Init/gs_pdfwr.ps
+++ b/Master/tlpkg/tlgs/Resource/Init/gs_pdfwr.ps
@@ -102,6 +102,7 @@ languagelevel 2 .setlanguagelevel
/UseFlateCompression //true
/UsePrologue //false
/PassThroughJPEGImages //true
+ /PassThroughJPXImages //true
.dicttomark readonly def
/.distillersettings mark
@@ -573,10 +574,10 @@ userdict /.pdfcvstring () put
/pdfmark { % -mark- <key> <value> ... <markname> pdfmark -
counttomark 0 eq {
- /pdfmark /stackunderflow signalerror
+ /pdfmark cvx /stackunderflow signalerror
} if
dup type /nametype eq not {
- /pdfmark /typecheck signalerror
+ /pdfmark cvx /typecheck signalerror
} if
dup /SP eq {
% A hack for synchronizing the clipping path.
@@ -823,6 +824,7 @@ currentdict /.pdf_hook_DSC_Creator undef
/SubsetFonts { }
/DSCEncodingToUnicode { }
/PassThroughJPEGImages { }
+ /PassThroughJPXImages { }
/PSDocOptions { }
/PSPageOptions { }
.dicttomark readonly def
@@ -873,7 +875,7 @@ currentdict /.pdf_hook_DSC_Creator undef
//true
}ifelse
{
- /setdistillerparams /undefined signalerror
+ /setdistillerparams cvx /undefined signalerror
} if
.setdistillerparams
} bind odef
@@ -885,7 +887,7 @@ currentdict /.pdf_hook_DSC_Creator undef
//true
}ifelse
{
- /currentdistillerparams /undefined signalerror
+ /currentdistillerparams cvx /undefined signalerror
} if
.currentdistillerparams
} bind odef
diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_res.ps b/Master/tlpkg/tlgs/Resource/Init/gs_res.ps
index 41214bf358b..c531b36625d 100644
--- a/Master/tlpkg/tlgs/Resource/Init/gs_res.ps
+++ b/Master/tlpkg/tlgs/Resource/Init/gs_res.ps
@@ -1075,7 +1075,7 @@ end
% but it still needs to restore the stacks reliably if it fails.
/.findfontop {
{ /Font findresource } stopped {
- pop /findfont $error /errorname get signalerror
+ pop /findfont cvx $error /errorname get signalerror
} if
} bind executeonly odef
/findfont {
@@ -1100,7 +1100,7 @@ end % level2dict
} forall
/.findencoding {
{ /Encoding findresource } stopped {
- pop /findencoding $error /errorname get signalerror
+ pop /findencoding cvx $error /errorname get signalerror
} if
} bind def
/findencoding /.findencoding load def % must be a procedure
diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_setpd.ps b/Master/tlpkg/tlgs/Resource/Init/gs_setpd.ps
index 2a333bf7642..8d00da5f198 100644
--- a/Master/tlpkg/tlgs/Resource/Init/gs_setpd.ps
+++ b/Master/tlpkg/tlgs/Resource/Init/gs_setpd.ps
@@ -919,7 +919,7 @@ SETPDDEBUG { (Installing.) = pstack flush } if
.currentpagedevice pop exch
{ .setdevice } stopped {
cleartomark exch pop
- /setpagedevice $error /errorname get
+ /setpagedevice cvx $error /errorname get
signalerror
} if
pop
diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_statd.ps b/Master/tlpkg/tlgs/Resource/Init/gs_statd.ps
index 8f01c78c4c1..6751c032908 100644
--- a/Master/tlpkg/tlgs/Resource/Init/gs_statd.ps
+++ b/Master/tlpkg/tlgs/Resource/Init/gs_statd.ps
@@ -269,10 +269,10 @@ readonly def
% (a Level 1 operator) as accepting the values 0 and 1,
% so we do too.
dup type /integertype ne {
- /setpage /typecheck signalerror
+ /setpage cvx /typecheck signalerror
} {
dup 0 ne 1 index 1 ne or {
- /setpage /rangecheck signalerror
+ /setpage cvx /rangecheck signalerror
} {
{/letter /note} 1 index get
//systemdict /userdict get exch get cvx exec
diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_ttf.ps b/Master/tlpkg/tlgs/Resource/Init/gs_ttf.ps
index 95d50c6be60..4fcbd69c28e 100644
--- a/Master/tlpkg/tlgs/Resource/Init/gs_ttf.ps
+++ b/Master/tlpkg/tlgs/Resource/Init/gs_ttf.ps
@@ -240,11 +240,25 @@
% <nametable> <nameid> findname false
/findname {
TTFDEBUG { (findname: ) print dup =only } if
- //false 3 1 roll
- 1 index length 0 gt { % check for zero length name table
+ [ //false 4 2 roll
+ {
0 1 3 index 2 getu16 1 sub {
% Stack: false table id index
- 12 mul 6 add 2 index exch 12 getinterval
+ 12 mul 6 add 2 index exch 12
+ % Check the table is actually long enough to contain the requested index
+ 1 index add 2 index length gt
+ {
+ /pdfformaterror where
+ {
+ ( **** TrueType font has malformed name table.\n) exch /pdfformaterror get exec
+ PDFSTOPONERROR {
+ /.loadpdfttfont cvx /invalidfont signalerror
+ } if
+ } if
+ pop pop
+ exit
+ } if
+ 12 getinterval
dup 6 getu16 2 index eq 1 index 8 getu16 0 ne and {
% We found the name we want.
exch pop
@@ -265,8 +279,12 @@
} ifelse
} if pop
} for
- } if
- pop pop
+ } stopped {
+ cleartomark //false
+ } {
+ pop pop
+ counttomark 1 add -1 roll pop
+ } ifelse
TTFDEBUG {
dup { ( = ) print 1 index //== exec } { ( not found) = } ifelse
} if
diff --git a/Master/tlpkg/tlgs/Resource/Init/pdf_draw.ps b/Master/tlpkg/tlgs/Resource/Init/pdf_draw.ps
index 8527312c10c..6ee8f7e7497 100644
--- a/Master/tlpkg/tlgs/Resource/Init/pdf_draw.ps
+++ b/Master/tlpkg/tlgs/Resource/Init/pdf_draw.ps
@@ -92,10 +92,10 @@ pdfdict begin
exch dup length dict copy % filepos stream fndict2
dup /Function undef % filepos stream fndict2
exch dup token not {
- () /rangecheck cvx signalerror
+ () /rangecheck signalerror
} if
exch token {
- /rangecheck cvx signalerror
+ /rangecheck signalerror
} if
% Use .bind to avoid idiom recognition.
.bind
@@ -529,7 +529,7 @@ end
pdfformaterror
( Output may be incorrect.\n) pdfformaterror
//pdfdict /.gs_warning_issued //true .forceput
- PDFSTOPONERROR { /gs /undefined signalerror } if
+ PDFSTOPONERROR { /gs cvx /undefined signalerror } if
} executeonly if
} executeonly
ifelse
@@ -1758,14 +1758,16 @@ currentdict /jp2_csp_dict .undef
% <resdict> <key> <value> -> <resdict>
/add-to-last-param {
2 index /DecodeParms knownoget {
- dup {} eq {
+ dup type /dicttype ne 1 index type /arrratype ne and 1 index length 1 lt or {
pop //false
} {
//true
} ifelse
} {
//false
- } ifelse {
+ }
+ ifelse
+ {
dup type /arraytype eq {
[ exch { oforce } forall
dup //null eq { pop 1 dict } if
@@ -2180,33 +2182,48 @@ currentdict /last-ditch-bpc-csp undef
%% and don't exhaust memory. Note that we have to copy the actual colour space array too, copying
%% the dictionary just copies the opriginal array as well.
%%
- dup /ColorSpace known {
- dup /ColorSpace get dup type /arraytype eq {
- exch dup length dict copy exch
- dup length array copy /ColorSpace exch 2 index 3 1 roll put
- } {pop} ifelse
- } if
+ 1 dict begin
+ /.ImageDictStackDepth countdictstack def
+ /.ImageOpStackDepth count 2 sub def
+ {
+ dup /ColorSpace known {
+ dup /ColorSpace get dup type /arraytype eq {
+ exch dup length dict copy exch
+ dup length array copy /ColorSpace exch 2 index 3 1 roll put
+ } {pop} ifelse
+ } if
- checkaltimage dup length 6 add dict % <<image>> <<>>
- 1 index /SMask knownoget { % <<image>> <<>> <<sm>>
- dup 3 index ne { % <<image>> <<>> <<sm>> <<sm>>
- 1 index exch /SMask exch put
- } {
- pop
- ( **** Error: ignoring recursive /SMask attribute.\n) pdfformaterror
- ( Output may be incorrect.\n) pdfformaterror
- } ifelse
- } if
- 1 index /Mask knownoget {
- dup type dup /dicttype eq exch /arraytype eq or { % Bug #703681
- 1 index exch /Mask exch put
- } {
- pop
- ( **** Error: Ignoring Mask attribute that is not an array or a dictionary.\n)
- pdfformaterror
- } ifelse
+ checkaltimage dup length 6 add dict % <<image>> <<>>
+ 1 index /SMask knownoget { % <<image>> <<>> <<sm>>
+ dup 3 index ne { % <<image>> <<>> <<sm>> <<sm>>
+ 1 index exch /SMask exch put
+ } {
+ pop
+ ( **** Error: ignoring recursive /SMask attribute.\n) pdfformaterror
+ ( Output may be incorrect.\n) pdfformaterror
+ } ifelse
+ } if
+ 1 index /Mask knownoget {
+ dup type dup /dicttype eq exch /arraytype eq or { % Bug #703681
+ 1 index exch /Mask exch put
+ } {
+ pop
+ ( **** Error: Ignoring Mask attribute that is not an array or a dictionary.\n)
+ pdfformaterror
+ } ifelse
+ } if
+ makeimagedict doimagesmask
+ } PDFSTOPONERROR {exec false}{stopped} ifelse
+ {
+ (\n **** Error: File encountered ')
+ $error /errorname get dup length string cvs concatstrings
+ (' error while processing an image.\n) concatstrings
+ ( Output may be incorrect.\n) concatstrings
+ pdfformaterror
} if
- makeimagedict doimagesmask
+ count .ImageOpStackDepth sub {pop} repeat
+ countdictstack .ImageDictStackDepth sub {end} repeat
+ end
} bind executeonly def
/makemaskimage { % <datasource> <imagemask> <Mask> makemaskimage
% <datasource> <imagemask>, updates currentdict =
@@ -2852,6 +2869,7 @@ currentdict end readonly def
{
%% We are behaving as a printer, check the Print state
/Print .knownget {
+ oforce
/PrintState .knownget {
oforce
/OFF eq {
@@ -2871,6 +2889,7 @@ currentdict end readonly def
/View .knownget {
oforce
/ViewState .knownget {
+ oforce
/OFF eq {
//false
}{
@@ -4331,7 +4350,7 @@ currentdict /set_bc_color undef
scale
dup /InkList knownoget {
{ oforce
- mark exch { oforce } forall
+ [ exch { oforce } forall ]
.pdfinkpath
stroke
} forall
@@ -4695,6 +4714,21 @@ currentdict /set_bc_color undef
/K {setcmykcolor}
>> def
+ % Set some sane defaults, in case the /DA does not.
+ 0 setgray
+ /Helvetica findfont
+ % re-encode the font to PDFDocEncoding
+ dup length dict begin
+ {
+ 1 index /FID ne 2 index /UniqueID ne and { def } { pop pop } ifelse
+ } forall
+ /Encoding /PDFDocEncoding /Encoding findresource def
+ /FontName /Helvetica-PDFDocEncoding def
+ currentdict
+ end
+ /Helvetica-PDFDocEncoding exch definefont
+ 12 scalefont setfont
+
dup /DA knownoget {
length string /tempstr exch def
dup /DA get tempstr copy pop
@@ -4729,21 +4763,7 @@ currentdict /set_bc_color undef
} stopped
{cleartomark setgstate}
{cleartomark pop} ifelse
- } {
- 0 setgray
- /Helvetica findfont
- % re-encode the font to PDFDocEncoding
- dup length dict begin
- {
- 1 index /FID ne 2 index /UniqueID ne and { def } { pop pop } ifelse
- } forall
- /Encoding /PDFDocEncoding /Encoding findresource def
- /FontName /Helvetica-PDFDocEncoding def
- currentdict
- end
- /Helvetica-PDFDocEncoding exch definefont
- 12 scalefont setfont
- }ifelse
+ } if
%% draw the border, if we don't have a border style dictionary, draw a default one.
dup /BS knownoget
diff --git a/Master/tlpkg/tlgs/Resource/Init/pdf_font.ps b/Master/tlpkg/tlgs/Resource/Init/pdf_font.ps
index 699c14fe307..b42cd4cfbb3 100644
--- a/Master/tlpkg/tlgs/Resource/Init/pdf_font.ps
+++ b/Master/tlpkg/tlgs/Resource/Init/pdf_font.ps
@@ -1246,7 +1246,7 @@ setglobal
{
3 index /CharStrings eq
currentdict 3 index known and
- { pstack flush pop pop }
+ { pop pop }
{ systemdict /def get exec }
ifelse
} bind executeonly def
@@ -1301,7 +1301,7 @@ currentdict /eexec_pdf_param_dict .undef
/Resources 1 index /Resources knownoget {
oforce
} {
- LocalResources
+ 0 dict
} ifelse def
/FontBBox 1 index /FontBBox get cvx def
/FontMatrix 1 index /FontMatrix oget def
@@ -1339,8 +1339,9 @@ currentdict /eexec_pdf_param_dict .undef
0 0 0 0 0 0
pdfopdict /d1 get exec
}{
- { //false resolvestream
- % Stack: filepos stream
+ {
+ dup //false resolvestream
+ % Stack: filepos streamdict stream
% Don't let setgcolor set the color inside the BuildGlyph
% procedure, because this causes an /undefined error.
q
@@ -1351,7 +1352,17 @@ currentdict /eexec_pdf_param_dict .undef
%% we use 'nodict'[ to store other PDF state stuff that isn't gstate, and we
%% probably always will, so it may well be more trouble than its worth.
/Dummy //false gput
- Font /Resources get exch pdfopdict
+ Font /Resources get % Stack: filepos streamdict stream resdict
+ dup length 0 eq {
+ 3 -1 roll /Resources knownoget {
+ exch pop
+ ( **** Warning: Type 3 font has resource dictionary in glyph stream.\n)
+ pdfformatwarning
+ } if
+ } {
+ 3 -1 roll pop
+ } ifelse
+ exch pdfopdict
/BuildCharDictDepth countdictstack def
.pdfruncontext
countdictstack BuildCharDictDepth sub
@@ -2740,7 +2751,7 @@ drawopdict begin
{
PDFSTOPONERROR
{
- /typecheck cvx signalerror
+ /typecheck signalerror
}
{
% Bug 689450
@@ -2758,7 +2769,7 @@ drawopdict begin
{
PDFSTOPONERROR
{
- pop /undefined cvx signalerror
+ pop /undefined signalerror
}
{
% Bug 689037
diff --git a/Master/tlpkg/tlgs/Resource/Init/pdf_main.ps b/Master/tlpkg/tlgs/Resource/Init/pdf_main.ps
index ded2782a13e..038c19d1db6 100644
--- a/Master/tlpkg/tlgs/Resource/Init/pdf_main.ps
+++ b/Master/tlpkg/tlgs/Resource/Init/pdf_main.ps
@@ -19,14 +19,14 @@
/.setlanguagelevel where { pop 2 .setlanguagelevel } if
.currentglobal //true .setglobal
pdfdict begin
-/GS_PDF_ProcSet dup load def % keep in pdfdict to hide it
+/GS_PDF_ProcSet dup load def % keep in pdfdict to hide it
userdict /GS_PDF_ProcSet undef
% Patch in an obsolete variable used by some third-party software.
/#? //false def
% Test whether the current output device handles pdfmark.
-/.writepdfmarks { % - .writepdfmarks <bool>
+/.writepdfmarks { % - .writepdfmarks <bool>
/PdfmarkCapable /GetDeviceParam .special_op {
exch pop
}{
@@ -41,7 +41,7 @@ userdict /GS_PDF_ProcSet undef
objopdict { } forall
drawopdict { } forall
/endstream { exit } bind executeonly
- (%%EOF) cvn { exit } bind executeonly % for filters
+ (%%EOF) cvn { exit } bind executeonly % for filters
/obj { ( **** Error: Content stream is not terminated by 'endstream'.\n)
pdfformaterror
( Output may be incorrect.\n) pdfformaterror
@@ -49,7 +49,7 @@ userdict /GS_PDF_ProcSet undef
% PDF 1.1 operators
/BX { /BXlevel BXlevel 1 add store } bind executeonly
/EX { /BXlevel BXlevel 1 sub store } bind executeonly
- /PS { DOPS { cvx exec } { pop } ifelse } bind executeonly % PS disabled by default, as in pdf_draw.ps DoPS
+ /PS { DOPS { cvx exec } { pop } ifelse } bind executeonly % PS disabled by default, as in pdf_draw.ps DoPS
% PDF 1.2 operators
/BMC {
/BMClevel BMClevel 1 add store
@@ -204,7 +204,7 @@ userdict /GS_PDF_ProcSet undef
% ======================== Main program ======================== %
-end % pdfdict
+end % pdfdict
userdict begin
/defaultfontname /Times-Roman def
@@ -217,6 +217,864 @@ DingbatsEncoding pop
% Redefine 'run' so it recognizes PDF files.
systemdict begin
+
+systemdict /NEWPDF known not {/NEWPDF //false def} if
+
+% PostScript interface to the ghostpdf C-based interpreter
+%
+% Promised or documented as used by customers
+% ===========================================
+% runpdf <file> runpdf -
+% Called from the modified run operator (which copies stdin to a temp
+% file if required). Calls runpdfbegin, check for PDF collections. Then
+% calls process_trailer_attrs, runpdfpagerange, dopdfpages and runpdfend
+% to process all the required pages.
+%
+% runpdfbegin <file> runpdfbegin -
+% creates /pdfdict in userdict set userparmas (ProcessDSCComment
+% setobjectformat to 0 /Page# /Page to null DSCPageCount to 0
+% /PDFSave /null.
+% calls pdfopen and then 'begin's the returned dictionary.
+% Also disables page handler device.
+%
+% pdfgetpage <int> pdfgetpage <pagedict> | <null>
+% int is a number from 1 to N indicating the desired page number from
+% the PDF file. Returns a dictionary, apparently the /Page dictionary. Probably
+% we only need the Boxes and Rotate key ? If this fails, returns a null object.
+%
+% pdfshowpage_init <int> pdfshowpage_init <dict>
+% This simply adds 1 to the /DSCPageCount value in the supplied dictioanry
+%
+% pdfshowpage_setpage <pagedict> pdfshowpage_setpage <pagedict>
+% Takes a dictionary as returned from pdfgetpage, extracts various
+% parameters from it, and sets the media size for the page, taking into
+% account the boxes, and requested Box, Rotate value and PDFFitPage.
+%
+% pdfshowpage_finish <pagedict> pdfshowpage_finish -
+% Takes a dictionary as returned from pdfgetpage, renders the page content
+% executes showpage to transfer the rendered content to the device.
+%
+% runpdfend -
+% Uses currentdict as an argument to pdfclose, which closes /PDFfile. Also
+% executes restore and various cleanup activities.
+%
+% Also Used by gsview 5
+% =====================
+% pdfopen <file> pdfopen <dict>
+% According to the comments; open a PDF file and read the header, trailer
+% and cross-reference. Calls pdfopenfile and 'begin's the returned dictionary
+% calls pdfopencache and then closes the current dictionary.
+% pdfopenfile appears to create a dictionary containing a load of stuff but
+% most importantly, sets /PDFfile to the passed-in file. Probably also contains
+% the Trailer dictionary.
+%
+% pdfclose <dict> pdfclose -
+% The supplied dictionary contains /PDFfile and it executes closefile on that
+% supplied file.
+%
+% Supplied by Ray to customer
+% ============================
+% pdfshowpage <pagedict> pdfshowpage
+% Takes a dictionary returned from pdfgetpage and calls the pdfshowpage_init
+% pdfshowpage_setpage, pdfshowpage_finish trio to start the page, set up the
+% media and render the page.
+%
+% dopdfpages <int> <int> dopdfpages -
+% The integers are the first and last pages to be run from the file. Runs a loop from
+% the fist integer to the last. NOTE! If the current dictionary contains a PDFPageList
+% array then we 'get' the entry from the array corresponding to the current loop
+% index, and use that to determine whether we should draw the page. Otherwise we
+% simply draw the page. Uses pdfshowpage to actually render the page.
+%
+% Additionallly useful ?
+% =======================
+% runpdfpagerange - runpdfpagerange <int> <int>
+% Processes the PostScript /FirstPage, /LastPage and /PageList parameters to build an array
+% of page numbers to run (if PageList is present) and a FirstPage and LastPage value.
+% There seems no point in rewriting this, may as well use it to control page processing.
+%
+% Normal operation
+% =================
+% runpdf - runpdfbegin - pdfopen
+% - process_trailer_attrs
+% - runpdfpagerange
+% - dopdfpages - pdfgetpage
+% - pdfshowpage - pdfshowpage_init
+% - pdfshowpage_setpage
+% - pdfshowpage_finish
+% - runpdfend - pdfclose
+%
+
+/DisablePageHandlerDevice
+{
+ systemdict /FirstPage known
+ systemdict /LastPage known or
+ systemdict /PageList known or
+ {
+ <</DisablePageHandler //true>> setpagedevice
+ } if
+} bind def
+
+/EnablePageHandlerDevice
+{
+ systemdict /FirstPage known
+ systemdict /LastPage known or
+ systemdict /PageList known or
+ {
+ <</DisablePageHandler //false>> setpagedevice
+ } if
+} bind def
+
+/newpdf_pdfformaterror { % <string> pdfformaterror -
+ (%stdout) (w) file
+ dup 3 -1 roll writestring flushfile
+} bind executeonly def
+
+% This routine sets up the transparency compositor requirement, and
+% number of spot channels required (if any) in the device. This needs
+% to be done before we set the media size, so that the erasepage is
+% correct. Called with the dictionary returned from .PDFPageInfo
+/newpdf_device_setup
+{
+ 2 dict exch % <<page dict>> << >>
+ dup /UsesTransparency get % << >> <<page dict>> bool
+ /PageUsesTransparency exch % << >> <<page dict>> /PageUsesTransparency bool
+ 3 index 3 1 roll % << >> <<page dict>> <<info dict>> << >> /PageUsesTransparency bool
+ put % <</PageUsesTransparency bool>> <<page dict>>
+ /NumSpots get % <</PageUsesTransparency bool>> int
+ /PageSpotColors exch % <</PageUsesTransparency bool>> /PageSpotColors int
+ 2 index 3 1 roll % <</PageUsesTransparency bool>> <<page dict>> /PageSpotColors int
+ put % <</PageUsesTransparency bool /PageSpotColors int >>
+ setpagedevice
+}bind def
+
+% Takes the selected Box as a parameter and scales it to fit the current media.
+% If the amount of scaling would be reduced by rotating the content, then
+% rotate the content.
+% Caters for the box non-zero lower left x and y (ie cropping)
+/NewPDF_FitPage
+{
+ dup 2 get 1 index 0 get sub %urx -llx = width
+ 1 index 3 get 2 index 1 get sub %ury - lly = height
+
+ currentpagedevice /PageSize get aload pop % Stack - box boxwidth boxheight mediawidth mediaheight
+
+ % Start by deciding if we should rotate the page to better fit the media.
+ 4 copy eq
+ 3 1 roll eq
+ or % square media or square page, no point in rotating
+ {
+ //false
+ }
+ {
+ gt
+ { % landscape media
+ ge
+ { % landscape media, landscape box, no rotation
+ //false
+ }
+ { % landscape media, portrait box, rotate it to landscape
+ //true
+ } ifelse
+ }
+ { % portrait media
+ ge
+ { % portrait media, landscape box, rotate it to portrait
+ //true
+ }
+ { % portrait media, portrait box, no rotation
+ //false
+ } ifelse
+ }ifelse
+ } ifelse
+
+ % Store values for calculating scale, we do this here because we want to
+ % swap the media width and height (for the scale calculation) if we are
+ % rotating the page
+ 1 index 2 get 2 index 0 get sub % urx -llx = width
+ 2 index 3 get 3 index 1 get sub % ury - lly = height
+ currentpagedevice /PageSize get aload pop % Stack - box rotate boxwidth boxheight mediawidth mediaheight
+ 5 -1 roll % Stack - box boxwidth boxheight mediawidth mediaheight rotate
+
+ % If we need to rotate, recalculate the box
+ {
+ 90 rotate
+ 0 2 index neg translate % move 0,0 to bottom right of media to account for rotation
+ exch % swap media width/height for scaling calculation
+ }if
+
+ % Stack - box boxwidth boxheight mediawidth mediaheight
+ % Incorporate up any offset from 0,0
+ 4 index aload pop pop pop neg exch neg exch
+ 2 copy exch
+ translate
+
+ % Now use the box and media values to calculate the required x/y scale factors
+ 3 -1 roll div % box boxwidth mediawidth (mediaheight / boxheight)
+ 3 1 roll % box (mediaheight / boxheight) boxwidth mediawidth
+ exch % box (mediaheight / boxheight) mediawidth boxwidth
+ div % box (mediaheight / boxheight) (mediawidth / boxwidth)
+
+ 2 copy % box Yscale Xscale Yscale Xscale
+ gt {exch} if % select smallest scale factor
+ pop %
+ dup scale % and scale page isomorphically
+ pop pop
+} bind def
+
+/newpdf_get_media_box { % <pagedict> get_media_box <box> <bool>
+ dup /MediaBox known {
+ /MediaBox get
+ dup length 4 eq {
+ //true
+ }
+ {
+ pop
+ ( **** Error: Page has an invalid /MediaBox attribute. Using the current page size.\n)
+ newpdf_pdfformaterror
+ ( Output may be incorrect.\n) pdfformaterror
+ [ 0 0 currentpagedevice /PageSize get aload pop ]
+ //false
+ }ifelse
+ }
+ {
+ pop
+ ( **** Error: Page has no /MediaBox attribute. Using the current page size.\n)
+ newpdf_pdfformaterror
+ ( Output may be incorrect.\n) newpdf_pdfformaterror
+ [ 0 0 currentpagedevice /PageSize get aload pop ] //false
+ } ifelse
+%(newpdf_get_media_box end) == flush
+} bind executeonly def
+
+/newpdf_get_any_box { % <pagedict> get_any_box <box name> <box>
+%(newpdf_get_any_box start) == flush
+ //systemdict /UseBleedBox .knownget dup { and } if {
+ dup /BleedBox get {
+ /BleedBox exch
+ } if
+ } if
+ //systemdict /UseTrimBox .knownget dup { and } if {
+ dup /TrimBox get {
+ /TrimBox exch
+ } if
+ } if
+ dup type /arraytype ne {
+ //systemdict /UseArtBox .knownget dup { and } if {
+ dup /ArtBox get {
+ /ArtBox exch
+ } if
+ } if
+ } if
+ dup type /arraytype ne {
+ //systemdict /UseCropBox .knownget dup { and } if {
+ dup /CropBox get {
+ /CropBox exch
+ } if
+ } if
+ } if
+ dup type /arraytype ne {
+ /MediaBox exch newpdf_get_media_box pop
+ } {
+ %% Complicated stuff. We need to use the 'Box' we identified (if any), but we
+ %% need to clamp the boundaries of the 'Box' to the MediaBox. This appears to
+ %% be what Acrobat does. The complication arises because the Box values don't
+ %% have to be sensibly positive, its permissible to have the MediaBox set up
+ %% so that it extends down and left instead of up and right. We take care of the
+ %% content when we st up the CTM, but we do need to make sure that we clamp
+ %% the BoundingBox, and that means we need to take direcitonality into account...
+
+ 6 -1 roll newpdf_get_media_box { % /SomeBox x0 y0 x1 y1 [MediaBox]
+ aload pop % /SomeBox x0 y0 x1 y1 X0 Y0 X1 Y1
+
+ %% Start with the width, get the X0 and X1 values of the MediaBox
+ 3 index % /SomeBox x0 y0 x1 y1 X0 Y0 X1 Y1 X0
+ 2 index % /SomeBox x0 y0 x1 y1 X0 Y0 X1 Y1 X0 X1
+ gt {
+ %% Media extends to left
+ 4 -1 roll % /SomeBox x0 y0 x1 y1 Y0 X1 Y1 X0
+ 8 -1 roll % /SomeBox y0 x1 y1 Y0 X1 Y1 X0 x0
+ .min % /SomeBox y0 x1 y1 Y0 X1 Y1 mX0
+ 7 1 roll % /SomeBox mX0 y0 x1 y1 Y0 X1 Y1
+ exch % /SomeBox mX0 y0 x1 y1 Y0 Y1 X1
+ 5 -1 roll % /SomeBox mX0 y0 y1 Y0 Y1 X1 x1
+ .max % /SomeBox mX0 y0 y1 Y0 Y1 mX1
+ 5 1 roll % /SomeBox mX0 mX1 y0 y1 Y0 Y1
+ }{
+ %% Media extends to right
+ 4 -1 roll % /SomeBox x0 y0 x1 y1 Y0 X1 Y1 X0
+ 8 -1 roll % /SomeBox y0 x1 y1 Y0 X1 Y1 X0 x0
+ .max % /SomeBox y0 x1 y1 Y0 X1 Y1 mX0
+ 7 1 roll % /SomeBox mX0 y0 x1 y1 Y0 X1 Y1
+ exch % /SomeBox mX0 y0 x1 y1 Y0 Y1 X1
+ 5 -1 roll % /SomeBox mX0 y0 y1 Y0 Y1 X1 x1
+ .min % /SomeBox mX0 y0 y1 Y0 Y1 mX1
+ 5 1 roll % /SomeBox mX0 mX1 y0 y1 Y0 Y1
+ } ifelse
+
+ %% Now deal with the height
+ 2 copy % /SomeBox mX0 mX1 y0 y1 Y0 Y1 Y0 Y1
+ gt {
+ %% Media extends down
+ exch % /SomeBox mX0 mX1 y0 y1 Y1 Y0
+ 4 -1 roll % /SomeBox mX0 mX1 y1 Y1 Y0 y0
+ .min % /SomeBox mX0 mX1 y1 Y1 mY0
+ 3 1 roll % /SomeBox mX0 mX1 mY0 y1 Y1
+ .max % /SomeBox mX0 mX1 mY0 mY1
+ }{
+ %% Media extends up
+ exch % /SomeBox mX0 mX1 y0 y1 Y1 Y0
+ 4 -1 roll % /SomeBox mX0 mX1 y1 Y1 Y0 y0
+ .max % /SomeBox mX0 mX1 y1 Y1 mY0
+ 3 1 roll % /SomeBox mX0 mX1 mY0 y1 Y1
+ .min % /SomeBox mX0 mX1 mY0 mY1
+ } ifelse
+ exch % /SomeBox mX0 mX1 mY1 mY0
+ 3 1 roll % /SomeBox mX0 mY0 mX1 mY1
+ } {
+ pop
+ } ifelse
+ 4 array astore % /SomeBox [mX0 mY0 mX1 mY1]
+ } ifelse
+} bind executeonly def
+
+% This routine is used to set the PostScript /PageSize from the requested Box of the
+% PDF file. Much of this is copied from the old pdfshowpage_setpage routine which
+% is used for the PDF interpreter written in PostScript.
+%
+% Called with a dictionary containing the PDF page information.
+%
+/newpdf_set_pagesize
+{
+ % Stack: pdfpagedict
+
+ % Don't understand this at all, removed for now replace if we ever figure out
+ % what it's for.
+ % Only lock in Orientation if we need to for pdfmarks
+% .writepdfmarks { /Orientation 0 def } if
+
+ dup
+ dup newpdf_get_any_box % Stack: pdfpagedict pdfpagedict /BoxName [box]
+
+ //systemdict /PDFFitPage known {
+ NewPDF_FitPage
+ } {
+ 6 dict begin % for setpagedevice
+
+ % Set the page size.
+ 2 index /UserUnit known
+ {
+ systemdict /NoUserUnit .knownget not {//false} if
+ {
+ 2 index /UserUnit undef
+ % No scaling required, calculate PageSize as the width and height of the box
+ aload 5 1 roll % box llx lly urx ury
+ 2 index sub % box llx lly urx (ury - lly)
+ exch 3 index sub % box llx lly (ury - lly) (urx - llx)
+ exch
+ }
+ {
+ 2 index /UserUnit get
+ % The PageSize needs to be multiplied too
+ exch aload 5 1 roll % UserUnit box llx lly urx ury
+ 2 index sub exch % UserUnit box llx lly (ury - lly) urx
+ 3 index sub % UserUnit box llx lly boxheight boxwidth
+ 5 index mul % UserUnit box llx lly boxheight (Boxwidth*UserUnit)
+ exch
+ 5 index mul % UserUnit box llx lly (Boxwidth*UserUnit) (boxheight*UserUnit)
+ 4 -2 roll
+ 5 index mul exch % UserUnit box (Boxwidth*UserUnit) (boxheight*UserUnit) (lly*UserUnit) llx
+ 5 index mul exch % UserUnit box (Boxwidth*UserUnit) (boxheight*UserUnit) (llx*UserUnit) (lly*UserUnit)
+ 4 2 roll % UserUnit box (llx*UserUnit) (lly*UserUnit) (Boxwidth*UserUnit) (boxheight*UserUnit)
+ 6 -1 roll pop % box (llx*UserUnit) (lly*UserUnit) (Boxwidth*UserUnit) (boxheight*UserUnit)
+ } ifelse
+ }
+ {
+ /PassUserUnit /GetDeviceParam .special_op {
+ exch pop {
+ [ /UserUnit 1 .pdfputparams pop pop
+ } if
+ }if
+ % No scaling required, calculate PageSize as the width and height of the box
+ aload 5 1 roll % box llx lly urx ury
+ 2 index sub % box llx lly urx (ury - lly)
+ exch 3 index sub % box llx lly (ury - lly) (urx - llx)
+ exch
+ } ifelse
+
+ % handle page rotation here
+ 6 index /Rotate known {
+ % PDF page rotation runs clockwise and must be a multiple of 90, unlike PostScript.....
+ % convert Rotate into a quadrant number
+ 6 index /Rotate get 90 div cvi
+ % Make sure quadrant is 0-3
+ dup 0 lt {
+ % Negative rotation... Turn it into a positive rotation
+ % Again, limit the quadrant to -0 to -3
+ dup -4 lt {4 mod} if
+ % Adding 360 degrees results in the same positive rotation
+ 4 add
+ } if
+ dup 3 gt {4 mod} if
+ dup 0 eq
+ {
+ pop
+ 2 array astore /PageSize exch def
+ currentdict end setpagedevice
+ neg exch neg exch
+ translate
+ }
+ {
+ dup 1 eq
+ {
+ pop
+ exch 4 2 roll exch 4 2 roll
+ 2 array astore dup /PageSize exch def
+ currentdict end setpagedevice
+ 270 rotate
+ 1 get add neg exch neg
+ translate
+ }
+ {
+ 2 eq
+ {
+ 2 array astore dup /PageSize exch def
+ currentdict end setpagedevice
+ 180 rotate
+ aload pop 3 -1 roll add neg 3 1 roll add neg exch
+ translate
+ }
+ {
+ exch 4 2 roll exch 4 2 roll
+ 2 array astore dup /PageSize exch def
+ currentdict end setpagedevice
+ 90 rotate
+ 0 get 3 -1 roll add
+ neg exch neg exch
+ translate
+ } ifelse
+ } ifelse
+ } ifelse
+ }
+ {
+ 2 array astore /PageSize exch def
+ currentdict end setpagedevice
+ neg exch neg exch
+ translate
+ }ifelse
+
+ % scale the co-ordinate system by the UserUnit
+ % We have to do this after setting the PageSize, because
+ % setpagedevice does an implicit initgraphics, resetting the CTM.
+ %
+ //systemdict /NoUserUnit .knownget not { //false } if not
+ {
+ 2 index /UserUnit known {
+ 2 index /UserUnit get
+ dup scale
+ } if
+ } if
+ } ifelse
+
+ pop % The box
+
+ % If we are using the MediaBox (and only the MediaBox) then we
+ % want to clip to the CropBox, if there s one present
+
+ /MediaBox eq {
+ dup /CropBox known {
+ /CropBox get
+ aload pop 2 index sub exch 3 index sub exch rectclip
+ } {
+ pop
+ } ifelse
+ } if
+
+ pop
+} bind executeonly def
+
+% This routine checks a list of known/implemented command line switches to see if they
+% have been defined in the PostScript environment. If they have we construct a dictionary
+% containing the names and their values, and return it. That dictionary can then be
+% passed to a custom PostScript operator and used to configure the PDF interpreter.
+%
+% NB device parameters will already have been sent to the device and used to configure it
+% so here we should only handle parameters which control the behaviour of the interpreter.
+%
+/newpdf_gather_parameters
+{
+ 10 dict begin
+ /PDFSwitches [ /PDFPassword /PDFDEBUG /PDFSTOPONERROR /PDFSTOPONWARNING /NOTRANSPARENCY /FirstPage /LastPage
+ /NOCIDFALLBACK /NO_PDFMARK_OUTLINES /NO_PDFMARK_DESTS /PDFFitPage /Printed
+ /UseBleedBox /UseCropBox /UseArtBox /UseTrimBox /ShowAcroForm /ShowAnnots /PreserveAnnots
+ /NoUserUnit /RENDERTTNOTDEF /DOPDFMARKS /PDFINFO /SHOWANNOTTYPES /PRESERVEANNOTTYPES] def
+
+ 0 1 PDFSwitches length 1 sub {
+ PDFSwitches exch get dup where {
+ exch dup 3 1 roll get def
+ }
+ {
+ pop
+ } ifelse
+ } for
+ currentdict /PDFSwitches undef
+ currentdict end
+} bind executeonly def
+
+/newpdf_pagecount
+{
+ PDFFile //null eq not
+ {
+ PDFFile {.PDFInfo} stopped not
+ {
+ dup /NumPages known
+ {
+ /NumPages get
+ }
+ {
+ pop 0
+ } ifelse
+ }
+ {
+ pop 0
+ } ifelse
+ }
+ {
+ 0
+ } ifelse
+}bind def
+
+/newpdf_runpdfpagerange
+{
+ /PageList where {
+ pop PageList
+ (even) anchorsearch {
+ pop length 0 gt {
+ /runpdfpagerange cvx /syntaxerror signalerror
+ } if
+ /PDFPageList pdfpagecount 1 add array def
+ 2 2 pdfpagecount {
+ PDFPageList exch 1 put
+ } for
+ QUIET not {
+ (Processing even-numbered pages\n) print (1 through ) print pdfpagecount =only
+ (.) = flush
+ } if
+ } {
+ (odd) anchorsearch {
+ pop length 0 gt {
+ /runpdfpagerange cvx /syntaxerror signalerror
+ } if
+ /PDFPageList pdfpagecount 1 add array def
+ 1 2 pdfpagecount {
+ PDFPageList exch 1 put
+ } for
+ QUIET not {
+ (Processing odd-numbered pages\n) print (1 through ) print pdfpagecount =only
+ (.) = flush
+ } if
+ } {
+ %% validate string contents, check for digit comma or minus
+ dup
+ {
+ dup 44 eq not {
+ dup 45 eq not {
+ dup 48 lt 1 index 57 gt or {
+ /runpdfpagerange cvx /syntaxerror signalerror
+ } if
+ } if
+ } if
+ pop
+ }
+ forall
+ /PDFPageList pdfpagecount 1 add array def
+ {
+ (,) search {
+ %% We now have (post) (,) (pre)
+ exch pop %% get rid of the (,), leave the (post) as the string for the next iteration, deal with the section up to the comma
+ (-) search {
+ %% Now we have (end) (-) (start)
+ exch pop %% get rid of the minus (end) (start)
+ 0 exch {48 sub exch 10 mul add} forall
+ %% Make sure the start of the range is inside the number of available pages
+ dup pdfpagecount le {
+ exch
+ %% deal with a trailing '-' by replacing it with the number of pages in the file
+ dup length 0 eq {
+ pop pdfpagecount
+ }{
+ 0 exch {48 sub exch 10 mul add} forall
+ } ifelse
+ 1 exch %% start 1 end
+ %% Make sure the end of the range is inside the number of available pages
+ dup pdfpagecount gt {pop pdfpagecount} if
+ {PDFPageList exch 1 put} for
+ } {
+ %% start of range invalid, drop this range.
+ pop pop
+ }ifelse
+ }{
+ %% no minus signs, must be a simple page number
+ 0 exch {48 sub exch 10 mul add} forall
+ %% ensure its in the valid range of pages
+ dup pdfpagecount le {
+ PDFPageList exch 1 put
+ } {
+ pop
+ } ifelse
+ } ifelse
+ }{
+ %% no commas separating pages, just the original string (), deal with its as a section, then exit the loop
+ (-) search {
+ %% Now we have (end) (-) (start)
+ exch pop %% get rid of the minus (end) (start)
+ 0 exch {48 sub exch 10 mul add} forall
+ %% Make sure the start of the range is inside the number of available pages
+ dup pdfpagecount le {
+ exch
+ %% deal with a trailing '-' by replacing it with the number of pages in the file
+ dup length 0 eq {
+ pop pdfpagecount
+ }{
+ 0 exch {48 sub exch 10 mul add} forall
+ } ifelse
+ 1 exch %% start 1 end
+ %% Make sure the end of the range is inside the number of available pages
+ dup pdfpagecount gt {pop pdfpagecount} if
+ {PDFPageList exch 1 put} for
+ } {
+ %% start of range invalid, drop this range.
+ pop pop
+ }ifelse
+ }{
+ %% no minus signs, must be a simple page number
+ 0 exch {48 sub exch 10 mul add} forall
+ %% ensure its in the valid range of pages
+ dup pdfpagecount le {
+ PDFPageList exch 1 put
+ } {
+ pop
+ } ifelse
+ } ifelse
+ exit %% done all the sections.
+ } ifelse
+ } loop
+ QUIET not {
+ (Processing pages ) print PageList =only
+ (.) = flush
+ } if
+ } ifelse
+ } ifelse
+ 1 pdfpagecount
+ }{
+ /FirstPage where {
+ pop FirstPage dup pdfpagecount gt {
+ (\nRequested FirstPage is greater than the number of pages in the file: ) print
+ pdfpagecount = flush
+ } if
+ } {
+ 1
+ } ifelse
+ /LastPage where {pop LastPage pdfpagecount .min } { pdfpagecount } ifelse
+ 1 index 1 index gt {
+ ( No pages will be processed \(FirstPage > LastPage\).) = flush
+ } {
+ QUIET not {
+ (Processing pages ) print 1 index =only ( through ) print dup =only
+ (.) = flush
+ } if
+ } ifelse
+ } ifelse
+} bind def
+
+% <file> runpdf -
+/newpdf_runpdf
+{
+ runpdfbegin % <file> runpdfbegin -
+ PDFInfo /Collection known
+ {
+ PDFInfo /Collection get
+ pdfclose
+ dup length 1 sub 0 2 3 -1 roll
+ {
+ 1 index exch get (r) file runpdf
+ } for
+ pop
+ }
+ {
+ process_trailer_attrs % - process_trailer_attrs -
+ runpdfpagerange % - runpdfpagerange <int> <int>
+ dopdfpages % <int> <int> dopdfpages -
+ runpdfend % - runpdfend -
+ } ifelse
+} bind def
+
+/newpdf_runpdfbegin
+{
+ /pdfdict 10 dict def
+ pdfdict begin
+
+ % This is for the benefit of pdf2dsc which assumes it will be present
+ /Trailer << >> def
+ /PDFSave save def
+ % Define these in the current dictionary, if anyone uses
+ % systemdict then this will be defeated so we'll add extra
+ % code to the systemdict definitions as well.
+ /pdfpagecount /newpdf_pagecount load def
+ /pdfgetpage /newpdf_pdfgetpage load def
+ /pdfshowpage /newpdf_pdfshowpage load def
+ /pdfshowpage_init /newpdf_pdfshowpage_init load def
+ /pdfshowpage_setpage /newpdf_pdfshowpage_setpage load def
+ /pdfshowpage_finish /newpdf_pdfshowpage_finish load def
+ /pdfopen /newpdf_pdfopen load def
+ /pdfclose /newpdf_pdfclose load def
+ /dopdfpages /newpdf_dopdfpages load def
+ /runpdfend /newpdf_runpdfend load def
+ /runpdfpagerange /newpdf_runpdfpagerange load def
+ /process_trailer_attrs /newpdf_process_trailer_attrs load def
+
+ % These are also for the benefit of pdf2dsc, which assumes they
+ % are available.
+ /knownoget {2 copy known {get //true}{pop //false}ifelse} bind def
+ /pget {2 copy known {get //true}{pop //false}ifelse}bind def
+
+ newpdf_gather_parameters
+ {.PDFInit} stopped
+ {
+ /PDFFile //null def
+ /PDFInfo //null def
+ }
+ {
+ /PDFFile exch def
+ pdfopen
+ /PDFInfo exch def
+ pop
+ }ifelse
+} bind def
+
+/newpdf_pdfgetpage
+{
+ PDFFile exch 1 sub {.PDFPageInfo} stopped
+ {
+ pop pop
+ ( **** Error: Couldn't get page info.\n) newpdf_pdfformaterror
+ ( Output may be incorrect.\n) newpdf_pdfformaterror
+ //null
+ } if
+} bind def
+
+/newpdf_process_trailer_attrs
+{
+}bind def
+
+/newpdf_pdfshowpage_init
+{
+ gsave
+} bind def
+
+/newpdf_pdfshowpage_setpage
+{
+ dup newpdf_device_setup
+ dup newpdf_set_pagesize
+} bind def
+
+/newpdf_pdfshowpage_finish
+{
+ /Page# get PDFFile exch 1 sub {.PDFDrawPage} stopped
+ {
+ pop pop
+ ( **** Error: Page drawing error occured.\n) newpdf_pdfformaterror
+ ( Output may be incorrect.\n) newpdf_pdfformaterror
+ } if
+ showpage
+ grestore
+} bind def
+
+/newpdf_pdfshowpage
+{
+ pdfshowpage_init
+ pdfshowpage_setpage
+ pdfshowpage_finish
+} bind def
+
+/newpdf_runpdfend
+{
+ pdfclose
+ PDFSave restore
+ end % pdfdict
+} bind def
+
+/newpdf_pdfopen
+{
+ dup PDFFile //null ne
+ {
+ PDFFile {.PDFStream} stopped
+ {
+ pop pop
+ ( **** Error: Couldn't initialise file.\n) newpdf_pdfformaterror
+ ( Output may be incorrect.\n) newpdf_pdfformaterror
+ <</NumPages 0>>
+ }
+ {
+ PDFFile {.PDFInfo} stopped
+ {
+ pop
+ ( **** Error: Couldn't get page information.\n) newpdf_pdfformaterror
+ ( Output may be incorrect.\n) newpdf_pdfformaterror
+ <</NumPages 0>>
+ } if
+ } ifelse
+ }
+ {
+ pop
+ <</NumPages 0>>
+ } ifelse
+} bind def
+
+/newpdf_pdfclose
+{
+ PDFFile {.PDFClose} stopped
+ {
+ pop
+ } if
+} bind def
+
+% <int> <int> dopdfpages -
+% First Page and then LastPage
+/newpdf_dopdfpages
+{
+ //DisablePageHandlerDevice exec
+ 1 exch
+ {
+ %% If we have a array of pages to render, use it.
+ /PDFPageList where {
+ pop dup PDFPageList exch get 1 eq
+ }
+ {//true} ifelse
+
+ {
+ QUIET not { (Page ) print dup //== exec flush } if
+ dup pdfgetpage
+ dup //null ne {
+ exch 1 index
+ /Page# 3 -1 roll put
+ pdfshowpage
+ } {
+ PDFSTOPONERROR {
+ /dopdfpages cvx /syntaxerror signalerror
+ } {
+ pop pop
+ ( **** Error: page) newpdf_pdfformaterror
+ ( not found.\n) newpdf_pdfformaterror
+ } ifelse
+ } ifelse
+ }{
+ pop
+ }ifelse
+ } for
+ //EnablePageHandlerDevice exec
+} bind def
+
/.runps /run load def
/run {
dup type /filetype ne { (r) file } if
@@ -280,27 +1138,12 @@ systemdict begin
} bind odef
currentdict /runpdfstring .undef
-/DisablePageHandlerDevice
-{
- systemdict /FirstPage known
- systemdict /LastPage known or
- systemdict /PageList known or
+/runpdfbegin { % <file> runpdfbegin -
+ /NEWPDF where {/NEWPDF get} {//true} ifelse
{
- <</DisablePageHandler //true>> setpagedevice
- } if
-} bind def
-
-/EnablePageHandlerDevice
-{
- systemdict /FirstPage known
- systemdict /LastPage known or
- systemdict /PageList known or
+ newpdf_runpdfbegin
+ }
{
- <</DisablePageHandler //false>> setpagedevice
- } if
-} bind def
-
-/runpdfbegin { % <file> runpdfbegin -
userdict begin
% It turns out that the PDF interpreter uses memory more
% effectively if it is run under at least one level of save.
@@ -335,10 +1178,16 @@ currentdict /runpdfstring .undef
//pdfdict begin
pdfopen begin
/CumulativePageCount currentpagedevice /PageCount get def
+ } ifelse
} bind executeonly def
-/runpdfpagerange { % - runpdfpagerange <firstpage#> <lastpage#>
+/runpdfpagerange { % - runpdfpagerange <firstpage#> <lastpage#>
+ /NEWPDF where {/NEWPDF get} {//true} ifelse
+ {
+ newpdf_runpdfpagerange
+ }
+ {
/PortfolioPage where {
pop
PortfolioPage cvi dup pdfpagecount add % a b+1
@@ -382,7 +1231,7 @@ currentdict /runpdfstring .undef
pop PageList
(even) anchorsearch {
pop length 0 gt {
- /runpdfpagerange /syntaxerror cvx signalerror
+ /runpdfpagerange cvx /syntaxerror signalerror
} if
/PDFPageList pdfpagecount 1 add array def
2 2 pdfpagecount {
@@ -395,7 +1244,7 @@ currentdict /runpdfstring .undef
} {
(odd) anchorsearch {
pop length 0 gt {
- /runpdfpagerange /syntaxerror cvx signalerror
+ /runpdfpagerange cvx /syntaxerror signalerror
} if
/PDFPageList pdfpagecount 1 add array def
1 2 pdfpagecount {
@@ -412,7 +1261,7 @@ currentdict /runpdfstring .undef
dup 44 eq not {
dup 45 eq not {
dup 48 lt 1 index 57 gt or {
- /runpdfpagerange /syntaxerror cvx signalerror
+ /runpdfpagerange cvx /syntaxerror signalerror
} if
} if
} if
@@ -518,12 +1367,18 @@ currentdict /runpdfstring .undef
} ifelse
} ifelse
}ifelse
+ }ifelse
} bind executeonly def
/dopdfpages { % firstpage# lastpage# dopdfpages -
- << /PDFScanRules //true >> setuserparams % set scanning rules for PDF vs. PS
+ /NEWPDF where {/NEWPDF get} {//true} ifelse
+ {
+ newpdf_dopdfpages
+ }
+ {
+ << /PDFScanRules //true >> setuserparams % set scanning rules for PDF vs. PS
<< /RenderTTNotdef systemdict
- /RENDERTTNOTDEF get >> setuserparams % Should we render TT /.notdef
+ /RENDERTTNOTDEF get >> setuserparams % Should we render TT /.notdef
1 exch
{
%% If we have a array of pages to render, use it.
@@ -554,10 +1409,16 @@ currentdict /runpdfstring .undef
% Indicate that the number of spot colors is unknown in case the next page
% imaged is a PS file.
currentpagedevice /PageSpotColors known { << /PageSpotColors -1 >> setpagedevice } if
- << /PDFScanRules //null >> setuserparams % restore scanning rules for PS
+ << /PDFScanRules //null >> setuserparams % restore scanning rules for PS
+ } ifelse
} bind executeonly def
/runpdfend {
+ /NEWPDF where {/NEWPDF get} {//true} ifelse
+ {
+ newpdf_runpdfend
+ }
+ {
RepairedAnError
{
printrepairederror
@@ -565,13 +1426,14 @@ currentdict /runpdfstring .undef
Repaired { printrepaired } if
} ifelse
currentdict pdfclose
- end % temporary dict
- end % pdfdict
- end % GS_PDF_ProcSet
+ end % temporary dict
+ end % pdfdict
+ end % GS_PDF_ProcSet
PDFTopSave restore
- end % userdict
- 2 vmreclaim % couldn't hurt
+ end % userdict
+ 2 vmreclaim % couldn't hurt
//EnablePageHandlerDevice exec
+ } ifelse
} bind executeonly def
currentdict /DisablePageHandlerDevice undef
@@ -657,59 +1519,62 @@ currentdict /EnablePageHandlerDevice undef
} if
} bind executeonly def
-/runpdf { % <file> runpdf -
- %% Get the PDF filename (it *must* be a file even if it came from stdin it gets
- %% copied to a temporary file) and store it in pdfdict. We will use this for
- %% hashing fonts to detect if fonts with the same name are from different files.
- %%
- dup currentglobal exch //true setglobal .getfilename exch setglobal /InputPDFFileName exch //pdfdict 3 1 roll .forceput
-
- //runpdfbegin exec
- //pdf_collection_files exec
- dup mark eq {
- pop
- process_trailer_attrs
- //runpdfpagerange exec
- //dopdfpages exec
- //runpdfend exec
- } {
- //runpdfend exec
- ]
- (1 ) 10 string copy exch
- {
- dup type /filetype eq {
- //runpdfbegin exec
- dup /PortfolioPage exch def
- process_trailer_attrs
- //runpdfpagerange exec
- //dopdfpages exec
- //runpdfend exec
- closefile
- } {
- .namestring dup (r) file
- //runpdfbegin exec
- /PortfolioPage 2 index def
- process_trailer_attrs
- //runpdfpagerange exec
- //dopdfpages exec
- //runpdfend exec
- deletefile
- } ifelse
- } forall
- pop
+/runpdf { % <file> runpdf -
+ /NEWPDF where {/NEWPDF get} {//true} ifelse
+ {newpdf_runpdf}
+ {
+ %% Get the PDF filename (it *must* be a file even if it came from stdin it gets
+ %% copied to a temporary file) and store it in pdfdict. We will use this for
+ %% hashing fonts to detect if fonts with the same name are from different files.
+ %%
+ dup currentglobal exch //true setglobal .getfilename exch setglobal /InputPDFFileName exch //pdfdict 3 1 roll .forceput
+ //runpdfbegin exec
+ //pdf_collection_files exec
+ dup mark eq {
+ pop
+ process_trailer_attrs
+ //runpdfpagerange exec
+ //dopdfpages exec
+ //runpdfend exec
+ } {
+ //runpdfend exec
+ ]
+ (1 ) 10 string copy exch
+ {
+ dup type /filetype eq {
+ //runpdfbegin exec
+ dup /PortfolioPage exch def
+ process_trailer_attrs
+ //runpdfpagerange exec
+ //dopdfpages exec
+ //runpdfend exec
+ closefile
+ } {
+ .namestring dup (r) file
+ //runpdfbegin exec
+ /PortfolioPage 2 index def
+ process_trailer_attrs
+ //runpdfpagerange exec
+ //dopdfpages exec
+ //runpdfend exec
+ deletefile
+ } ifelse
+ } forall
+ pop
+ } ifelse
} ifelse
} bind executeonly odef
currentdict /pdf_collection_files .undef
-end % systemdict
+end % systemdict
% Redefine the procedure that the C code uses for running piped input.
% It is OK to use { (%stdin) run } here, because a startjob cannot occur.
/.runstdin {
{ (%stdin) run } execute0
} bind executeonly def
-end % userdict
+end % userdict
pdfdict begin
% ======================== File parsing ======================== %
@@ -731,11 +1596,11 @@ pdfdict begin
/dictlevelcount dictlevelcount 1 sub def
dictlevelcount 0 eq { exit } if
} bind executeonly
- ([) cvn { mark } bind executeonly % ditto
+ ([) cvn { mark } bind executeonly % ditto
(]) cvn dup load
-% /true true % see .pdfexectoken in pdf_base.ps
-% /false false % ibid.
-% /null null % ibid.
+% /true true % see .pdfexectoken in pdf_base.ps
+% /false false % ibid.
+% /null null % ibid.
/R {
1 index type /integertype eq 1 index type /integertype eq and {
/resolveR cvx 3 packedarray cvx
@@ -743,7 +1608,7 @@ pdfdict begin
( **** Error: indirect object reference \(R\) encountered with invalid arguments.) pdfformaterror
( Output may be incorrect.\n) pdfformaterror
} ifelse
- } bind executeonly % see Objects below
+ } bind executeonly % see Objects below
.dicttomark readonly def
% After reading entry count: skip whitespace, exit on a digit
@@ -783,9 +1648,9 @@ pdfdict begin
% Read original version (pre PDF 1.5) of the xref table.
% Note: The position is the location of 'xref'. The current PDFfile
% position is just after the 'XREF'.
-/readorigxref % <pos> readorigxref <trailerdict>
+/readorigxref % <pos> readorigxref <trailerdict>
{
- pop % We do not need the position.
+ pop % We do not need the position.
% First we search this (and any Previous) trailers, looking for
% the /Size of the xref. We use ths to initialise our storage
@@ -825,9 +1690,9 @@ pdfdict begin
% Initialise the objects with the detected Size.
TrailerSize growPDFobjects
PDFfile exch setfileposition
- 0 % Initialize xref table error counter
+ 0 % Initialize xref table error counter
//false % Have we seen at least one section entry in this xref ? Bug #694342
- { PDFfile token pop % first object # or trailer
+ { PDFfile token pop % first object # or trailer
dup /trailer eq {
%% check to see if we have seen at least an empty section for this xref
pop {exit}
@@ -841,7 +1706,7 @@ pdfdict begin
%% remove the boolean telling us if we have a section or not, leaving the first object number
exch pop
} ifelse
- PDFfile token pop % entry count
+ PDFfile token pop % entry count
% remaining must be whitespace only (otherwise this xref Size was invalid.
{ PDFfile (0) .peekstring not { pop exit } if
@@ -864,7 +1729,7 @@ pdfdict begin
PDFSTOPONERROR not {
(**** Warning: Discovered more entries in xref than declared in trailer /Size\n) pdfformatwarning
} {
- /readorigxref cvx /rangecheckerror signalerror
+ /readorigxref cvx /rangecheck signalerror
} ifelse
} if
% We now know that the /Size was wrong. We could read the whole table
@@ -875,13 +1740,13 @@ pdfdict begin
1 index 65534 add dup /TrailerSize exch def
growPDFobjects
} if
- { % stack: <err count> <obj num>
+ { % stack: <err count> <obj num>
% Read xref line
PDFfile 20 string readstring pop % always read 20 chars.
- token pop % object position
- exch token pop % generation #
- exch token pop % n or f
- exch % stack: <err count> <obj#> <loc> <gen#> <tag> <remainder of line>
+ token pop % object position
+ exch token pop % generation #
+ exch token pop % n or f
+ exch % stack: <err count> <obj#> <loc> <gen#> <tag> <remainder of line>
% check to make sure trailing garbage is just white space
//false 1 index { 32 gt or } forall {
6 -1 roll 1 add 6 1 roll % bump error count on garbage
@@ -895,20 +1760,20 @@ pdfdict begin
length
PDFfile fileposition exch sub PDFfile exch setfileposition
} if
- pop % Stack: <err count> <obj#> <loc> <gen#> <tag>
- dup /n eq { % xref line tag is /n
- pop % pop dup of line tag
+ pop % Stack: <err count> <obj#> <loc> <gen#> <tag>
+ dup /n eq { % xref line tag is /n
+ pop % pop dup of line tag
1 index 0 eq {
( **** Warning: considering '0000000000 XXXXX n' as a free entry.\n)
pdfformatwarning
} {
- 0 3 1 roll % Set ObjectStream object number = 0
- //false setxrefentry % Save xref entry, don't change existing entries
- 3 -1 roll pop % Remove ObjectStream object onumber
+ 0 3 1 roll % Set ObjectStream object number = 0
+ //false setxrefentry % Save xref entry, don't change existing entries
+ 3 -1 roll pop % Remove ObjectStream object onumber
} ifelse
}
- { % xref line tag was not /n
- /f ne % verify that the tag was /f
+ { % xref line tag was not /n
+ /f ne % verify that the tag was /f
{ /setxrefentry cvx /syntaxerror signalerror
} {
% Bug #703214 has a invalid initial xref table. The table entries are correct
@@ -930,11 +1795,11 @@ pdfdict begin
}if
}ifelse
} ifelse
- pop pop % pop <obj location> and <gen num>
+ pop pop % pop <obj location> and <gen num>
% stack: <err count> <obj num>
- 1 add % increment object number
+ 1 add % increment object number
} repeat
- pop % pop <obj #>
+ pop % pop <obj #>
//true % We have seen at least one entry in an xref section Bug #694342
} loop
0 ne {
@@ -952,60 +1817,60 @@ currentdict /xref-char-dict undef
(<<) cvn { /dictlevelcount dictlevelcount 1 add def mark } bind executeonly
(>>) cvn { .dicttomark /dictlevelcount dictlevelcount 1 sub def
dictlevelcount 0 eq { exit} if } bind executeonly
- ([) cvn { mark } bind executeonly % ditto
+ ([) cvn { mark } bind executeonly % ditto
(]) cvn dup load
-% /true true % see .pdfexectoken in pdf_base.ps
-% /false false % ibid.
-% /null null % ibid.
- /R { /resolveR cvx 3 packedarray cvx } bind executeonly % see Objects below
+% /true true % see .pdfexectoken in pdf_base.ps
+% /false false % ibid.
+% /null null % ibid.
+ /R { /resolveR cvx 3 packedarray cvx } bind executeonly % see Objects below
.dicttomark readonly def
% Get a variable length positive integer value from a stream. A value
% of zero is returned if the count is zero.
-/getintn { % <stream> <count> getintn int
+/getintn { % <stream> <count> getintn int
0 exch { 256 mul 1 index read pop add } repeat
- exch pop % Discard stream
+ exch pop % Discard stream
} bind executeonly def
% This array contains handlers for processing the different types of
% entries in the XRef stream.
% Stack: <Xrefdict> <xref stream> <Index array> <pair loc> <obj num>
-% <field 2> <field 3>
+% <field 2> <field 3>
% The handlers leave the stack unchanged.
/xref15entryhandlers [
- { % XRef entry type 0 - free or f type xref entry
+ { % XRef entry type 0 - free or f type xref entry
% (free ) print
% (obj num: ) print 2 index pdfstring cvs print ( ) print
% (loc: ) print 1 index pdfstring cvs print ( ) print
% (gen: ) print dup === flush
- } bind executeonly % Do nothing for free xref entries
+ } bind executeonly % Do nothing for free xref entries
% XRef entry type 1 - normal or n type xref entry
- { % field 2 = obj loc, field 3 = gen num
+ { % field 2 = obj loc, field 3 = gen num
% (normal ) print
% (obj num: ) print 2 index pdfstring cvs print ( ) print
% (loc: ) print 1 index pdfstring cvs print ( ) print
% (gen: ) print dup === flush
- 0 3 1 roll % set stream number = 0
+ 0 3 1 roll % set stream number = 0
//false setxrefentry
- 3 -1 roll pop % remove stream number
+ 3 -1 roll pop % remove stream number
} bind executeonly
% XRef entry type 2 - compressed object type xref entry
- { % field 2 = object stream num, field 3 = index into object stream
+ { % field 2 = object stream num, field 3 = index into object stream
% (Compressed objects: ) print
% (obj num: ) print 2 index pdfstring cvs print ( ) print
% (field 2: ) print 1 index pdfstring cvs print ( ) print
% (field 3: ) print dup === flush
- 0 //false setxrefentry pop % set generation number = 0
+ 0 //false setxrefentry pop % set generation number = 0
} bind executeonly
] def
% Read the PDF 1.5 version of the xref table.
% Note: The position is the location of the start of the dictionary object
% In PDF 1.5, the XRef dictionary also serves as the trailer dictionary
-/readpdf15xref % <pos> readpdf15xref <trailerdict>
+/readpdf15xref % <pos> readpdf15xref <trailerdict>
{
/Classic-xref //false store
- PDFfile exch setfileposition % move to start of object
+ PDFfile exch setfileposition % move to start of object
% Get object number, revision, and 'obj' and discard
//false PDFfile token {
type /integertype eq {
@@ -1043,47 +1908,47 @@ currentdict /xref-char-dict undef
} if
growPDFobjects
% Create a stream for the XRef data
- PDFfile token pop pop % Skip over 'stream'
+ PDFfile token pop pop % Skip over 'stream'
dup stream //false resolvestream
% Stack: <XRefdict> <xref stream>
% The Index array defines the ranges of object numbers in the
% XRef stream. Each value pair is consists of starting object
% number and the count of consecutive objects.
% Get the Index array, if present
- 1 index /Index .knownget not { % If no Index array ...
- [ 0 3 index /Size get ] % Default = [ 0 Size ]
+ 1 index /Index .knownget not { % If no Index array ...
+ [ 0 3 index /Size get ] % Default = [ 0 Size ]
} if
% Loop through the Index array
0 2 2 index length 1 sub {
% Get start and end of object range
- 2 copy get % Start of the range
- dup 3 index 3 index 1 add get % Number of entries in range
+ 2 copy get % Start of the range
+ dup 3 index 3 index 1 add get % Number of entries in range
% Loop through the range of object numbers
- add 1 sub 1 exch { % Form end of range, set increment = 1
+ add 1 sub 1 exch { % Form end of range, set increment = 1
% Stack: <Xrefdict> <xref stream> <Index array> <pair loc> <obj num>
% Get xref parameters. Note: The number of bytes for each parameter
% is defined by the entries in the W array.
- 4 index /W get aload pop % Get W array values
+ 4 index /W get aload pop % Get W array values
% The first field indicates type of entry. Get first field value.
% If the num. of bytes for field 1 is 0 then default field value is 1
3 -1 roll dup 0 eq { pop 1 } { 6 index exch getintn } ifelse
% Get the handler for the xref entry type. We will execute the
% handler after we get the other two field values.
xref15entryhandlers exch get
- 3 -1 roll 6 index exch getintn % Get second field
- 3 -1 roll 6 index exch getintn % Get third field
- 3 -1 roll exec % Execute Xref entry handler
- pop pop pop % Remove field values and obj num
- } for % Loop through Xref entries
- pop % Remove Index array pair loc
- } for % Loop through Index array entries
- pop pop % Remove Index array and xref stream
+ 3 -1 roll 6 index exch getintn % Get second field
+ 3 -1 roll 6 index exch getintn % Get third field
+ 3 -1 roll exec % Execute Xref entry handler
+ pop pop pop % Remove field values and obj num
+ } for % Loop through Xref entries
+ pop % Remove Index array pair loc
+ } for % Loop through Index array entries
+ pop pop % Remove Index array and xref stream
} bind executeonly def
% Read the cross-reference table.
% <pos> is the position either from the startxref statement or the /Prev
% entry in the prior trailer dictionary.
-/readxref % <pos> readxref <trailerdict>
+/readxref % <pos> readxref <trailerdict>
{
PDFoffset add PDFfile exch
% Check that the given location is within the file.
@@ -1098,7 +1963,7 @@ currentdict /xref-char-dict undef
{
PDFfile fileposition PDFfile read pop 32 gt { exit } if pop
} loop
- dup % Make copy of the file position (before last char was read).
+ dup % Make copy of the file position (before last char was read).
PDFfile exch setfileposition
% The PDF specification says that the 'xref' must be on a line
% by itself. The code here formerly used readline and linene to
@@ -1108,7 +1973,7 @@ currentdict /xref-char-dict undef
PDFfile pdfstring 0 4 getinterval readstring pop
(xref) eq
{
- readorigxref % 'xref' -> original xref table
+ readorigxref % 'xref' -> original xref table
% if hybrid-reference PDF, also fetch the entries
% found in the XRef stream pointed by /XRefStm
dup /XRefStm knownoget {
@@ -1130,12 +1995,17 @@ currentdict /xref-char-dict undef
}ifelse
} if
}
- { readpdf15xref } % otherwise assume PDF 1.5 xref stream
+ { readpdf15xref } % otherwise assume PDF 1.5 xref stream
ifelse
} bind executeonly def
% Open a PDF file and read the header, trailer, and cross-reference.
-/pdfopen { % <file> pdfopen <dict>
+/pdfopen { % <file> pdfopen <dict>
+ /NEWPDF where {/NEWPDF get} {//true} ifelse
+ {
+ newpdf_pdfopen
+ }
+ {
% Color space substitution in PDF is handled somewhat differently
% than in PostScript. A given device color space will be substituted
% if the corresponding "Default..." entry exists in the Page's
@@ -1151,17 +2021,18 @@ currentdict /xref-char-dict undef
% respectively. This is not done if UseCIEColor is true by default,
% as in that case color substitution is presumably desired even
% if the file does not request it.
- currentpagedevice /UseCIEColor .knownget dup { pop } if not
+ currentpagedevice /UseCIEColor .knownget dup { pop } if not
{ .currentglobal //false .setglobal
/DefaultGray { /DeviceGray } cvlit /ColorSpace defineresource pop
/DefaultRGB { /DeviceRGB } cvlit /ColorSpace defineresource pop
/DefaultCMYK { /DeviceCMYK } cvlit /ColorSpace defineresource pop
.setglobal
}
- if
- pdfopenfile begin
- pdfopencache
- currentdict end
+ if
+ pdfopenfile begin
+ pdfopencache
+ currentdict end
+ } ifelse
} bind executeonly def
/process_trailer_attrs { % - process_trailer_attrs -
@@ -1396,38 +2267,38 @@ currentdict /xref-char-dict undef
% Verify that each entry in the xref table is pointing at an object with
% the correct object number and generation number.
-/verify_xref % - verify_xref -
+/verify_xref % - verify_xref -
{ PDFfilelen
- 1 1 Objects length 1 sub % stack: filesize 1 1 <number of objects - 1>
- { % Check if the object is free (i.e. not used). The values in
+ 1 1 Objects length 1 sub % stack: filesize 1 1 <number of objects - 1>
+ { % Check if the object is free (i.e. not used). The values in
% Generations is the generation number plus 1. If the value in
% Generations is zero then the object is free.
% Stack: <filesize> <obj num>
- Generations 1 index get % Get the genration number
- 0 ne { % Skip if object number is free
- ObjectStream 1 index get % Check if object is in objectstream
- 0 eq { % We only check objects not in an objectstream
- { % Use stop context since we may get an error if object is invalid
- dup Objects exch get % Get the object location
- PDFoffset add dup 3 index ge % Compare object location to file size
- { pop //true } % Rebuild if location not in file
+ Generations 1 index get % Get the genration number
+ 0 ne { % Skip if object number is free
+ ObjectStream 1 index get % Check if object is in objectstream
+ 0 eq { % We only check objects not in an objectstream
+ { % Use stop context since we may get an error if object is invalid
+ dup Objects exch get % Get the object location
+ PDFoffset add dup 3 index ge % Compare object location to file size
+ { pop //true } % Rebuild if location not in file
{ PDFfile exch setfileposition % Go to the object location
- //true % Stack: <filesize> <obj num> <true>
- PDFfile token pop % Read object number from file
- 2 index eq { % Verify object number
- PDFfile token pop % Read generation number from file
- Generations 3 index % Get specified generaton number
- get 1 sub % Gen numbs are stored with 1 added.
- eq { % Verify generation number
+ //true % Stack: <filesize> <obj num> <true>
+ PDFfile token pop % Read object number from file
+ 2 index eq { % Verify object number
+ PDFfile token pop % Read generation number from file
+ Generations 3 index % Get specified generaton number
+ get 1 sub % Gen numbs are stored with 1 added.
+ eq { % Verify generation number
PDFfile token pop
/obj eq { % Verify 'obj' text
- pop //false % We have valid object, do not rebuild
+ pop //false % We have valid object, do not rebuild
} if
} if
} if
} ifelse
} //.internalstopped exec
- { //true } if % If we stop then we need to rebuild
+ { //true } if % If we stop then we need to rebuild
% Stack: <filesize> <obj num> <need rebuild flag>
{
( **** Warning: File has an invalid xref entry: )
@@ -1436,31 +2307,31 @@ currentdict /xref-char-dict undef
(. Rebuilding xref table.\n) pdfformatwarning
search_objects
exit
- } if % If the entry is invalid
+ } if % If the entry is invalid
} {
% The object is in an object stream. We currently do not rebuild
% objects in an object stream. So If we find one, then abort the
% verification of the xref table entries.
- pop exit % Pop object number and then exit loop
- } ifelse % If not in an object stream
- } if % If object entry is not free
- pop % Remove object number
+ pop exit % Pop object number and then exit loop
+ } ifelse % If not in an object stream
+ } if % If object entry is not free
+ pop % Remove object number
} for
- pop % Remove the size of the file
+ pop % Remove the size of the file
} bind odef
-/pdfopencache { % - pdfopencache -
+/pdfopencache { % - pdfopencache -
% Create and initialize some caches.
/PageCount pdfpagecount def
/PageNumbers PageCount 65534 .min dict def
/PageIndex PageCount 65534 .min array def
} bind executeonly def
-/pdfopenfile { % <file> pdfopenfile <dict>
- //pdfdict readonly pop % can't do it any earlier than this
+/pdfopenfile { % <file> pdfopenfile <dict>
+ //pdfdict readonly pop % can't do it any earlier than this
32 dict begin
/LocalResources 0 dict def
- /DefaultQstate //null def % establish binding
+ /DefaultQstate //null def % establish binding
/Printed where { pop } {
% Guess whether the output device is a printer.
/Printed currentpagedevice /OutputFile known def
@@ -1497,11 +2368,11 @@ currentdict /xref-char-dict undef
% some badly formed PDF's (Visioneer) have something other than EOL
% after the version number. If we get an error, shorten the string
% and try again.
- //false exch % error encountered
+ //false exch % error encountered
{ { cvr } stopped
{ exch pop //true exch 0 1 index length 1 sub dup 0 eq
- { pop 0 exit } if % exit if string now empty
- getinterval % trim character from right end and retry
+ { pop 0 exit } if % exit if string now empty
+ getinterval % trim character from right end and retry
}
{ exch {
( **** Warning: PDF version number not followed by EOL.\n)
@@ -1516,12 +2387,12 @@ currentdict /xref-char-dict undef
/PDFversion exch def
% Read the last cross-reference table.
count /pdfemptycount exch def
- /Trailer << >> def % Initialize to an emptry dict.
+ /Trailer << >> def % Initialize to an emptry dict.
{initPDFobjects findxref readxref}
PDFSTOPONERROR not {
//.internalstopped exec {
- recover_xref_data % Read failed. Attempt to recover xref data.
- search_trailer % Search for the primary trailer
+ recover_xref_data % Read failed. Attempt to recover xref data.
+ search_trailer % Search for the primary trailer
//false % search_trailer sets up /Trailer, so don't run the code to do that...
} {
//true
@@ -1531,14 +2402,14 @@ currentdict /xref-char-dict undef
} ifelse
{
- /Trailer exch def % Save trailer dict after first xref table
+ /Trailer exch def % Save trailer dict after first xref table
% Read any previous cross-reference tables. When we are done,
% verify that the entries in the xref tables are valid if NoVerifyXref
% is not defined.
/PrevArray [] def % Empty array, we use this to detect circular /Prev entries in xref (see below)
% For some reqason, leaving this on the stack messes up seom files.
Trailer
- { /Prev knownoget not { % If no previous xref table then ...
+ { /Prev knownoget not { % If no previous xref table then ...
Classic-xref {
/NoVerifyXref where { pop } { verify_xref } ifelse
} if
@@ -1563,7 +2434,7 @@ currentdict /xref-char-dict undef
(\n **** Error: Circular /Prev entry while reading xref.\n Aborting xref read, output may be incorrect.\n)
pdfformaterror
PDFSTOPONERROR {
- /readxref /syntaxerror cvx signalerror
+ /readxref cvx /syntaxerror signalerror
} if
pop exit %% [...] and then exit this loop
} if
@@ -1579,10 +2450,10 @@ currentdict /xref-char-dict undef
{ readxref }
PDFSTOPONERROR not {
//.internalstopped exec {
- recover_xref_data % Read failed. Attempt to recover xref data.
+ recover_xref_data % Read failed. Attempt to recover xref data.
/PrevArray where {/PrevArray undef} if %% remove the array we were using to detect circular references
- exit % Exit loop since recover gets all obj data.
- } if % If readxref stopped
+ exit % Exit loop since recover gets all obj data.
+ } if % If readxref stopped
} {
exec
} ifelse
@@ -1598,7 +2469,7 @@ currentdict /xref-char-dict undef
Trailer 3 1 roll put % add key if not present
} ifelse
} forall
- } loop % Loop to previous trailer
+ } loop % Loop to previous trailer
/PrevArray where {/PrevArray undef} if %% remove the array we were using to detect circular references
} if
@@ -1609,7 +2480,7 @@ currentdict /xref-char-dict undef
<< /PDFScanUnsigned //true >> setuserparams
{ Trailer /Encrypt knownoget {
pop
- pdf_process_Encrypt % signal error
+ pdf_process_Encrypt % signal error
} if
} stopped
<< /PDFScanUnsigned //false >> setuserparams
@@ -1668,7 +2539,7 @@ currentdict /xref-char-dict undef
% appended to the PDF file. Current record (60K) belongs to
% PDF-Out (v 2.0 - 35). We start the search from the last 1024
% bytes and continue from the beginning of the file.
-/findxref { % - findxref <xrefpos>
+/findxref { % - findxref <xrefpos>
PDFfile dup dup dup 0 setfileposition bytesavailable
dup /PDFfilelen exch def
% Find the last %%EOF string (within 1024 bytes)
@@ -1704,13 +2575,13 @@ currentdict /xref-char-dict undef
//stdoutfile dup 3 -1 roll writestring flushfile
} bind executeonly def
-/pdfformaterror { % <string> pdfformaterror -
+/pdfformaterror { % <string> pdfformaterror -
stdoutprint
/Repaired //true store
/RepairedAnError //true store
} bind executeonly def
-/pdfformatwarning { % <string> pdfformaterror -
+/pdfformatwarning { % <string> pdfformaterror -
QUIET not {stdoutprint}{pop}ifelse
/Repaired //true store
PDFSTOPONWARNING {/warning cvx /undefined signalerror} if
@@ -1789,7 +2660,7 @@ currentdict /xref-char-dict undef
% Write the outline structure for a file. Uses linkdest (below).
% omit links to pages that don't exist.
-/writeoutline % <outlinedict> writeoutline -
+/writeoutline % <outlinedict> writeoutline -
{ mark
0 2 index /First knownoget
{ { exch 1 add exch /Next knownoget not { exit } if } loop }
@@ -1850,7 +2721,7 @@ currentdict /xref-char-dict undef
linkdest
} stopped
{
- cleartomark % ignore this link
+ cleartomark % ignore this link
( **** Warning: Outline has invalid link that was discarded.\n)
pdfformatwarning
} {
@@ -1869,7 +2740,7 @@ currentdict /xref-char-dict undef
} bind executeonly def
% Close a PDF file.
-/pdfclose % <dict> pdfclose -
+/pdfclose % <dict> pdfclose -
{ begin
PDFfile closefile
end
@@ -1878,7 +2749,7 @@ currentdict /xref-char-dict undef
% ======================== Page accessing ======================== %
% Get a (possibly inherited) attribute of a page.
-/pget % <pagedict> <key> pget <value> -true-
+/pget % <pagedict> <key> pget <value> -true-
% <pagedict> <key> pget -false-
{
2 copy knownoget
@@ -1928,10 +2799,10 @@ currentdict /xref-char-dict undef
4 index .knownget {
0 get 5 1 roll pop pop pop pop
} {
- parent_obj_get % not found -- check it's parent.
+ parent_obj_get % not found -- check it's parent.
} ifelse
} {
- parent_obj_get % not found -- check it's parent.
+ parent_obj_get % not found -- check it's parent.
} ifelse
} {
pop pop 0
@@ -1956,7 +2827,7 @@ currentdict /xref-char-dict undef
0 get 4 1 roll pop pop pop
}{
% Not in Page Resources, recursively try ParentResources as a last resort
- pop % page Resources
+ pop % page Resources
LocalResources parent_obj_get
}ifelse
}{
@@ -1971,7 +2842,7 @@ currentdict /xref-char-dict undef
}bind executeonly def
% Get the value of a resource on a given page.
-/rget { % <resname> <pagedict> <restype> rget <value> -true-
+/rget { % <resname> <pagedict> <restype> rget <value> -true-
% <resname> <pagedict> <restype> rget -false-
LocalResources 1 index knownoget {
3 index knownoget
@@ -2007,7 +2878,7 @@ currentdict /xref-char-dict undef
} bind executeonly def
% Get the total number of pages in the document.
-/pdfpagecount % - pdfpagecount <int>
+/pdfpagecount % - pdfpagecount <int>
{
Trailer /Root knownoget {
/Pages knownoget {
@@ -2023,7 +2894,7 @@ currentdict /xref-char-dict undef
exch pop
//null eq { exit } { pop } ifelse
} for
- 1 sub % decrement to last page that we were able to find
+ 1 sub % decrement to last page that we were able to find
2 copy /Count exch put
} {
0 % return 0 and keep 0 page count.
@@ -2104,11 +2975,11 @@ currentdict /xref-char-dict undef
} if
} bind executeonly def
-/pdffindpage? { % <int> pdffindpage? 1 null (page not found)
+/pdffindpage? { % <int> pdffindpage? 1 null (page not found)
% <int> pdffindpage? 1 noderef (page found)
- % <int> pdffindpage? 0 null (Error: page not found)
+ % <int> pdffindpage? 0 null (Error: page not found)
Trailer /Root oget /Pages get
- { % We should be able to tell when we reach a leaf
+ { % We should be able to tell when we reach a leaf
% by finding a Type unequal to /Pages. Unfortunately,
% some files distributed by Adobe lack the Type key
% in some of the Pages nodes! Instead, we check for Kids.
@@ -2138,7 +3009,7 @@ currentdict /xref-char-dict undef
% Find the N'th page of the document by iterating through the Pages tree.
% The first page is numbered 1.
-/pdffindpageref { % <int> pdffindpage <objref>
+/pdffindpageref { % <int> pdffindpage <objref>
dup pdffindpage?
% Stack: index countleft noderef
dup //null ne {
@@ -2147,21 +3018,21 @@ currentdict /xref-char-dict undef
PageIndex 2 index 1 sub 65533 .min 2 index oforce put
PageNumbers 1 index oforce 3 index dup 65534 le
{ put }
- { pop pop pop } % don't store more than 65534 pagenumbers
+ { pop pop pop } % don't store more than 65534 pagenumbers
ifelse
} {
- exch pop % return the //null
+ exch pop % return the //null
}
ifelse
- exch pop % pop the page number, return the object or null
+ exch pop % pop the page number, return the object or null
} bind executeonly def
-/pdffindpage { % <int> pdffindpage <pagedict>
+/pdffindpage { % <int> pdffindpage <pagedict>
pdffindpageref oforce
} bind executeonly def
% Find the N'th page of the document.
% The first page is numbered 1.
-/pdfgetpage % <int> pdfgetpage <pagedict>
+/pdfgetpage % <int> pdfgetpage <pagedict>
{ PageIndex 1 index 1 sub dup 65533 lt
{ get }
{ pop pop //null }
@@ -2173,12 +3044,12 @@ currentdict /xref-char-dict undef
} bind executeonly def
% Find the page number of a page object (inverse of pdfgetpage).
-/pdfpagenumber % <pagedict> pdfpagenumber <int>
- { % We use the simplest and stupidest of all possible algorithms....
+/pdfpagenumber % <pagedict> pdfpagenumber <int>
+ { % We use the simplest and stupidest of all possible algorithms....
PageNumbers 1 index .knownget
{ exch pop
}
- { 1 1 PageCount 1 add % will give a rangecheck if not found
+ { 1 1 PageCount 1 add % will give a rangecheck if not found
{ dup pdfgetpage oforce 2 index eq { exit } if pop
}
for exch pop
@@ -2198,15 +3069,15 @@ currentdict /xref-char-dict undef
} if
4 1 roll
} repeat
- exch 4 1 roll % <x2> <x1> <y1> <y2>
- 2 copy gt { exch } if % <x2> <x1> <lly> <ury>
- 4 2 roll 2 copy lt { exch } if % <lly> <ury> <urx> <llx>
- 4 1 roll exch % <llx> <lly> <urx> <ury>
+ exch 4 1 roll % <x2> <x1> <y1> <y2>
+ 2 copy gt { exch } if % <x2> <x1> <lly> <ury>
+ 4 2 roll 2 copy lt { exch } if % <lly> <ury> <urx> <llx>
+ 4 1 roll exch % <llx> <lly> <urx> <ury>
} bind executeonly def
% Arrange a rectangle into a 'normal' order. I.e the lower left corner
% followed by the upper right corner.
-/normrect % <rect> normrect <rect>
+/normrect % <rect> normrect <rect>
{
aload pop normrect_elems 4 array astore
} bind executeonly def
@@ -2223,10 +3094,10 @@ currentdict /xref-char-dict undef
} ifelse
} bind executeonly def
-/boxrect % <llx> <lly> <urx> <ury> boxrect <x> <y> <w> <h>
+/boxrect % <llx> <lly> <urx> <ury> boxrect <x> <y> <w> <h>
{ exch 3 index sub exch 2 index sub
} bind executeonly def
-/resolvedest { % <name|string|other> resolvedest <other|null>
+/resolvedest { % <name|string|other> resolvedest <other|null>
dup type /nametype eq {
Trailer /Root oget /Dests knownoget {
exch knownoget not { //null } if
@@ -2298,9 +3169,9 @@ currentdict /xref-char-dict undef
} ifelse
} ifelse
3 1 roll
- 2 copy 7 -1 roll 1 and 0 ne { exch } if 4 2 roll % odd rotation switches x<->y
- 2 { dup //null eq { pop 0 } if exch } repeat % replace nulls with 0
- 7 -1 roll transform % transform coordinates
+ 2 copy 7 -1 roll 1 and 0 ne { exch } if 4 2 roll % odd rotation switches x<->y
+ 2 { dup //null eq { pop 0 } if exch } repeat % replace nulls with 0
+ 7 -1 roll transform % transform coordinates
2 { 3 -1 roll //null eq { pop //null } if exch } repeat % put the nulls back
3 -1 roll
4 array astore
@@ -2314,7 +3185,7 @@ currentdict /xref-char-dict undef
} bind executeonly def
end readonly def
-/linkdest { % <link|outline> linkdest
+/linkdest { % <link|outline> linkdest
% ([/Page <n>] /View <view> | ) <link|outline>
dup /NewWindow knownoget {
/NewWindow exch 3 -1 roll
@@ -2341,11 +3212,11 @@ end readonly def
} if
} if
} if
- % stack: <link|outline> <dest> ( <PDF2PS_matrix> <rot> <page#> true | <page> false )
+ % stack: <link|outline> <dest> ( <PDF2PS_matrix> <rot> <page#> true | <page> false )
{
- /Page exch 6 2 roll
+ /Page exch 6 2 roll
% stack: [/Page <page#>] <link|outline> <dest> <PDF2PS_matrix> <rot>
- 3 -1 roll dup length 1 sub 1 exch getinterval /View 4 1 roll
+ 3 -1 roll dup length 1 sub 1 exch getinterval /View 4 1 roll
% stack: [/Page <page#>] <link|outline> /View <PDF2PS_matrix> <rot> <view>
//viewdestprocs 1 index 0 get get exec
3 -1 roll
@@ -2393,17 +3264,17 @@ end readonly def
% **** and some Artifex customers rely on the pdfshowpage_init,
% **** pdfshowpage_setpage, pdfshowpage_finish so all logic should be
% **** implemented in one of those three procedures.
-/pdfshowpage % <pagedict> pdfshowpage -
+/pdfshowpage % <pagedict> pdfshowpage -
{ dup /Page exch store
pdfshowpage_init % <pagedict>
pdfshowpage_setpage % <pagedict>
pdfshowpage_finish % -
} bind executeonly def
-/pdfpagecontents % <pagedict> pdfpagecontents <contents>
+/pdfpagecontents % <pagedict> pdfpagecontents <contents>
{ } bind executeonly def
-/pdfshowpage_init % <pagedict> pdfshowpage_init <pagedict>
+/pdfshowpage_init % <pagedict> pdfshowpage_init <pagedict>
{ /DSCPageCount DSCPageCount 1 add store
} bind executeonly def
@@ -2522,7 +3393,7 @@ end readonly def
} bind executeonly def
% Compute the matrix that transforms the PDF->PS "default" user space
-/pdf_PDF2PS_matrix { % <pdfpagedict> -- matrix
+/pdf_PDF2PS_matrix { % <pdfpagedict> -- matrix
matrix currentmatrix matrix setmatrix exch
% stack: savedCTM <pdfpagedict>
dup get_any_box
@@ -2533,13 +3404,13 @@ end readonly def
currentpagedevice /.HWMargins get aload pop
currentpagedevice /PageSize get aload pop
% Adjust PageSize and .HWMargins for the page portrait/landscape orientation
- 2 copy gt % PageSize_is_landscape
+ 2 copy gt % PageSize_is_landscape
7 index aload pop 3 -1 roll sub 3 1 roll exch sub exch
10 index /Rotate pget not { 0 } if cvi 90 idiv 1 and 0 ne { exch } if
- gt % Box_is_landscape
- xor % PageSize_is_landscape(or square) xor'ed with Box_is_lanscape suggests rotate
- 2 index 2 index eq not and { % don't rotate if Page is square
- 1 index 0 translate 90 rotate % add in a rotation
+ gt % Box_is_landscape
+ xor % PageSize_is_landscape(or square) xor'ed with Box_is_lanscape suggests rotate
+ 2 index 2 index eq not and { % don't rotate if Page is square
+ 1 index 0 translate 90 rotate % add in a rotation
PDFDEBUG { ( Rotating the page for best fit) = flush } if
2 copy ne {
% rotate the .HWMargins
@@ -2555,7 +3426,7 @@ end readonly def
3 -1 roll sub 3 1 roll exch sub exch
% stack: savedCTM <pdfpagedict> <Crop|Media Box> Xmin Ymin Xmax Ymax
PDFDEBUG { ( Translate up by [ ) print 3 index =print (, ) print 2 index =print ( ]) = flush } if
- 3 index 3 index translate % move origin up to imageable area
+ 3 index 3 index translate % move origin up to imageable area
2 index sub exch 3 index sub exch 4 2 roll pop pop
% stack: savedCTM <pdfpagedict> [Box] XImageable YImageable
2 index aload pop 2 index sub exch 3 index sub exch 4 2 roll pop pop
@@ -2631,13 +3502,13 @@ end readonly def
} bind executeonly def
currentdict /PDF2PS_matrix_key undef
-/.pdfshowpage_Install { % <pagedict> [<prevproc>] .pdfshowpage_Install -
+/.pdfshowpage_Install { % <pagedict> [<prevproc>] .pdfshowpage_Install -
0 get exec
pdf_cached_PDF2PS_matrix concat
} bind executeonly def
-/pdfshowpage_setpage { % <pagedict> pdfshowpage_setpage <pagedict>
- 6 dict begin % for setpagedevice
+/pdfshowpage_setpage { % <pagedict> pdfshowpage_setpage <pagedict>
+ 6 dict begin % for setpagedevice
% Stack: pdfpagedict
% This comment is no longer true, and is maintained here for history only:
%
@@ -2741,7 +3612,7 @@ currentdict /PDF2PS_matrix_key undef
dup type dup /arraytype eq exch /packedarraytype eq or {
dup length 4 eq {
dup 2 get /.pdfshowpage_Install load eq {
- 1 get 0 get % previous procedure
+ 1 get 0 get % previous procedure
} if
} if
} if
@@ -2754,7 +3625,7 @@ currentdict /PDF2PS_matrix_key undef
/Install exch def
% Stack: pagedict currentpagedict
% If the Overprint device flag is not /disable, check usage of OP/op
- /PageUsesOverprint //false def % assume we don't need OP simulation
+ /PageUsesOverprint //false def % assume we don't need OP simulation
dup /Overprint get /disable ne
% If the device suppports SpotColors (DeviceN device) we don't need simulation
1 index /PageSpotColors known
@@ -2769,13 +3640,13 @@ currentdict /PDF2PS_matrix_key undef
% Overprint is /enable, so the device might need the overprint compositor
% if it does not support spot colors, thus check if overprint is used so
% overprint simulation can be done with the pdf14 compositor
- 1 index countspotcolors userdict exch /PageSpotColors exch put % save it in a known place
+ 1 index countspotcolors userdict exch /PageSpotColors exch put % save it in a known place
1 index pageusesoverprint
1 index /ProcessColorModel get /DeviceCMYK eq {
- PageSpotColors 0 gt % count of colorants NOT including CMYK
+ PageSpotColors 0 gt % count of colorants NOT including CMYK
and
} if
- /PageUsesOverprint exch def % the page needs OP simulation so set device param.
+ /PageUsesOverprint exch def % the page needs OP simulation so set device param.
} if
pop currentdict end setpagedevice
} bind executeonly def
@@ -2794,7 +3665,7 @@ currentdict /PDF2PS_matrix_key undef
} if
} bind executeonly def
-/pdfshowpage_finish { % <pagedict> pdfshowpage_finish -
+/pdfshowpage_finish { % <pagedict> pdfshowpage_finish -
save /PDFSave exch store
/PDFdictstackcount countdictstack store
/PDFexecstackcount count 2 sub store
@@ -2820,7 +3691,7 @@ currentdict /PDF2PS_matrix_key undef
pop
} ifelse
} forall
- } if % end .writepdfmarks
+ } if % end .writepdfmarks
% Display the actual page contents.
9 dict begin
@@ -2850,34 +3721,34 @@ currentdict /PDF2PS_matrix_key undef
% If the current device isn't CMYK, or if it is a device that supports transparency
% we don't need the special handling of Overprint transparency, so disable the checking.
- 4 dict begin % working directory to simplify
+ 4 dict begin % working directory to simplify
currentpagedevice dup /Colors get
- /devColors exch def % put into our convenience dict
+ /devColors exch def % put into our convenience dict
dup /HaveTransparency .knownget not { //false } if
- /devSupportsTrans exch def % put into our convenience dict
+ /devSupportsTrans exch def % put into our convenience dict
dup /Overprint get
- /SimOP exch def % put into our convenience dict
+ /SimOP exch def % put into our convenience dict
SimOP /simulate eq
exch /PageUsesOverprint .knownget not { //false } if
- and % both Overprint==/simulate and PageUsesOverprint
+ and % both Overprint==/simulate and PageUsesOverprint
{
% Determine if the device needs the special pdf14 compositor push
- devColors 4 eq PageSpotColors 0 gt and % CMYK device, but device has spot colors
- devColors 4 lt % RGB or Gray device
+ devColors 4 eq PageSpotColors 0 gt and % CMYK device, but device has spot colors
+ devColors 4 lt % RGB or Gray device
or
} {
- //false % Overprint is not /simulate or PageUseOverprint is false
+ //false % Overprint is not /simulate or PageUseOverprint is false
} ifelse
% Determine if the device needs SMask for Overprint
SimOP /simulate eq {
- //true % we will need setupOPrtans for Compatible BM
+ //true % we will need setupOPrtans for Compatible BM
} {
SimOP /enable eq
- devColors 4 ge % CMYK device
+ devColors 4 ge % CMYK device
and
} ifelse
- devSupportsTrans not and % If device supports transparency (e.g. pdfwrite) then no setupOPtrans
- end % pop the convenience dict
+ devSupportsTrans not and % If device supports transparency (e.g. pdfwrite) then no setupOPtrans
+ end % pop the convenience dict
/setup_trans exch
{ /setupOPtrans } { /setupSMtrans } ifelse
load def
@@ -2885,7 +3756,7 @@ currentdict /PDF2PS_matrix_key undef
% Show the page within a PDF 1.4 device filter.
{ -1 } { 0 } ifelse
.pushpdf14devicefilter {
- /DefaultQstate qstate store % device has changed -- reset DefaultQstate
+ /DefaultQstate qstate store % device has changed -- reset DefaultQstate
% If the page has a Group, enclose contents in transparency group.
% (Adobe Tech Note 5407, sec 9.2)
dup /Group knownoget {
@@ -2903,12 +3774,12 @@ currentdict /PDF2PS_matrix_key undef
} stopped {
% abort the transparency device
.abortpdf14devicefilter
- /DefaultQstate qstate store % device has changed -- reset DefaultQstate
+ /DefaultQstate qstate store % device has changed -- reset DefaultQstate
stop
} if
- { } settransfer % identity transfer during popdevice (put_image)
- .poppdf14devicefilter % NB: reset to DefaultQstate will also restore transfer function
- /DefaultQstate qstate store % device has changed -- reset DefaultQstate
+ { } settransfer % identity transfer during popdevice (put_image)
+ .poppdf14devicefilter % NB: reset to DefaultQstate will also restore transfer function
+ /DefaultQstate qstate store % device has changed -- reset DefaultQstate
} {
/setup_trans { pop pop } def % no-op this if the page doesn't use transparency
% NB: original will be restored from PDFsave
@@ -2923,17 +3794,17 @@ currentdict /PDF2PS_matrix_key undef
{
% Show the page within a PDF 1.4 device filter for overprint_simulation.
-1 .pushpdf14devicefilter {
- /DefaultQstate qstate store % device has changed -- reset DefaultQstate
+ /DefaultQstate qstate store % device has changed -- reset DefaultQstate
showpagecontents
} stopped {
% abort the transparency device
.abortpdf14devicefilter
- /DefaultQstate qstate store % device has changed -- reset DefaultQstate
+ /DefaultQstate qstate store % device has changed -- reset DefaultQstate
stop
} if
- { } settransfer % identity transfer during popdevice (put_image)
- .poppdf14devicefilter % NB: reset to DefaultQstate will also restore transfer function
- /DefaultQstate qstate store % device has changed -- reset DefaultQstate
+ { } settransfer % identity transfer during popdevice (put_image)
+ .poppdf14devicefilter % NB: reset to DefaultQstate will also restore transfer function
+ /DefaultQstate qstate store % device has changed -- reset DefaultQstate
} {
showpagecontents
} ifelse
@@ -2942,7 +3813,7 @@ currentdict /PDF2PS_matrix_key undef
% todo: mixing drawing ops outside the device filter could cause
% problems, for example with the pnga device.
endpage
- end % scratch dict
+ end % scratch dict
% Some PDF files don't have matching q/Q (gsave/grestore) so we need
% to clean up any left over dicts from the dictstack
@@ -2977,7 +3848,7 @@ currentdict /PDF2PS_matrix_key undef
pop
count PDFexecstackcount sub { pop } repeat
(after exec) VMDEBUG
- Repaired % pass Repaired state around the restore
+ Repaired % pass Repaired state around the restore
RepairedAnError
PDFSave restore
currentglobal //pdfdict gcheck .setglobal
@@ -2988,8 +3859,8 @@ currentdict /PDF2PS_matrix_key undef
} bind executeonly odef
% Display the contents of a page (including annotations).
-/showpagecontents { % <pagedict> showpagecontents -
- dup % Save the pagedict for the Annotations
+/showpagecontents { % <pagedict> showpagecontents -
+ dup % Save the pagedict for the Annotations
% We do a 'save' here in order to allow us to restore at the end of the page, before
% we run the annotations. There are two reasons for this; firstly so that the graphics state
@@ -3078,9 +3949,9 @@ currentdict /PDF2PS_matrix_key undef
not
and
//systemdict /PreserveAnnots .knownget not {//true} if and {
- mark exch {preserveannot} PDFSTOPONERROR {exec}{stopped {(Error: Ignoring invalid annotation, output may be incorrect.\n) pdfformaterror} if} ifelse cleartomark
+ mark exch {preserveannot} PDFSTOPONERROR {exec}{stopped {(Error: Ignoring invalid annotation, output may be incorrect.\n) pdfformaterror} if} ifelse {cleartomark} stopped pop
}{
- mark exch {drawannot} PDFSTOPONERROR {exec}{stopped {(Error: Ignoring invalid annotation, output may be incorrect.\n) pdfformaterror} if} ifelse cleartomark
+ mark exch {drawannot} PDFSTOPONERROR {exec}{stopped {(Error: Ignoring invalid annotation, output may be incorrect.\n) pdfformaterror} if} ifelse {cleartomark} stopped pop
} ifelse
} {
pop
@@ -3101,7 +3972,7 @@ currentdict /PDF2PS_matrix_key undef
} if
} bind executeonly def
-/processcolorspace { % - processcolorspace <colorspace>
+/processcolorspace { % - processcolorspace <colorspace>
% The following is per the PLRM3.
currentdevice 1 dict dup /ProcessColorModel dup put .getdeviceparams
exch pop exch pop
@@ -3110,7 +3981,7 @@ currentdict /PDF2PS_matrix_key undef
} bind executeonly def
% returns true if OP or op is true in an ExtGState
-/pageusesoverprint { % <pagedict> pageusesoverprint <bool>
+/pageusesoverprint { % <pagedict> pageusesoverprint <bool>
dup //false exch {
4 dict 1 index resourceusesoverprint { pop not exit } if
%% Check the current dictionary and its Parent (if any) to see
@@ -3135,12 +4006,12 @@ currentdict /PDF2PS_matrix_key undef
} bind def
% Check if Overprint (OP/op) is specified in an ExtGState dict
-/extgstateusesoverprint { % <gstate dict> extgstateusesoverprint <bool>
- //false exch % Assume no overprint
+/extgstateusesoverprint { % <gstate dict> extgstateusesoverprint <bool>
+ //false exch % Assume no overprint
dup //null eq {
pop % bug 692050
} {
- { % establish loop context
+ { % establish loop context
dup /OP knownoget { { pop not exit } if } if
dup /op knownoget { { pop not exit } if } if
pop exit
@@ -3149,8 +4020,8 @@ currentdict /PDF2PS_matrix_key undef
} bind def
% Check if overprint is used in a Pattern
-/patternusesoverprint { % <Pattern dict> patternusesoverprint <bool>
- //false exch % Assume no overprint
+/patternusesoverprint { % <Pattern dict> patternusesoverprint <bool>
+ //false exch % Assume no overprint
{
4 dict 1 index resourceusesoverprint { pop not exit } if
dup /ExtGState knownoget { extgstateusesoverprint { pop not exit } if } if
@@ -3159,8 +4030,8 @@ currentdict /PDF2PS_matrix_key undef
} bind def
% Check the Resources of a page or Form. Check for loops in the resource chain.
-/resourceusesoverprint { % <dict> <dict> resourceusesoverprint <bool>
- { % Use loop to provide an exitable context.
+/resourceusesoverprint { % <dict> <dict> resourceusesoverprint <bool>
+ { % Use loop to provide an exitable context.
/Resources knownoget not { 0 dict } if
2 copy .knownget {
{ % Some circular references may be missed because scanning stops
@@ -3190,22 +4061,22 @@ currentdict /PDF2PS_matrix_key undef
} bind def
% Check if the annotations on a page use overprint
-/annotsuseoverprint { % <page dict> annotsuseoverprint <bool>
- //false exch % Assume no overprint
- /Annots knownoget { % Get Annots array
+/annotsuseoverprint { % <page dict> annotsuseoverprint <bool>
+ //false exch % Assume no overprint
+ /Annots knownoget { % Get Annots array
dup type /arraytype eq {
{
oforce
dup //null ne {
- /AP knownoget { % Get appearance dict for the annoation
- /N knownogetdict { % Get the /N (i.e. normal) appearance stream
- 4 dict exch resourceusesoverprint { pop pop //true exit } if
+ /AP knownoget { % Get appearance dict for the annoation
+ /N knownogetdict { % Get the /N (i.e. normal) appearance stream
+ 4 dict exch resourceusesoverprint { not exit } if
} if
- } if % If AP dict known
+ } if % If AP dict known
} {
pop
} ifelse
- } forall % For all annots on the page
+ } forall % For all annots on the page
} {
( **** Error: Annotation array is not an array, ignoring it.\n) pdfformaterror
( Output may be incorrect.\n) pdfformaterror
@@ -3218,8 +4089,8 @@ currentdict /PDF2PS_matrix_key undef
% ------ Transparency support ------ %
% Determine whether a page might invoke any transparency features:
-% - Non-default BM, ca, CA, or SMask in an ExtGState
-% - Image XObject with SMask
+% - Non-default BM, ca, CA, or SMask in an ExtGState
+% - Image XObject with SMask
% Note: we deliberately don't check to see whether a Group is defined,
% because Adobe Illustrator 10 (and possibly other applications) define
% a page-level group whether transparency is actually used or not.
@@ -3228,7 +4099,7 @@ currentdict /PDF2PS_matrix_key undef
%
% Transparency is a 1.4 feature however we have seen files that claimed
% to be PDF 1.1 with transparency features. Bugs 689288, 691273.
-/pageusestransparency { % <pagedict> pageusestransparency <bool>
+/pageusestransparency { % <pagedict> pageusestransparency <bool>
NOTRANSPARENCY {
pop //false
} {
@@ -3257,12 +4128,12 @@ currentdict /PDF2PS_matrix_key undef
} bind executeonly def
% Check if transparency is specified in an ExtGState dict
-/extgstateusestransparency { % <gstate dict> extgstateusestransparency <bool>
- //false exch % Assume no transparency
+/extgstateusestransparency { % <gstate dict> extgstateusestransparency <bool>
+ //false exch % Assume no transparency
dup //null eq {
pop % bug 692050
} {
- { % establish loop context
+ { % establish loop context
dup /BM knownoget {
dup /Normal ne exch /Compatible ne and { pop not exit } if
} if
@@ -3275,10 +4146,10 @@ currentdict /PDF2PS_matrix_key undef
} bind executeonly def
% Check if transparency is used in a Pattern
-/patternusestransparency { % <Pattern dict> patternusestransparency <bool>
+/patternusestransparency { % <Pattern dict> patternusestransparency <bool>
dup //null eq NOTRANSPARENCY or
{ pop //false }
- { //false exch % Assume no transparency
+ { //false exch % Assume no transparency
{
4 dict 1 index resourceusestransparency { pop not exit } if
dup /ExtGState knownoget { extgstateusestransparency { pop not exit } if } if
@@ -3289,8 +4160,8 @@ currentdict /PDF2PS_matrix_key undef
} bind executeonly def
% Check the Resources of a page or Form. Check for loops in the resource chain.
-/resourceusestransparency { % <dict> <dict> resourceusestransparency <bool>
- { % Use loop to provide an exitable context.
+/resourceusestransparency { % <dict> <dict> resourceusestransparency <bool>
+ { % Use loop to provide an exitable context.
/Resources knownoget not { 0 dict } if
2 copy .knownget {
{ % Some circular references may be missed because scanning stops
@@ -3380,9 +4251,9 @@ currentdict /PDF2PS_matrix_key undef
} bind executeonly def
% Check if the annotations on a page use transparency
-/annotsusetransparency { % <page dict> annotsusetransparency <bool>
- //false exch % Assume no transparency
- /Annots knownoget { % Get Annots array
+/annotsusetransparency { % <page dict> annotsusetransparency <bool>
+ //false exch % Assume no transparency
+ /Annots knownoget { % Get Annots array
dup type /arraytype eq {
{
/AnnotTransparencyCheck exch % marker to clean up stack on error
@@ -3404,11 +4275,11 @@ currentdict /PDF2PS_matrix_key undef
pop pop //true exit % as transparency.
} if
} if
- dup /AP knownoget { % Get appearance dict for the annoation
- /N knownogetdict { % Get the /N (i.e. normal) appearance stream
+ dup /AP knownoget { % Get appearance dict for the annoation
+ /N knownogetdict { % Get the /N (i.e. normal) appearance stream
4 dict exch resourceusestransparency { pop pop //true exit } if
} if
- } if % If AP dict known
+ } if % If AP dict known
dup /BM knownoget {
pop pop pop //true exit
} if
@@ -3431,7 +4302,7 @@ currentdict /PDF2PS_matrix_key undef
pop
} ifelse
} ifelse
- } forall % For all annots on the page
+ } forall % For all annots on the page
}
{
( **** Error: Annotation array is not an array, ignoring it.\n) pdfformaterror
@@ -3443,7 +4314,7 @@ currentdict /PDF2PS_matrix_key undef
} bind executeonly def
% Add a color name to our spot color list. Ignore /All and /None
-/putspotcolor { % <name> <spotcolordict> putspotcolor -
+/putspotcolor { % <name> <spotcolordict> putspotcolor -
% The 'name' could be a string. If so then convert to a name.
exch dup type /stringtype eq { cvn } if
dup dup /None eq exch /All eq or { pop pop } { 0 put } ifelse
@@ -3452,7 +4323,7 @@ currentdict /PDF2PS_matrix_key undef
% Determine which spot colors are used within a color space Note: This
% dict will include all colors used in Separation or DeviceN color spaces.
% Thus it may include Cyan, Magenta, Yellow, and Black.
-% <colorspace> <spotcolordict> colorspacespotcolors -
+% <colorspace> <spotcolordict> colorspacespotcolors -
/colorspacespotcolors {
% Make sure we have an array, and that it is has enough info
exch dup type /arraytype eq
@@ -3464,7 +4335,7 @@ currentdict /PDF2PS_matrix_key undef
2 copy exch colorspacespotcolors
} {
dup /Pattern eq {
- 1 index length 1 gt { % only uncolored patterns have colorspace
+ 1 index length 1 gt { % only uncolored patterns have colorspace
pop 1 oget % <<>> [base]
2 copy exch colorspacespotcolors
} {
@@ -3490,10 +4361,10 @@ currentdict /PDF2PS_matrix_key undef
% all colors used in Separation or DeviceN color spaces. Thus it may include
% Cyan, Magenta, Yellow, and Black. We also pass a dict that is used to check
% for loops in the resource list.
-% <spotcolordict> <loopdict> <page/form/annot dict>
-% resourcespotcolors <spotcolordict> <loopdict>
+% <spotcolordict> <loopdict> <page/form/annot dict>
+% resourcespotcolors <spotcolordict> <loopdict>
/resourcespotcolors {
- { % Use loop to provide an exitable context.
+ { % Use loop to provide an exitable context.
% Exit if no Resources entry
/Resources knownoget not { exit } if
% Exit if we have already seen this dict
@@ -3563,17 +4434,17 @@ currentdict /PDF2PS_matrix_key undef
% Determine which spot colors are used within the annotations. Note: This
% dict will include all colors used in Separation or DeviceN color spaces.
% Thus it may include Cyan, Magenta, Yellow, and Black.
-% <spotcolordict> <loopdict> <annotsarray>
-% annotsspotcolors <spotcolordict> <loopdict>
+% <spotcolordict> <loopdict> <annotsarray>
+% annotsspotcolors <spotcolordict> <loopdict>
/annotsspotcolors {
dup type /arraytype eq {
{ oforce
dup //null ne {
- /AP knownoget { % Get appearance dict for the annoation
- /N knownogetdict { % Get the /N (i.e. normal) appearance stream
+ /AP knownoget { % Get appearance dict for the annoation
+ /N knownogetdict { % Get the /N (i.e. normal) appearance stream
resourcespotcolors
- } if % If normal appearance streamknown
- } if % If AP dict known
+ } if % If normal appearance streamknown
+ } if % If AP dict known
} {
pop
} ifelse
@@ -3594,7 +4465,7 @@ currentdict /PDF2PS_matrix_key undef
% page's resources. Thus it may include Cyan, Magenta, Yellow, and Black.
% There is no attempt to verify that these color spaces are actually used
% within the object streams for the page.
-/pagespotcolors { % <pagedict> pagespotcolors <spotcolordict>
+/pagespotcolors { % <pagedict> pagespotcolors <spotcolordict>
dup
% Create a dict to hold spot color names.
0 dict exch
@@ -3607,7 +4478,7 @@ currentdict /PDF2PS_matrix_key undef
{
/Parent knownoget
{
- dup /Pages known not { pop exit } if % not a valid Page Tree ancestor
+ dup /Pages known not { pop exit } if % not a valid Page Tree ancestor
dup 4 1 roll
resourcespotcolors
3 -1 roll
@@ -3619,18 +4490,18 @@ currentdict /PDF2PS_matrix_key undef
% Also check for color spaces in the annotations.
3 -1 roll
/Annots knownoget { annotsspotcolors } if
- pop % Discard reference loop dict
+ pop % Discard reference loop dict
} bind executeonly def
% Determine how many (if any) spot colors are used by a page.
% Note: This count does not include Cyan, Magenta, Yellow, or Black
-/countspotcolors { % <pagedict> countspotcolors <count>
- pagespotcolors % Get dict with all spot colors
- dup length % spot color dict length
+/countspotcolors { % <pagedict> countspotcolors <count>
+ pagespotcolors % Get dict with all spot colors
+ dup length % spot color dict length
% Remove CMYK from the spot color count.
[ /Cyan /Magenta /Yellow /Black ]
{ 2 index exch known { 1 sub } if } forall
- exch pop % Remove spot color dict
+ exch pop % Remove spot color dict
} bind executeonly def
% ------ ColorSpace substitution support ------ %
@@ -3848,7 +4719,7 @@ currentdict /PDF2PS_matrix_key undef
Trailer /Root knownoget {
/OutputIntents knownoget {
dup type /arraytype eq {
- { % process all output profiles present
+ { % process all output profiles present
oforce
dup length dict .copydict
dup /DestOutputProfile knownoget {
@@ -3880,7 +4751,7 @@ currentdict /PDF2PS_matrix_key undef
{ currentdevice //null //false counttomark 1 add 3 roll .putdeviceparamsonly }
ifelse
pop pop
- pop % done with this OutputIntent dictionary
+ pop % done with this OutputIntent dictionary
} forall
} {
pop
@@ -3888,7 +4759,7 @@ currentdict /PDF2PS_matrix_key undef
pdfformaterror
( Output may be incorrect.\n) pdfformaterror
} ifelse
- } if % OutputIntents known
+ } if % OutputIntents known
% tell device there are no more OutputIntents
[ /OutputIntent [ ] /.pdfputparams where
{ pop .pdfputparams }
@@ -3963,7 +4834,7 @@ currentdict /PDF2PS_matrix_key undef
pop
}bind readonly def
-end % pdfdict
+end % pdfdict
systemdict /ALLOWPSTRANSPARENCY get
@@ -4017,7 +4888,7 @@ systemdict /ALLOWPSTRANSPARENCY get
/.pdfinkpath /.pdfFormName /.settextspacing /.currenttextspacing /.settextleading /.currenttextleading
/.settextrise /.currenttextrise /.setwordspacing /.currentwordspacing /.settexthscaling /.currenttexthscaling
-/.setPDFfontsize /.currentPDFfontsize /.setdistillerparams
+/.setPDFfontsize /.currentPDFfontsize /.setdistillerparams /.currentpoint_valid
% undefining these causes errors/incorrect output
%/.settextrenderingmode
diff --git a/Master/tlpkg/tlgs/Resource/Init/pdf_ops.ps b/Master/tlpkg/tlgs/Resource/Init/pdf_ops.ps
index fe61b12dcdb..27c2068088f 100644
--- a/Master/tlpkg/tlgs/Resource/Init/pdf_ops.ps
+++ b/Master/tlpkg/tlgs/Resource/Init/pdf_ops.ps
@@ -680,8 +680,8 @@ end
} def
/Dpop { //OPsaveDstack begin previous { def } forall end } def
-% colorspaces that don't require special overprint transparency handling
-/okOPcs mark /DeviceGray 0 /DeviceCMYK 1 /DeviceN 2 /Separation 3 .dicttomark def
+% colorspaces that require special overprint transparency handling
+/specialOPcs mark /DeviceGray 0 /DeviceCMYK 1 /DeviceN 2 /Separation 3 .dicttomark def
% Take care of pushing a transparency group if we need it for SMask or for Overprint..
% After pushing the group, we save the ca and CA and change them
@@ -696,11 +696,18 @@ end
//OPsaveDstack begin
//Dpush exec % push the current OPsaveDstack values into 'previous'
/SupportsDevn .special_op
- okOPcs currentcolorspace 0 get dup /Indexed eq {
+ specialOPcs currentcolorspace 0 get dup /Indexed eq {
pop currentcolorspace 1 get % use the base space
} if
known or {
- 1 index /stroke ne { .currentfilloverprint } { .currentstrokeoverprint } ifelse
+ dup /stroke ne {
+ .currentfilloverprint
+ 1 index dup /.fillstroke eq exch /.eofillstroke eq or {
+ .currentstrokeoverprint or
+ } if
+ } {
+ .currentstrokeoverprint
+ } ifelse
% Change BM to CompatibleOverprint if this has overprint true
dup /ChangeBM exch def
.currentblendmode dup /Normal eq exch /Compatible eq or
@@ -961,12 +968,12 @@ currentdict dup /Dpush .undef /Dpop .undef
n
} bind executeonly def
/b { closepath B* } bind executeonly def
-/n { end { currentpoint } stopped not { pop pop clip } if newpath } bind executeonly def
+/n { end .currentpoint_valid { clip } if newpath } bind executeonly def
end readonly def
/W { //Wdict begin } bind executeonly def
/W*dict 8 dict dup begin
Wdict { def } forall
-/n { end { currentpoint } stopped not { pop pop eoclip } if newpath } bind executeonly def
+/n { end .currentpoint_valid { eoclip } if newpath } bind executeonly def
end readonly def
/W* { //W*dict begin } bind executeonly def
% ---------------- Text control ---------------- %
@@ -1057,7 +1064,8 @@ end readonly def
/settextposition {
% Update the TextMatrix translation.
gsave TextSaveMatrix setmatrix
- {currentpoint} stopped not {
+ .currentpoint_valid {
+ currentpoint
.currenttextrise
sub
matrix .currenttextmatrix
@@ -1105,6 +1113,9 @@ end readonly def
} bind executeonly odef
/BT {
+ % Bug 703996 has a path defined before BT, then stroked afterwards
+ .currentpoint_valid { //false upath } { //null } ifelse
+ /BT_upath gput
//false /illegal_BT gput
currentdict /TextSaveMatrix known {
( **** Error: illegal nested BT operator detected.\n)
@@ -1153,10 +1164,8 @@ end readonly def
/clip_if_required {
.currenttextrenderingmode 4 ge
- {currentpoint} //.internalstopped exec
- {//false}
- {pop pop //true}
- ifelse and
+ .currentpoint_valid
+ and
{ .currentfilladjust2 0 dup .setfilladjust2 clip .setfilladjust2} if
newpath
} bind def
@@ -1183,6 +1192,7 @@ end readonly def
%% in a nested text block (inside a gsave).
currentdict /qTextSaveMatrix known not {
switch_to_normal_marking_ops
+ currentdict /BT_upath get dup //null eq { pop } { newpath uappend } ifelse
} if
} bind executeonly def
diff --git a/Master/tlpkg/tlgs/lib/Fontmap b/Master/tlpkg/tlgs/lib/Fontmap
index 6faaf7cfe71..04702bb5e72 100644
--- a/Master/tlpkg/tlgs/lib/Fontmap
+++ b/Master/tlpkg/tlgs/lib/Fontmap
@@ -1,5 +1,5 @@
%!
-%% $Id: Fontmap 36707 2015-04-02 23:03:05Z reinhardk $
+%% $Id: Fontmap 7680 2008-04-27 12:21:15Z reinhardk $
% See Fontmap.TeXLive for the syntax of real Fontmap files.
%% Replace 1 (Fontmap.TeXLive)
diff --git a/Master/tlpkg/tlgs/lib/Fontmap.TeXLive b/Master/tlpkg/tlgs/lib/Fontmap.TeXLive
index c5fceb25c2e..ed079d50fc1 100644
--- a/Master/tlpkg/tlgs/lib/Fontmap.TeXLive
+++ b/Master/tlpkg/tlgs/lib/Fontmap.TeXLive
@@ -1,108 +1,108 @@
-%% Fontmap.TeXLive
-%% $Id: Fontmap.TeXLive 36707 2015-04-02 23:03:05Z reinhardk $
-
-%% This file is part of TeXLive.
-%% You may freely use, modify and/or distribute this file.
-
-%% Bitstream Charter
-
-/CharterBT-Bold (bchb8a.pfb) ;
-/CharterBT-BoldItalic (bchbi8a.pfb) ;
-/CharterBT-Roman (bchr8a.pfb) ;
-/CharterBT-Italic (bchri8a.pfb) ;
-
-%% Adobe Utopia
-
-/Utopia-Bold (putb8a.pfb) ;
-/Utopia-BoldItalic (putbi8a.pfb) ;
-/Utopia-Regular (putr8a.pfb) ;
-/Utopia-Italic (putri8a.pfb) ;
-
-%% URW LW35 Fonts
-
-/URWGothicL-Demi (uagd8a.pfb) ;
-/URWGothicL-DemiObli (uagdo8a.pfb) ;
-/URWGothicL-Book (uagk8a.pfb) ;
-/URWGothicL-BookObli (uagko8a.pfb) ;
-/URWBookmanL-DemiBold (ubkd8a.pfb) ;
-/URWBookmanL-DemiBoldItal (ubkdi8a.pfb) ;
-/URWBookmanL-Ligh (ubkl8a.pfb) ;
-/URWBookmanL-LighItal (ubkli8a.pfb) ;
-/NimbusMonL-Bold (ucrb8a.pfb) ;
-/NimbusMonL-BoldObli (ucrbo8a.pfb) ;
-/NimbusMonL-Regu (ucrr8a.pfb) ;
-/NimbusMonL-ReguObli (ucrro8a.pfb) ;
-/NimbusSanL-Bold (uhvb8a.pfb) ;
-/NimbusSanL-BoldCond (uhvb8ac.pfb) ;
-/NimbusSanL-BoldItal (uhvbo8a.pfb) ;
-/NimbusSanL-BoldCondItal (uhvbo8ac.pfb) ;
-%%%/NimbusSanL-Regu (uhvr8a-105.pfb) ;
-/NimbusSanL-Regu (uhvr8a.pfb) ;
-/NimbusSanL-ReguCond (uhvr8ac.pfb) ;
-%%%/NimbusSanL-ReguItal (uhvro8a-105.pfb) ;
-/NimbusSanL-ReguItal (uhvro8a.pfb) ;
-/NimbusSanL-ReguCondItal (uhvro8ac.pfb) ;
-/CenturySchL-Bold (uncb8a.pfb) ;
-/CenturySchL-BoldItal (uncbi8a.pfb) ;
-/CenturySchL-Roma (uncr8a.pfb) ;
-/CenturySchL-Ital (uncri8a.pfb) ;
-/URWPalladioL-Bold (uplb8a.pfb) ;
-/URWPalladioL-BoldItal (uplbi8a.pfb) ;
-/URWPalladioL-Roma (uplr8a.pfb) ;
-/URWPalladioL-Ital (uplri8a.pfb) ;
-/StandardSymL (usyr.pfb) ;
-/NimbusRomNo9L-Medi (utmb8a.pfb) ;
-/NimbusRomNo9L-MediItal (utmbi8a.pfb) ;
-/NimbusRomNo9L-Regu (utmr8a.pfb) ;
-/NimbusRomNo9L-ReguItal (utmri8a.pfb) ;
-/URWChanceryL-MediItal (uzcmi8a.pfb) ;
-/Dingbats (uzdr.pfb) ;
-
-
-% Aliases
-
-/Bookman-Demi /URWBookmanL-DemiBold ;
-/Bookman-DemiItalic /URWBookmanL-DemiBoldItal ;
-/Bookman-Light /URWBookmanL-Ligh ;
-/Bookman-LightItalic /URWBookmanL-LighItal ;
-
-/Courier /NimbusMonL-Regu ;
-/Courier-Oblique /NimbusMonL-ReguObli ;
-/Courier-Bold /NimbusMonL-Bold ;
-/Courier-BoldOblique /NimbusMonL-BoldObli ;
-
-/AvantGarde-Book /URWGothicL-Book ;
-/AvantGarde-BookOblique /URWGothicL-BookObli ;
-/AvantGarde-Demi /URWGothicL-Demi ;
-/AvantGarde-DemiOblique /URWGothicL-DemiObli ;
-
-/Helvetica /NimbusSanL-Regu ;
-/Helvetica-Oblique /NimbusSanL-ReguItal ;
-/Helvetica-Bold /NimbusSanL-Bold ;
-/Helvetica-BoldOblique /NimbusSanL-BoldItal ;
-
-/Helvetica-Narrow /NimbusSanL-ReguCond ;
-/Helvetica-Narrow-Oblique /NimbusSanL-ReguCondItal ;
-/Helvetica-Narrow-Bold /NimbusSanL-BoldCond ;
-/Helvetica-Narrow-BoldOblique /NimbusSanL-BoldCondItal ;
-
-/Palatino-Roman /URWPalladioL-Roma ;
-/Palatino-Italic /URWPalladioL-Ital ;
-/Palatino-Bold /URWPalladioL-Bold ;
-/Palatino-BoldItalic /URWPalladioL-BoldItal ;
-
-/NewCenturySchlbk-Roman /CenturySchL-Roma ;
-/NewCenturySchlbk-Italic /CenturySchL-Ital ;
-/NewCenturySchlbk-Bold /CenturySchL-Bold ;
-/NewCenturySchlbk-BoldItalic /CenturySchL-BoldItal ;
-
-/Times-Roman /NimbusRomNo9L-Regu ;
-/Times-Italic /NimbusRomNo9L-ReguItal ;
-/Times-Bold /NimbusRomNo9L-Medi ;
-/Times-BoldItalic /NimbusRomNo9L-MediItal ;
-
-/Symbol /StandardSymL ;
-
-/ZapfChancery-MediumItalic /URWChanceryL-MediItal ;
-
-/ZapfDingbats /Dingbats ;
+%% Fontmap.TeXLive
+%% $Id: Fontmap.TeXLive 7680 2008-04-27 12:21:15Z reinhardk $
+
+%% This file is part of TeXLive.
+%% You may freely use, modify and/or distribute this file.
+
+%% Bitstream Charter
+
+/CharterBT-Bold (bchb8a.pfb) ;
+/CharterBT-BoldItalic (bchbi8a.pfb) ;
+/CharterBT-Roman (bchr8a.pfb) ;
+/CharterBT-Italic (bchri8a.pfb) ;
+
+%% Adobe Utopia
+
+/Utopia-Bold (putb8a.pfb) ;
+/Utopia-BoldItalic (putbi8a.pfb) ;
+/Utopia-Regular (putr8a.pfb) ;
+/Utopia-Italic (putri8a.pfb) ;
+
+%% URW LW35 Fonts
+
+/URWGothicL-Demi (uagd8a.pfb) ;
+/URWGothicL-DemiObli (uagdo8a.pfb) ;
+/URWGothicL-Book (uagk8a.pfb) ;
+/URWGothicL-BookObli (uagko8a.pfb) ;
+/URWBookmanL-DemiBold (ubkd8a.pfb) ;
+/URWBookmanL-DemiBoldItal (ubkdi8a.pfb) ;
+/URWBookmanL-Ligh (ubkl8a.pfb) ;
+/URWBookmanL-LighItal (ubkli8a.pfb) ;
+/NimbusMonL-Bold (ucrb8a.pfb) ;
+/NimbusMonL-BoldObli (ucrbo8a.pfb) ;
+/NimbusMonL-Regu (ucrr8a.pfb) ;
+/NimbusMonL-ReguObli (ucrro8a.pfb) ;
+/NimbusSanL-Bold (uhvb8a.pfb) ;
+/NimbusSanL-BoldCond (uhvb8ac.pfb) ;
+/NimbusSanL-BoldItal (uhvbo8a.pfb) ;
+/NimbusSanL-BoldCondItal (uhvbo8ac.pfb) ;
+%%%/NimbusSanL-Regu (uhvr8a-105.pfb) ;
+/NimbusSanL-Regu (uhvr8a.pfb) ;
+/NimbusSanL-ReguCond (uhvr8ac.pfb) ;
+%%%/NimbusSanL-ReguItal (uhvro8a-105.pfb) ;
+/NimbusSanL-ReguItal (uhvro8a.pfb) ;
+/NimbusSanL-ReguCondItal (uhvro8ac.pfb) ;
+/CenturySchL-Bold (uncb8a.pfb) ;
+/CenturySchL-BoldItal (uncbi8a.pfb) ;
+/CenturySchL-Roma (uncr8a.pfb) ;
+/CenturySchL-Ital (uncri8a.pfb) ;
+/URWPalladioL-Bold (uplb8a.pfb) ;
+/URWPalladioL-BoldItal (uplbi8a.pfb) ;
+/URWPalladioL-Roma (uplr8a.pfb) ;
+/URWPalladioL-Ital (uplri8a.pfb) ;
+/StandardSymL (usyr.pfb) ;
+/NimbusRomNo9L-Medi (utmb8a.pfb) ;
+/NimbusRomNo9L-MediItal (utmbi8a.pfb) ;
+/NimbusRomNo9L-Regu (utmr8a.pfb) ;
+/NimbusRomNo9L-ReguItal (utmri8a.pfb) ;
+/URWChanceryL-MediItal (uzcmi8a.pfb) ;
+/Dingbats (uzdr.pfb) ;
+
+
+% Aliases
+
+/Bookman-Demi /URWBookmanL-DemiBold ;
+/Bookman-DemiItalic /URWBookmanL-DemiBoldItal ;
+/Bookman-Light /URWBookmanL-Ligh ;
+/Bookman-LightItalic /URWBookmanL-LighItal ;
+
+/Courier /NimbusMonL-Regu ;
+/Courier-Oblique /NimbusMonL-ReguObli ;
+/Courier-Bold /NimbusMonL-Bold ;
+/Courier-BoldOblique /NimbusMonL-BoldObli ;
+
+/AvantGarde-Book /URWGothicL-Book ;
+/AvantGarde-BookOblique /URWGothicL-BookObli ;
+/AvantGarde-Demi /URWGothicL-Demi ;
+/AvantGarde-DemiOblique /URWGothicL-DemiObli ;
+
+/Helvetica /NimbusSanL-Regu ;
+/Helvetica-Oblique /NimbusSanL-ReguItal ;
+/Helvetica-Bold /NimbusSanL-Bold ;
+/Helvetica-BoldOblique /NimbusSanL-BoldItal ;
+
+/Helvetica-Narrow /NimbusSanL-ReguCond ;
+/Helvetica-Narrow-Oblique /NimbusSanL-ReguCondItal ;
+/Helvetica-Narrow-Bold /NimbusSanL-BoldCond ;
+/Helvetica-Narrow-BoldOblique /NimbusSanL-BoldCondItal ;
+
+/Palatino-Roman /URWPalladioL-Roma ;
+/Palatino-Italic /URWPalladioL-Ital ;
+/Palatino-Bold /URWPalladioL-Bold ;
+/Palatino-BoldItalic /URWPalladioL-BoldItal ;
+
+/NewCenturySchlbk-Roman /CenturySchL-Roma ;
+/NewCenturySchlbk-Italic /CenturySchL-Ital ;
+/NewCenturySchlbk-Bold /CenturySchL-Bold ;
+/NewCenturySchlbk-BoldItalic /CenturySchL-BoldItal ;
+
+/Times-Roman /NimbusRomNo9L-Regu ;
+/Times-Italic /NimbusRomNo9L-ReguItal ;
+/Times-Bold /NimbusRomNo9L-Medi ;
+/Times-BoldItalic /NimbusRomNo9L-MediItal ;
+
+/Symbol /StandardSymL ;
+
+/ZapfChancery-MediumItalic /URWChanceryL-MediItal ;
+
+/ZapfDingbats /Dingbats ;
diff --git a/Master/tlpkg/tlgs/lib/PDFA_def.ps b/Master/tlpkg/tlgs/lib/PDFA_def.ps
index f77c90ef19b..c5e2aa6801c 100644
--- a/Master/tlpkg/tlgs/lib/PDFA_def.ps
+++ b/Master/tlpkg/tlgs/lib/PDFA_def.ps
@@ -35,13 +35,13 @@ def
/CMYK eq {
/N 4 false
}{
- (ColorConversionStrategy not a device space, falling back to ProcessColorModel, output may not be valid PDF/A.)=
+ (\tColorConversionStrategy not a device space, falling back to ProcessColorModel, output may not be valid PDF/A.\n)=
true
} ifelse
} ifelse
} ifelse
} {
- (ColorConversionStrategy not set, falling back to ProcessColorModel, output may not be valid PDF/A.)=
+ (\tColorConversionStrategy not set, falling back to ProcessColorModel, output may not be valid PDF/A.\n)=
true
} ifelse
@@ -56,7 +56,7 @@ def
dup /DeviceCMYK eq {
pop /N 4
} {
- (ProcessColorModel not a device space.)=
+ (\tProcessColorModel not a device space.)=
/ProcessColorModel cvx /rangecheck signalerror
} ifelse
} ifelse
@@ -65,15 +65,27 @@ def
%% ----------8<--------------8<-------------8<--------------8<----------
>> /PUT pdfmark
-[{icc_PDFA} ICCProfile (r) file /PUT pdfmark
+[
+{icc_PDFA}
+{ICCProfile (r) file} stopped
+{
+ (\n\tFailed to open the supplied ICCProfile for reading. This may be due to\n) print
+ (\t an incorrect filename or a failure to add --permif-file-read=<profile>\n) print
+ (\t to the command line. This PostScript program needs to open the file\n) print
+ (\t and you must explicitly grant it permission to do so.\n\n) print
+ (\tPDF/A processing aborted, output may not be a PDF/A file.\n\n) print
+ cleartomark
+}
+{
+ /PUT pdfmark
+ % Define the output intent dictionary :
-% Define the output intent dictionary :
-
-[/_objdef {OutputIntent_PDFA} /type /dict /OBJ pdfmark
-[{OutputIntent_PDFA} <<
- /Type /OutputIntent % Must be so (the standard requires).
- /S /GTS_PDFA1 % Must be so (the standard requires).
- /DestOutputProfile {icc_PDFA} % Must be so (see above).
- /OutputConditionIdentifier (sRGB) % Customize
->> /PUT pdfmark
-[{Catalog} <</OutputIntents [ {OutputIntent_PDFA} ]>> /PUT pdfmark
+ [/_objdef {OutputIntent_PDFA} /type /dict /OBJ pdfmark
+ [{OutputIntent_PDFA} <<
+ /Type /OutputIntent % Must be so (the standard requires).
+ /S /GTS_PDFA1 % Must be so (the standard requires).
+ /DestOutputProfile {icc_PDFA} % Must be so (see above).
+ /OutputConditionIdentifier (sRGB) % Customize
+ >> /PUT pdfmark
+ [{Catalog} <</OutputIntents [ {OutputIntent_PDFA} ]>> /PUT pdfmark
+} ifelse
diff --git a/Master/tlpkg/tlgs/lib/afmdiff.awk b/Master/tlpkg/tlgs/lib/afmdiff.awk
index 7b6f75867b6..e9c237b4bc6 100644
--- a/Master/tlpkg/tlgs/lib/afmdiff.awk
+++ b/Master/tlpkg/tlgs/lib/afmdiff.awk
@@ -1,151 +1,151 @@
-#!/usr/bin/awk -f
-###=====================================================================
-### Read two Adobe Font Metric files, and compute tables of the
-### differences in character repertoire, declared widths (WX), and
-### bounding boxes.
-###
-### Usage:
-### awk -f afmdiff.awk file1.afm file2.afm
-###
-### Author:
-### Nelson H. F. Beebe
-### Center for Scientific Computing
-### University of Utah
-### Department of Mathematics, 322 INSCC
-### 155 S 1400 E RM 233
-### Salt Lake City, UT 84112-0090
-### USA
-### Email: beebe@math.utah.edu, beebe@acm.org, beebe@computer.org,
-### beebe@ieee.org (Internet)
-### WWW URL: http://www.math.utah.edu/~beebe
-### Telephone: +1 801 581 5254
-### FAX: +1 801 585 1640, +1 801 581 4148
-###
-########################################################################
-########################################################################
-########################################################################
-### ###
-### awkdiff.awk: compare two Adobe Font Metric files ###
-### ###
-### Copyright (C) 2000 Nelson H. F. Beebe ###
-### ###
-### This program is covered by the GNU General Public License (GPL), ###
-### version 2 or later, available as the file COPYING in the program ###
-### source distribution, and on the Internet at ###
-### ###
-### ftp://ftp.gnu.org/gnu/GPL ###
-### ###
-### http://www.gnu.org/copyleft/gpl.html ###
-### ###
-### This program is free software; you can redistribute it and/or ###
-### modify it under the terms of the GNU General Public License as ###
-### published by the Free Software Foundation; either version 2 of ###
-### the License, or (at your option) any later version. ###
-### ###
-### This program is distributed in the hope that it will be useful, ###
-### but WITHOUT ANY WARRANTY; without even the implied warranty of ###
-### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ###
-### GNU General Public License for more details. ###
-### ###
-### You should have received a copy of the GNU General Public ###
-### License along with this program; if not, write to the Free ###
-### Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, ###
-### MA 02111-1307 USA ###
-### ###
-### This program may also be distributed as part of AFPL ###
-### Ghostscript, under the terms of the Aladdin Free Public License ###
-### (the "License"). ###
-### ###
-### Every copy of AFPL Ghostscript must include a copy of the ###
-### License, normally in a plain ASCII text file named PUBLIC. The ###
-### License grants you the right to copy, modify and redistribute ###
-### AFPL Ghostscript, but only under certain conditions ###
-### described in the License. Among other things, the License ###
-### requires that the copyright notice and this notice be preserved ###
-### on all copies. ###
-### ###
-########################################################################
-########################################################################
-########################################################################
-#
-# [29-Apr-2000]
-#=======================================================================
-
-/^FontName/ { FontName[++NFontName] = $2 }
-
-
-/^C / {
- if (NFontName == 1)
- CharName1[$8]++
- if (NFontName == 2)
- CharName2[$8]++
- }
-
-
-/^C / {
- name = $8
- if (name in WX)
- {
- if (WX[name] != $5)
- WXDIFF[name] = WX[name] - $5
- }
- else
- WX[name] = $5
- }
-
-
-/^C / {
- name = $8
- bx = $13 - $11
- if (name in BX)
- {
- if (BX[name] != bx)
- BXDIFF[name] = BX[name] - bx
- }
- else
- BX[name] = bx
- }
-
-
-/^C / {
- name = $8
- by = $14 - $12
- if (name in BY)
- {
- if (BY[name] != by)
- BYDIFF[name] = BY[name] - by
- }
- else
- BY[name] = by
- }
-
-
-END {
- Sortpipe = "sort -f | pr -3 -w80 -l1 -t"
- print "Comparison of AFM metrics in files:", ARGV[1], ARGV[2]
- print "Font names:", FontName[1], FontName[2]
- show_name_diffs(FontName[2],CharName2, FontName[1],CharName1)
- show_name_diffs(FontName[1],CharName1, FontName[2],CharName2)
- show_num_diffs("WX width differences", WXDIFF)
- show_num_diffs("Bounding box width differences", BXDIFF)
- show_num_diffs("Bounding box height differences",BYDIFF)
- }
-
-function show_name_diffs(font1,array1,font2,array2, name)
-{
- print "\nChars from", font2, "missing from", font1 ":"
- for (name in array2)
- {
- if (!(name in array1))
- printf("%s\n", name) | Sortpipe
- }
- close(Sortpipe)
-}
-
-function show_num_diffs(title,array, name)
-{
- printf("\n%s:\n", title)
- for (name in array)
- printf("%-15s\t%4d\n", name, array[name]) | Sortpipe
- close(Sortpipe)
-}
+#!/usr/bin/awk -f
+###=====================================================================
+### Read two Adobe Font Metric files, and compute tables of the
+### differences in character repertoire, declared widths (WX), and
+### bounding boxes.
+###
+### Usage:
+### awk -f afmdiff.awk file1.afm file2.afm
+###
+### Author:
+### Nelson H. F. Beebe
+### Center for Scientific Computing
+### University of Utah
+### Department of Mathematics, 322 INSCC
+### 155 S 1400 E RM 233
+### Salt Lake City, UT 84112-0090
+### USA
+### Email: beebe@math.utah.edu, beebe@acm.org, beebe@computer.org,
+### beebe@ieee.org (Internet)
+### WWW URL: http://www.math.utah.edu/~beebe
+### Telephone: +1 801 581 5254
+### FAX: +1 801 585 1640, +1 801 581 4148
+###
+########################################################################
+########################################################################
+########################################################################
+### ###
+### awkdiff.awk: compare two Adobe Font Metric files ###
+### ###
+### Copyright (C) 2000 Nelson H. F. Beebe ###
+### ###
+### This program is covered by the GNU General Public License (GPL), ###
+### version 2 or later, available as the file COPYING in the program ###
+### source distribution, and on the Internet at ###
+### ###
+### ftp://ftp.gnu.org/gnu/GPL ###
+### ###
+### http://www.gnu.org/copyleft/gpl.html ###
+### ###
+### This program is free software; you can redistribute it and/or ###
+### modify it under the terms of the GNU General Public License as ###
+### published by the Free Software Foundation; either version 2 of ###
+### the License, or (at your option) any later version. ###
+### ###
+### This program is distributed in the hope that it will be useful, ###
+### but WITHOUT ANY WARRANTY; without even the implied warranty of ###
+### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ###
+### GNU General Public License for more details. ###
+### ###
+### You should have received a copy of the GNU General Public ###
+### License along with this program; if not, write to the Free ###
+### Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, ###
+### MA 02111-1307 USA ###
+### ###
+### This program may also be distributed as part of AFPL ###
+### Ghostscript, under the terms of the Aladdin Free Public License ###
+### (the "License"). ###
+### ###
+### Every copy of AFPL Ghostscript must include a copy of the ###
+### License, normally in a plain ASCII text file named PUBLIC. The ###
+### License grants you the right to copy, modify and redistribute ###
+### AFPL Ghostscript, but only under certain conditions ###
+### described in the License. Among other things, the License ###
+### requires that the copyright notice and this notice be preserved ###
+### on all copies. ###
+### ###
+########################################################################
+########################################################################
+########################################################################
+#
+# [29-Apr-2000]
+#=======================================================================
+
+/^FontName/ { FontName[++NFontName] = $2 }
+
+
+/^C / {
+ if (NFontName == 1)
+ CharName1[$8]++
+ if (NFontName == 2)
+ CharName2[$8]++
+ }
+
+
+/^C / {
+ name = $8
+ if (name in WX)
+ {
+ if (WX[name] != $5)
+ WXDIFF[name] = WX[name] - $5
+ }
+ else
+ WX[name] = $5
+ }
+
+
+/^C / {
+ name = $8
+ bx = $13 - $11
+ if (name in BX)
+ {
+ if (BX[name] != bx)
+ BXDIFF[name] = BX[name] - bx
+ }
+ else
+ BX[name] = bx
+ }
+
+
+/^C / {
+ name = $8
+ by = $14 - $12
+ if (name in BY)
+ {
+ if (BY[name] != by)
+ BYDIFF[name] = BY[name] - by
+ }
+ else
+ BY[name] = by
+ }
+
+
+END {
+ Sortpipe = "sort -f | pr -3 -w80 -l1 -t"
+ print "Comparison of AFM metrics in files:", ARGV[1], ARGV[2]
+ print "Font names:", FontName[1], FontName[2]
+ show_name_diffs(FontName[2],CharName2, FontName[1],CharName1)
+ show_name_diffs(FontName[1],CharName1, FontName[2],CharName2)
+ show_num_diffs("WX width differences", WXDIFF)
+ show_num_diffs("Bounding box width differences", BXDIFF)
+ show_num_diffs("Bounding box height differences",BYDIFF)
+ }
+
+function show_name_diffs(font1,array1,font2,array2, name)
+{
+ print "\nChars from", font2, "missing from", font1 ":"
+ for (name in array2)
+ {
+ if (!(name in array1))
+ printf("%s\n", name) | Sortpipe
+ }
+ close(Sortpipe)
+}
+
+function show_num_diffs(title,array, name)
+{
+ printf("\n%s:\n", title)
+ for (name in array)
+ printf("%-15s\t%4d\n", name, array[name]) | Sortpipe
+ close(Sortpipe)
+}
diff --git a/Master/tlpkg/tlgs/lib/cidfmap b/Master/tlpkg/tlgs/lib/cidfmap
index e70b6afa3ee..8905898db4d 100644
--- a/Master/tlpkg/tlgs/lib/cidfmap
+++ b/Master/tlpkg/tlgs/lib/cidfmap
@@ -1,5 +1,5 @@
%!
-% $Id: cidfmap 44039 2017-04-25 20:52:40Z reinhardk $
+% $Id: $
%
% This file is part of TeX Live.
% Don't edit this file. It will be overwritten by TeX Live updates.
diff --git a/Master/tlpkg/tlgs/lib/cidfmap.TeXLive b/Master/tlpkg/tlgs/lib/cidfmap.TeXLive
index c0bceb4bfcc..d0cda3eeb28 100644
--- a/Master/tlpkg/tlgs/lib/cidfmap.TeXLive
+++ b/Master/tlpkg/tlgs/lib/cidfmap.TeXLive
@@ -1,312 +1,312 @@
-% cidfmap.TeXLive
-% $Id: cidfmap.TeXLive 33323 2014-03-29 23:43:19Z reinhardk $
-
-% This file is part of TeXLive.
-% You may freely use, modify and/or distribute this file.
-
-% Don't edit this file. It will be overwritten by TeX Live updates.
-
-% This file has been composed from cidfmap files created under Windows XP
-% and Windows 7 using tlgs/lib/mkcidfm.ps. It supports fonts provided by
-% Microsoft. Fonts installed by 3rd-party software are not supported.
-% The Japanese IPA fonts which are part of TeX Live are supported too.
-
-% Substitutions
-% =============
-
-% The comments to the right of the semicolon denote availability.
-% Please note that fonts introduced in the listed versions of Windows
-% are also available in later versions.
-
-
-% Chinese, simplified
-% -------------------
-
-/ArialUnicodeMS-GB <<
- /FileType /TrueType
- /SubfontID 0
- /CSI [(GB1) 2]
- /Path (ARIALUNI.TTF) >> ; % W7
-
-/FangSong <<
- /FileType /TrueType
- /SubfontID 0
- /CSI [(GB1) 2]
- /Path (simfang.ttf) >> ; % Vista
-
-/KaiTi <<
- /FileType /TrueType
- /SubfontID 0
- /CSI [(GB1) 2]
- /Path (simkai.ttf) >> ; % Vista
-
-/MicrosoftYaHei <<
- /FileType /TrueType
- /SubfontID 0
- /CSI [(GB1) 2]
- /Path (msyh.ttf) >> ; % Vista
-
-/MicrosoftYaHeiBold <<
- /FileType /TrueType
- /SubfontID 0
- /CSI [(GB1) 2]
- /Path (msyhbd.ttf) >> ; % Vista
-
-/NSimSun <<
- /FileType /TrueType
- /SubfontID 1
- /CSI [(GB1) 2]
- /Path (simsun.ttc) >> ; % XP
-
-/SimHei <<
- /FileType /TrueType
- /SubfontID 0
- /CSI [(GB1) 2]
- /Path (simhei.ttf) >> ; % XP
-
-/SimSun <<
- /FileType /TrueType
- /SubfontID 0
- /CSI [(GB1) 2]
- /Path (simsun.ttc) >> ; % XP
-
-
-% Chinese, traditional
-% --------------------
-
-/ArialUnicodeMS-CNS <<
- /FileType /TrueType
- /SubfontID 0
- /CSI [(CNS1) 2]
- /Path (ARIALUNI.TTF) >> ; % W7
-
-/DFKaiShu-SB-Estd-BF <<
- /FileType /TrueType
- /SubfontID 0
- /CSI [(CNS1) 2]
- /Path (kaiu.ttf) >> ; % Vista
-
-/MicrosoftJhengHeiBold <<
- /FileType /TrueType
- /SubfontID 0
- /CSI [(CNS1) 2]
- /Path (msjhbd.ttf) >> ; % Vista
-
-/MicrosoftJhengHeiRegular <<
- /FileType /TrueType
- /SubfontID 0
- /CSI [(CNS1) 2]
- /Path (msjh.ttf) >> ; % Vista
-
-/MingLiU <<
- /FileType /TrueType
- /SubfontID 0
- /CSI [(CNS1) 2]
- /Path (mingliu.ttc) >> ; % XP
-
-/PMingLiU <<
- /FileType /TrueType
- /SubfontID 1
- /CSI [(CNS1) 2]
- /Path (mingliu.ttc) >> ; % XP
-
-
-% Japanese
-% --------
-
-/ArialUnicodeMS-JP <<
- /FileType /TrueType
- /SubfontID 0
- /CSI [(Japan1) 3]
- /Path (ARIALUNI.TTF) >> ; % W7
-
-/MS-Gothic <<
- /FileType /TrueType
- /SubfontID 0
- /CSI [(Japan1) 3]
- /Path (msgothic.ttc) >> ; % XP
-
-/MS-Mincho <<
- /FileType /TrueType
- /SubfontID 0
- /CSI [(Japan1) 3]
- /Path (msmincho.ttc) >> ; % XP
-
-/MS-PGothic <<
- /FileType /TrueType
- /SubfontID 1
- /CSI [(Japan1) 3]
- /Path (msgothic.ttc) >> ; % XP
-
-/MS-PMincho <<
- /FileType /TrueType
- /SubfontID 1
- /CSI [(Japan1) 3]
- /Path (msmincho.ttc) >> ; % XP
-
-/MS-UI-Gothic <<
- /FileType /TrueType
- /SubfontID 2
- /CSI [(Japan1) 3]
- /Path (msgothic.ttc) >> ; % XP
-
-/Meiryo <<
- /FileType /TrueType
- /SubfontID 0
- /CSI [(Japan1) 3]
- /Path (meiryo.ttc) >> ; % Vista
-
-/Meiryo-Bold <<
- /FileType /TrueType
- /SubfontID 0
- /CSI [(Japan1) 3]
- /Path (meiryob.ttc) >> ; % Vista
-
-/Meiryo-BoldItalic <<
- /FileType /TrueType
- /SubfontID 1
- /CSI [(Japan1) 3]
- /Path (meiryob.ttc) >> ; % Vista
-
-/Meiryo-Italic <<
- /FileType /TrueType
- /SubfontID 1
- /CSI [(Japan1) 3]
- /Path (meiryo.ttc) >> ; % Vista
-
-/IPAexMincho <<
- /FileType /TrueType
- /SubfontID 0
- /CSI [(Japan1) 6]
- /Path (truetype/public/ipaex/ipaexm.ttf) >> ; % TeX Live
-
-/IPAexGothic <<
- /FileType /TrueType
- /SubfontID 0
- /CSI [(Japan1) 6]
- /Path (truetype/public/ipaex/ipaexg.ttf) >> ; % TeX Live
-
-/IPAMincho <<
- /FileType /TrueType
- /SubfontID 0
- /CSI [(Japan1) 6]
- /Path (truetype/public/ipaex/ipam.ttf) >> ; % TeX Live
-
-/IPAGothic <<
- /FileType /TrueType
- /SubfontID 0
- /CSI [(Japan1) 6]
- /Path (truetype/public/ipaex/ipag.ttf) >> ; % TeX Live
-
-
-% Korean
-% ------
-
-/ArialUnicodeMS-KR <<
- /FileType /TrueType
- /SubfontID 0
- /CSI [(Korea1) 3]
- /Path (ARIALUNI.TTF) >> ; % W7
-
-/Batang <<
- /FileType /TrueType
- /SubfontID 0
- /CSI [(Korea1) 3]
- /Path (batang.ttc) >> ; % XP
-
-/BatangChe <<
- /FileType /TrueType
- /SubfontID 1
- /CSI [(Korea1) 3]
- /Path (batang.ttc) >> ; % XP
-
-/Dotum <<
- /FileType /TrueType
- /SubfontID 2
- /CSI [(Korea1) 3]
- /Path (gulim.ttc) >> ; % XP
-
-/DotumChe <<
- /FileType /TrueType
- /SubfontID 3
- /CSI [(Korea1) 3]
- /Path (gulim.ttc) >> ; % XP
-
-/Gulim <<
- /FileType /TrueType
- /SubfontID 0
- /CSI [(Korea1) 3]
- /Path (gulim.ttc) >> ; % XP
-
-/GulimChe <<
- /FileType /TrueType
- /SubfontID 1
- /CSI [(Korea1) 3]
- /Path (gulim.ttc) >> ; % XP
-
-/Gungsuh <<
- /FileType /TrueType
- /SubfontID 2
- /CSI [(Korea1) 3]
- /Path (batang.ttc) >> ; % XP
-
-/GungsuhChe <<
- /FileType /TrueType
- /SubfontID 3
- /CSI [(Korea1) 3]
- /Path (batang.ttc) >> ; % XP
-
-/MalgunGothicBold <<
- /FileType /TrueType
- /SubfontID 0
- /CSI [(Korea1) 3]
- /Path (malgunbd.ttf) >> ; % Vista
-
-/MalgunGothicRegular <<
- /FileType /TrueType
- /SubfontID 0
- /CSI [(Korea1) 3]
- /Path (malgun.ttf) >> ; % Vista
-
-
-% Aliases for Windows XP and later versions
-% =========================================
-
-% Chinese, simplified
-% -------------------
-
-/AdobeHeitiStd-Regular /SimHei ;
-/AdobeSongStd-Light /SimSun ;
-/STFangsong-Light /SimSun ;
-/STHeiti-Regular /SimHei ;
-/STKaiti-Regular /SimHei ;
-/STSong-Light /SimSun ;
-
-% Chinese, traditional
-% --------------------
-
-/AdobeMingStd-Light /MingLiU ;
-/MHei-Medium /MingLiU ;
-/MKai-Medium /MingLiU ;
-/MSung-Light /MingLiU ;
-/MSung-Medium /MingLiU ;
-
-% Japanese
-% --------
-
-/GothicBBB-Medium /MS-Gothic ;
-/HeiseiKakuGo-W5 /MS-Gothic ;
-/HeiseiMin-W3 /MS-Mincho ;
-/KozMinPr6N-Regular /MS-Mincho ;
-/Ryumin-Light /MS-Mincho ;
-/Ryumin-Medium /MS-Mincho ;
-
-% Korean
-% ------
-
-/AdobeMyungjoStd-Medium /Batang ;
-/HYGoThic-Medium /Dotum ;
-/HYRGoThic-Medium /Gulim ;
-/HYSMyeongJo-Medium /Batang ;
-
-%%EOF
+% cidfmap.TeXLive
+% $Id: $
+
+% This file is part of TeXLive.
+% You may freely use, modify and/or distribute this file.
+
+% Don't edit this file. It will be overwritten by TeX Live updates.
+
+% This file has been composed from cidfmap files created under Windows XP
+% and Windows 7 using tlgs/lib/mkcidfm.ps. It supports fonts provided by
+% Microsoft. Fonts installed by 3rd-party software are not supported.
+% The Japanese IPA fonts which are part of TeX Live are supported too.
+
+% Substitutions
+% =============
+
+% The comments to the right of the semicolon denote availability.
+% Please note that fonts introduced in the listed versions of Windows
+% are also available in later versions.
+
+
+% Chinese, simplified
+% -------------------
+
+/ArialUnicodeMS-GB <<
+ /FileType /TrueType
+ /SubfontID 0
+ /CSI [(GB1) 2]
+ /Path (ARIALUNI.TTF) >> ; % W7
+
+/FangSong <<
+ /FileType /TrueType
+ /SubfontID 0
+ /CSI [(GB1) 2]
+ /Path (simfang.ttf) >> ; % Vista
+
+/KaiTi <<
+ /FileType /TrueType
+ /SubfontID 0
+ /CSI [(GB1) 2]
+ /Path (simkai.ttf) >> ; % Vista
+
+/MicrosoftYaHei <<
+ /FileType /TrueType
+ /SubfontID 0
+ /CSI [(GB1) 2]
+ /Path (msyh.ttf) >> ; % Vista
+
+/MicrosoftYaHeiBold <<
+ /FileType /TrueType
+ /SubfontID 0
+ /CSI [(GB1) 2]
+ /Path (msyhbd.ttf) >> ; % Vista
+
+/NSimSun <<
+ /FileType /TrueType
+ /SubfontID 1
+ /CSI [(GB1) 2]
+ /Path (simsun.ttc) >> ; % XP
+
+/SimHei <<
+ /FileType /TrueType
+ /SubfontID 0
+ /CSI [(GB1) 2]
+ /Path (simhei.ttf) >> ; % XP
+
+/SimSun <<
+ /FileType /TrueType
+ /SubfontID 0
+ /CSI [(GB1) 2]
+ /Path (simsun.ttc) >> ; % XP
+
+
+% Chinese, traditional
+% --------------------
+
+/ArialUnicodeMS-CNS <<
+ /FileType /TrueType
+ /SubfontID 0
+ /CSI [(CNS1) 2]
+ /Path (ARIALUNI.TTF) >> ; % W7
+
+/DFKaiShu-SB-Estd-BF <<
+ /FileType /TrueType
+ /SubfontID 0
+ /CSI [(CNS1) 2]
+ /Path (kaiu.ttf) >> ; % Vista
+
+/MicrosoftJhengHeiBold <<
+ /FileType /TrueType
+ /SubfontID 0
+ /CSI [(CNS1) 2]
+ /Path (msjhbd.ttf) >> ; % Vista
+
+/MicrosoftJhengHeiRegular <<
+ /FileType /TrueType
+ /SubfontID 0
+ /CSI [(CNS1) 2]
+ /Path (msjh.ttf) >> ; % Vista
+
+/MingLiU <<
+ /FileType /TrueType
+ /SubfontID 0
+ /CSI [(CNS1) 2]
+ /Path (mingliu.ttc) >> ; % XP
+
+/PMingLiU <<
+ /FileType /TrueType
+ /SubfontID 1
+ /CSI [(CNS1) 2]
+ /Path (mingliu.ttc) >> ; % XP
+
+
+% Japanese
+% --------
+
+/ArialUnicodeMS-JP <<
+ /FileType /TrueType
+ /SubfontID 0
+ /CSI [(Japan1) 3]
+ /Path (ARIALUNI.TTF) >> ; % W7
+
+/MS-Gothic <<
+ /FileType /TrueType
+ /SubfontID 0
+ /CSI [(Japan1) 3]
+ /Path (msgothic.ttc) >> ; % XP
+
+/MS-Mincho <<
+ /FileType /TrueType
+ /SubfontID 0
+ /CSI [(Japan1) 3]
+ /Path (msmincho.ttc) >> ; % XP
+
+/MS-PGothic <<
+ /FileType /TrueType
+ /SubfontID 1
+ /CSI [(Japan1) 3]
+ /Path (msgothic.ttc) >> ; % XP
+
+/MS-PMincho <<
+ /FileType /TrueType
+ /SubfontID 1
+ /CSI [(Japan1) 3]
+ /Path (msmincho.ttc) >> ; % XP
+
+/MS-UI-Gothic <<
+ /FileType /TrueType
+ /SubfontID 2
+ /CSI [(Japan1) 3]
+ /Path (msgothic.ttc) >> ; % XP
+
+/Meiryo <<
+ /FileType /TrueType
+ /SubfontID 0
+ /CSI [(Japan1) 3]
+ /Path (meiryo.ttc) >> ; % Vista
+
+/Meiryo-Bold <<
+ /FileType /TrueType
+ /SubfontID 0
+ /CSI [(Japan1) 3]
+ /Path (meiryob.ttc) >> ; % Vista
+
+/Meiryo-BoldItalic <<
+ /FileType /TrueType
+ /SubfontID 1
+ /CSI [(Japan1) 3]
+ /Path (meiryob.ttc) >> ; % Vista
+
+/Meiryo-Italic <<
+ /FileType /TrueType
+ /SubfontID 1
+ /CSI [(Japan1) 3]
+ /Path (meiryo.ttc) >> ; % Vista
+
+/IPAexMincho <<
+ /FileType /TrueType
+ /SubfontID 0
+ /CSI [(Japan1) 6]
+ /Path (truetype/public/ipaex/ipaexm.ttf) >> ; % TeX Live
+
+/IPAexGothic <<
+ /FileType /TrueType
+ /SubfontID 0
+ /CSI [(Japan1) 6]
+ /Path (truetype/public/ipaex/ipaexg.ttf) >> ; % TeX Live
+
+/IPAMincho <<
+ /FileType /TrueType
+ /SubfontID 0
+ /CSI [(Japan1) 6]
+ /Path (truetype/public/ipaex/ipam.ttf) >> ; % TeX Live
+
+/IPAGothic <<
+ /FileType /TrueType
+ /SubfontID 0
+ /CSI [(Japan1) 6]
+ /Path (truetype/public/ipaex/ipag.ttf) >> ; % TeX Live
+
+
+% Korean
+% ------
+
+/ArialUnicodeMS-KR <<
+ /FileType /TrueType
+ /SubfontID 0
+ /CSI [(Korea1) 3]
+ /Path (ARIALUNI.TTF) >> ; % W7
+
+/Batang <<
+ /FileType /TrueType
+ /SubfontID 0
+ /CSI [(Korea1) 3]
+ /Path (batang.ttc) >> ; % XP
+
+/BatangChe <<
+ /FileType /TrueType
+ /SubfontID 1
+ /CSI [(Korea1) 3]
+ /Path (batang.ttc) >> ; % XP
+
+/Dotum <<
+ /FileType /TrueType
+ /SubfontID 2
+ /CSI [(Korea1) 3]
+ /Path (gulim.ttc) >> ; % XP
+
+/DotumChe <<
+ /FileType /TrueType
+ /SubfontID 3
+ /CSI [(Korea1) 3]
+ /Path (gulim.ttc) >> ; % XP
+
+/Gulim <<
+ /FileType /TrueType
+ /SubfontID 0
+ /CSI [(Korea1) 3]
+ /Path (gulim.ttc) >> ; % XP
+
+/GulimChe <<
+ /FileType /TrueType
+ /SubfontID 1
+ /CSI [(Korea1) 3]
+ /Path (gulim.ttc) >> ; % XP
+
+/Gungsuh <<
+ /FileType /TrueType
+ /SubfontID 2
+ /CSI [(Korea1) 3]
+ /Path (batang.ttc) >> ; % XP
+
+/GungsuhChe <<
+ /FileType /TrueType
+ /SubfontID 3
+ /CSI [(Korea1) 3]
+ /Path (batang.ttc) >> ; % XP
+
+/MalgunGothicBold <<
+ /FileType /TrueType
+ /SubfontID 0
+ /CSI [(Korea1) 3]
+ /Path (malgunbd.ttf) >> ; % Vista
+
+/MalgunGothicRegular <<
+ /FileType /TrueType
+ /SubfontID 0
+ /CSI [(Korea1) 3]
+ /Path (malgun.ttf) >> ; % Vista
+
+
+% Aliases for Windows XP and later versions
+% =========================================
+
+% Chinese, simplified
+% -------------------
+
+/AdobeHeitiStd-Regular /SimHei ;
+/AdobeSongStd-Light /SimSun ;
+/STFangsong-Light /SimSun ;
+/STHeiti-Regular /SimHei ;
+/STKaiti-Regular /SimHei ;
+/STSong-Light /SimSun ;
+
+% Chinese, traditional
+% --------------------
+
+/AdobeMingStd-Light /MingLiU ;
+/MHei-Medium /MingLiU ;
+/MKai-Medium /MingLiU ;
+/MSung-Light /MingLiU ;
+/MSung-Medium /MingLiU ;
+
+% Japanese
+% --------
+
+/GothicBBB-Medium /MS-Gothic ;
+/HeiseiKakuGo-W5 /MS-Gothic ;
+/HeiseiMin-W3 /MS-Mincho ;
+/KozMinPr6N-Regular /MS-Mincho ;
+/Ryumin-Light /MS-Mincho ;
+/Ryumin-Medium /MS-Mincho ;
+
+% Korean
+% ------
+
+/AdobeMyungjoStd-Medium /Batang ;
+/HYGoThic-Medium /Dotum ;
+/HYRGoThic-Medium /Gulim ;
+/HYSMyeongJo-Medium /Batang ;
+
+%%EOF
diff --git a/Master/tlpkg/tlgs/lib/gslp.ps b/Master/tlpkg/tlgs/lib/gslp.ps
index 173d52c2170..9a3a2f3e630 100644
--- a/Master/tlpkg/tlgs/lib/gslp.ps
+++ b/Master/tlpkg/tlgs/lib/gslp.ps
@@ -38,10 +38,13 @@
% --detect
% treat the file as PostScript if it starts with %!
% --first-page <n>
-% --duplex(|-long-edge|-short-edge)
-% use duplex if available; if not specified, select long edge
-% for portrait printing, short edge for landscape
+% --duplex(|-long-edge|-short-edge)
+% use duplex if available; if not specified, select long edge
+% for portrait printing, short edge for landscape
% start printing at page <n>
+% --encoding <encodingname> default ISOLatin1Encoding
+% Note this only takes effect during -f or -F option thus the
+% body text and header text can use different encodings.
% --kern <file.afm>
% kern using information from the given .AFM file
% --last-page <n>
@@ -60,17 +63,26 @@
/lpdict 150 dict def
lpdict begin
-% build iso-latin-1 version of a font
-/font-to-iso-latin-1 { % <font> font-to-iso-latin-1 <font>
+/encoding /ISOLatin1Encoding def % the default encoding
+
+% build a version of the font with the requested encoding (default ISOLatin1)
+/font-to-encoding { % <font> font-to-encoding <font>
%% reencode for iso latin1; from the 2nd edition red book, sec 5.6.1
dup length dict begin {1 index /FID ne {def} {pop pop} ifelse} forall
- /Encoding ISOLatin1Encoding def currentdict end
- dup /FontName get 80 string cvs (-ISOLatin1) concatstrings cvn
+ /Encoding encoding /Encoding findresource readonly def
+ currentdict end
+ % strip off the "Encoding" part of the encoding (if present)
+ dup /FontName get 80 string cvs
+ encoding 256 string cvs (Encoding) search {
+ exch pop exch pop
+ } if
+ exch (-) concatstrings exch
+ concatstrings cvn
exch definefont
} def
/find-latin-font { % <name> find-latin-font <font>
- findfont font-to-iso-latin-1
+ findfont font-to-encoding
} def
% Define the initial values of the printing parameters.
@@ -275,14 +287,17 @@ lpdict begin
/StringTAB (\t) def
/CharTAB StringTAB 0 get def
-/showline % line -> leftover_line (handles \f)
- { { showline1 dup length 0 eq { exit } if
- dup 0 get CharFF ne { exit } if
+/showline { % line -> leftover_line (handles \f)
+ { showline1 dup length 0 eq { exit } if
+ dup 0 get CharFF ne {
+ Truncate { pop () } if
+ exit
+ } if
EjectFF { endpage beginpage } { endcolumn } ifelse
skip1
- }
+ }
loop
- } def
+} def
/showline1 % line -> leftover_line (handles page break)
{ lindex llength eq { endpage beginpage } if
@@ -409,9 +424,9 @@ lpdict begin
/S {currentfile =string readline pop show} lpdef
/RE { % <isoname> <fontname> RE <font>
findfont
- %% reencode for iso latin1; from the 2nd edition red book, sec 5.6.1
+ %% reencode for current 'encoding' from the 2nd edition red book, sec 5.6.1
dup length dict begin {1 index /FID ne {def} {pop pop} ifelse} forall
- /Encoding ISOLatin1Encoding def currentdict end
+ /Encoding encoding def currentdict end
definefont
} lpdef
} def
@@ -506,24 +521,31 @@ lpdict begin
% Iterate through the file.
lpline
- { dup length /pos exch def
- lbuf exch 0 exch putinterval
- { lpfile lbuf pos lbuf length pos sub getinterval readline } stopped
- { % Filled the line before a CR or EOF.
- exch pop showline
- }
- { % Reached CR and/or EOF first.
+ % First handle new-lines in the initial string (--detect mode)
+ (\n) search {
+ showline % output up to the first new-line
+ pop pop % done with that string and the new-line
+ (\n) search {
+ showline % output the second new-line
+ pop pop % done
+ } if
+ } if
+ { dup length /pos exch def
+ lbuf exch 0 exch putinterval
+ { lpfile lbuf pos lbuf length pos sub getinterval readline } stopped
+ { % Filled the line before a CR or EOF.
+ exch pop showline
+ }
+ { % Reached CR and/or EOF first.
exch length pos add lbuf exch 0 exch getinterval
1 index { showline } if % omit final empty line
- { dup length 0 eq Truncate or { pop () exit } if
+ { dup length 0 eq { pop () exit } if
showline
- }
- loop
+ } loop
exch not { exit } if
- }
- ifelse
+ } ifelse
pindex PageLast gt { exit } if
- } loop
+ } loop
pop
% Wrap up.
@@ -588,6 +610,7 @@ lpdict begin
/--duplex { /Duplex {Landscape} def } def
/--duplex-long-edge { /Duplex false def } def
/--duplex-short-edge { /Duplex true def } def
+/--encoding { cvn /encoding exch def } def
/--first-page { cvi /PageFirst exch def } def
/--footing-center { /FootingCenter exch def /Footers true def } def
/--footing-left { /FootingLeft exch def /Footers true def } def
diff --git a/Master/tlpkg/tlgs/lib/viewgif.ps b/Master/tlpkg/tlgs/lib/viewgif.ps
index a261bf7e654..0426e2f46c0 100644
--- a/Master/tlpkg/tlgs/lib/viewgif.ps
+++ b/Master/tlpkg/tlgs/lib/viewgif.ps
@@ -42,7 +42,9 @@
GlobalColor
{ PaletteSize 3 mul string readstring pop
/GlobalPalette exch def
- } if
+ } {
+ pop
+ } ifelse
currentdict end
} bind def
@@ -159,7 +161,7 @@
} bind def
% This lets you do stuff on the command line like:
-% gs -sDEVICE=pdfwrite -o stuff%03d.pdf viewgif.ps -c "(image.gif) << /PageSize 2 index viewGIFgetsize 2 array astore >> setpagedevice viewGIF"
+% gs -sDEVICE=pdfwrite -o stuff%03d.pdf viewgif.ps -c "(image.gif) << /PageSize 2 index viewGIFgetsize 2 array astore /HWResolution [ 72 72 ] >> setpagedevice viewGIF"
% so the output size is influenced by the original image.
/viewGIFgetsize % <file|string> ==> [width height]
{
diff --git a/Master/tlpkg/tlgs/lib/zugferd.ps b/Master/tlpkg/tlgs/lib/zugferd.ps
index 0320fb69e8e..97d33d4d2b4 100644
--- a/Master/tlpkg/tlgs/lib/zugferd.ps
+++ b/Master/tlpkg/tlgs/lib/zugferd.ps
@@ -1,3 +1,5 @@
+%!PS
+
% Copyright (C) 2001-2021 Artifex Software, Inc.
% All Rights Reserved.
%
@@ -12,38 +14,68 @@
% Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato,
% CA 94945, U.S.A., +1(415)492-9861, for further information.
%
-% zugferd.ps
-% This program will create an (unsigned) ZUGFeRD compliant PDF file. In
-% order to do so the user must provide certain information, or edit this program.
+% ZUGFeRD.ps
+% This program will create an (unsigned) ZUGFeRD compliant PDF file.
+% In order to do so the user must provide certain information, or edit
+% this program.
+%
+% Required information is the path to the XML file containing the invoice
+% data, and the path to an ICC profile appropriate for the chosen
+% ColorConversionStrategy.
+%
+% -sZUGFeRDXMLFile defines a path to the XML invoice file.
+%
+% -sZUGFeRDProfile defines the path to the ICC profile.
+%
+% -sZUGFeRDVersion defines the version of the ZUGFeRD standard to be used.
+% Missing or invalid values would be silently replaced by the default ("2p1").
+%
+% -sZUGFeRDConformanceLevel defines the level of conformance.
+% Missing or invalid values would be silently replaced by the default ("BASIC").
%
-% Required information is the path to the XML file containing the invoice data,
-% and the path to an ICC profile appropriate for the chosen ColorConversionStrategy.
-% -sZUGFeRDXMLFile defines a path to the XML invoice file and -sZUGFeRDProfile
-% defines the path to the ICC profile.
+% Note that the ZUGFeRD standard states:
%
-% The user must additionally set -dPDFA=3 and -sColorConversionStrategy on the
-% Ghostscript command line, and set the permissions for Ghostscript to read
-% both these files. It is simplest to put the files in a directory and then
-% permit reading of the entire directory.
+% The content of the field fx:ConformanceLevel has to be picked from
+% the content of the element "GuidelineSpecifiedDocumentContextParameter"
+% (specification identifier BT-24) of the XML instance file.
+%
+% The user must additionally set -dPDFA=3 and -sColorConversionStrategy
+% on the Ghostscript command line, and set the permissions for Ghostscript
+% to read both these files. It is simplest to put the files in a directory
+% and then permit reading of the entire directory.
%
% Example command line :
%
-% gs --permit-file-read=/usr/home/me/zugferd/ -sDEVICE=pdfwrite -dPDFA=3 -sColorConversionStrategy=RGB \
-% -sZUGFeRDXMLFile=/usr/home/me/zugferd/invoice.xml -sZUGFeRDProfile=/usr/home/me/rgb.icc \
-% -o /usr/home/me/zugferd/zugferd.pdf /usr/home/me/zugferd/zugferd.ps /usr/home/me/zugferd/original.pdf
+% gs --permit-file-read=/usr/home/me/zugferd/ \
+% -sDEVICE=pdfwrite \
+% -dPDFA=3 \
+% -sColorConversionStrategy=RGB \
+% -sZUGFeRDXMLFile=/usr/home/me/zugferd/invoice.xml \
+% -sZUGFeRDProfile=/usr/home/me/zugferd/rgb.icc \
+% -sZUGFeRDVersion=2p1 \
+% -sZUGFeRDConformanceLevel=BASIC \
+% -o /usr/home/me/zugferd/zugferd.pdf \
+% /usr/home/me/zugferd/zugferd.ps \
+% /usr/home/me/zugferd/original.pdf
%
-% Much of this program results from a Ghostscript bug report, the thread can be found at
-% https://bugs.ghostscript.com/show_bug.cgi?id=696472 Portions of the code below were
-% supplied by Reinhard Nissl and I'm indebted to him for his efforts in helping me create
-% a solution for this problem as well as for the code he supplied, particularly for the
+% Much of this program results from a Ghostscript bug report, the thread
+% can be found at
+% https://bugs.ghostscript.com/show_bug.cgi?id=696472
+% Portions of the code below were supplied by Reinhard Nissl and
+% I'm indebted to him for his efforts in helping me create a solution for
+% this problem as well as for the code he supplied, particularly for the
% SimpleUTF16BE routine.
%
-% It should not be necessary to modify this program, the comments in the code are there purely for information,
-% but there are two areas which might reasonably be altered. The section with the --8<-- lines could be replaced
-% with a simpler /N 3 or /N 4 if you always intend to produce the same kind of files; RGB or CMYK.
-% In step 7, the large XML string will need to be replaced if you want to produce a ZUGFeRD 2.1
-% file, and in future may require similar modification for later versions.
+% The program was further refined and expanded by Adrian Devries in :
+% https://bugs.ghostscript.com/show_bug.cgi?id=703862
+%
+% It should not be necessary to modify this program, the comments in the
+% code are there purely for information, but there is one area which
+% might reasonably be altered. The section with the --8<-- lines could be
+% replaced with a simpler /N 3 or /N 4 if you always intend to produce
+% the same kind of files; RGB or CMYK.
%
+% Remaining tasks have been marked with "TODO".
% istring SimpleUTF16BE ostring
/SimpleUTF16BE
@@ -52,13 +84,11 @@
1 add
2 mul
string
-
% istring ostring
dup 0 16#FE put
dup 1 16#FF put
2
3 -1 roll
-
% ostring index istring
{
% ostring index ichar
@@ -74,12 +104,246 @@
% ostring index
}
forall
-
% ostring index
pop
}
bind def
+% Cf. https://en.wikibooks.org/wiki/PostScript_FAQ#How_to_concatenate_strings%3F
+/concatstringarray { % [(a) (b) ... (z)] --> (ab...z)
+ 0 1 index {
+ length add
+ } forall
+ string
+ 0 3 2 roll {
+ 3 copy putinterval
+ length add
+ } forall
+ pop
+} bind def
+
+/ZUGFeRDVersion where {
+ pop % Discard the dictionary
+ ZUGFeRDVersion (rc) ne {
+ ZUGFeRDVersion (1p0) ne {
+ ZUGFeRDVersion (2p0) ne {
+ ZUGFeRDVersion (2p1) ne {
+ /ZUGFeRDVersion (2p1) def
+ } if
+ } if
+ } if
+ } if
+}{
+ /ZUGFeRDVersion (2p1) def
+} ifelse
+
+/ZUGFeRDConformanceLevel where {
+ pop % Discard the dictionary
+ ZUGFeRDVersion (rc) eq
+ ZUGFeRDVersion (1p0) eq or {
+ ZUGFeRDConformanceLevel (BASIC) ne {
+ ZUGFeRDConformanceLevel (COMFORT) ne {
+ ZUGFeRDConformanceLevel (EXTENDED) ne {
+ /ZUGFeRDConformanceLevel (BASIC) def
+ } if
+ } if
+ } if
+ } if
+ ZUGFeRDVersion (2p0) eq
+ ZUGFeRDVersion (2p1) eq or {
+ ZUGFeRDConformanceLevel (MINIMUM) ne {
+ ZUGFeRDConformanceLevel (BASIC WL) ne {
+ ZUGFeRDConformanceLevel (BASIC) ne {
+ ZUGFeRDConformanceLevel (EN 16931) ne {
+ ZUGFeRDConformanceLevel (EXTENDED) ne {
+ ZUGFeRDConformanceLevel (XRECHNUNG) ne {
+ /ZUGFeRDConformanceLevel (BASIC) def
+ } if
+ } if
+ } if
+ } if
+ } if
+ } if
+ } if
+}{
+ /ZUGFeRDConformanceLevel (BASIC) def
+} ifelse
+
+% ZUGFeRDSchema
+/ZUGFeRDSchema () def
+ZUGFeRDVersion (rc) eq
+ZUGFeRDVersion (1p0) eq or
+ZUGFeRDVersion (2p0) eq or {
+ /ZUGFeRDSchema (ZUGFeRD PDFA Extension Schema) def
+} if
+ZUGFeRDVersion (2p1) eq {
+ /ZUGFeRDSchema (Factur-X PDFA Extension Schema) def
+} if
+
+% ZUGFeRDNamespaceURI
+/ZUGFeRDNamespaceURI () def
+ZUGFeRDVersion (rc) eq {
+ /ZUGFeRDNamespaceURI (urn:ferd:pdfa:invoice:rc#) def
+} if
+ZUGFeRDVersion (1p0) eq {
+ /ZUGFeRDNamespaceURI (urn:ferd:pdfa:CrossIndustryDocument:invoice:1p0#) def
+} if
+ZUGFeRDVersion (2p0) eq {
+ /ZUGFeRDNamespaceURI (urn:zugferd:pdfa:CrossIndustryDocument:invoice:2p0#) def
+} if
+ZUGFeRDVersion (2p1) eq {
+ /ZUGFeRDNamespaceURI (urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#) def
+} if
+
+% ZUGFeRDPrefix
+/ZUGFeRDPrefix () def
+ZUGFeRDVersion (rc) eq
+ZUGFeRDVersion (1p0) eq or
+ZUGFeRDVersion (2p0) eq or {
+ /ZUGFeRDPrefix (zf) def
+} if
+ZUGFeRDVersion (2p1) eq {
+ /ZUGFeRDPrefix (fx) def
+} if
+
+% ZUGFeRDVersionDescription
+/ZUGFeRDVersionDescription () def
+ZUGFeRDVersion (rc) eq
+ZUGFeRDVersion (1p0) eq or
+ZUGFeRDVersion (2p0) eq or {
+ /ZUGFeRDVersionDescription (The actual version of the ZUGFeRD XML schema) def
+} if
+ZUGFeRDVersion (2p1) eq {
+ /ZUGFeRDVersionDescription (The actual version of the Factur-X XML schema) def
+} if
+
+% ZUGFeRDConformanceLevelDescription
+/ZUGFeRDConformanceLevelDescription () def
+ZUGFeRDVersion (rc) eq
+ZUGFeRDVersion (1p0) eq or
+ZUGFeRDVersion (2p0) eq or {
+ /ZUGFeRDConformanceLevelDescription (The conformance level of the embedded ZUGFeRD data) def
+} if
+ZUGFeRDVersion (2p1) eq {
+ /ZUGFeRDConformanceLevelDescription (The conformance level of the embedded Factur-X data) def
+} if
+
+% ZUGFeRDDocumentFileName
+/ZUGFeRDDocumentFileName () def
+ZUGFeRDVersion (rc) eq {
+ /ZUGFeRDDocumentFileName (ZUGFeRD-invoice.xml) def
+} if
+ZUGFeRDVersion (1p0) eq {
+ /ZUGFeRDDocumentFileName (ZUGFeRD-invoice.xml) def
+} if
+ZUGFeRDVersion (2p0) eq {
+ ZUGFeRDConformanceLevel (XRECHNUNG) ne {
+ /ZUGFeRDDocumentFileName (zugferd-invoice.xml) def
+ }{
+ /ZUGFeRDDocumentFileName (xrechnung.xml) def
+ } ifelse
+} if
+ZUGFeRDVersion (2p1) eq {
+ ZUGFeRDConformanceLevel (XRECHNUNG) ne {
+ /ZUGFeRDDocumentFileName (factur-x.xml) def
+ }{
+ /ZUGFeRDDocumentFileName (xrechnung.xml) def
+ } ifelse
+} if
+
+% ZUGFeRDVersionData
+/ZUGFeRDVersionData () def
+ZUGFeRDVersion (rc) eq {
+ /ZUGFeRDVersionData (RC) def
+} if
+ZUGFeRDVersion (1p0) eq {
+ /ZUGFeRDVersionData (1.0) def
+} if
+ZUGFeRDVersion (2p0) eq {
+ ZUGFeRDConformanceLevel (XRECHNUNG) ne {
+ /ZUGFeRDVersionData (2p0) def
+ }{
+ /ZUGFeRDVersionData (1p2) def
+ } ifelse
+} if
+ZUGFeRDVersion (2p1) eq {
+ ZUGFeRDConformanceLevel (XRECHNUNG) ne {
+ /ZUGFeRDVersionData (1.0) def
+ }{
+ /ZUGFeRDVersionData (1p2) def
+ } ifelse
+} if
+
+/ZUGFeRDMetadata [
+(
+<rdf:Description)
+( xmlns:pdfaExtension="http://www.aiim.org/pdfa/ns/extension/")
+( xmlns:pdfaProperty="http://www.aiim.org/pdfa/ns/property#")
+( xmlns:pdfaSchema="http://www.aiim.org/pdfa/ns/schema#")
+( rdf:about="">
+ <pdfaExtension:schemas>
+ <rdf:Bag>
+ <rdf:li rdf:parseType="Resource">
+ <pdfaSchema:schema>)ZUGFeRDSchema(</pdfaSchema:schema>
+ <pdfaSchema:namespaceURI>)ZUGFeRDNamespaceURI(</pdfaSchema:namespaceURI>
+ <pdfaSchema:prefix>)ZUGFeRDPrefix(</pdfaSchema:prefix>
+ <pdfaSchema:property>
+ <rdf:Seq>
+ <rdf:li rdf:parseType="Resource">
+ <pdfaProperty:name>DocumentFileName</pdfaProperty:name>
+ <pdfaProperty:valueType>Text</pdfaProperty:valueType>
+ <pdfaProperty:category>external</pdfaProperty:category>
+ <pdfaProperty:description>Name of the embedded XML invoice file</pdfaProperty:description>
+ </rdf:li>
+ <rdf:li rdf:parseType="Resource">
+ <pdfaProperty:name>DocumentType</pdfaProperty:name>
+ <pdfaProperty:valueType>Text</pdfaProperty:valueType>
+ <pdfaProperty:category>external</pdfaProperty:category>
+ <pdfaProperty:description>INVOICE</pdfaProperty:description>
+ </rdf:li>
+ <rdf:li rdf:parseType="Resource">
+ <pdfaProperty:name>Version</pdfaProperty:name>
+ <pdfaProperty:valueType>Text</pdfaProperty:valueType>
+ <pdfaProperty:category>external</pdfaProperty:category>
+ <pdfaProperty:description>)ZUGFeRDVersionDescription(</pdfaProperty:description>
+ </rdf:li>
+ <rdf:li rdf:parseType="Resource">
+ <pdfaProperty:name>ConformanceLevel</pdfaProperty:name>
+ <pdfaProperty:valueType>Text</pdfaProperty:valueType>
+ <pdfaProperty:category>external</pdfaProperty:category>
+ <pdfaProperty:description>)ZUGFeRDConformanceLevelDescription(</pdfaProperty:description>
+ </rdf:li>
+ </rdf:Seq>
+ </pdfaSchema:property>
+ </rdf:li>
+ </rdf:Bag>
+ </pdfaExtension:schemas>
+</rdf:Description>
+<rdf:Description xmlns:)ZUGFeRDPrefix(=")ZUGFeRDNamespaceURI(" rdf:about="">
+ <)ZUGFeRDPrefix(:ConformanceLevel>)ZUGFeRDConformanceLevel(</)ZUGFeRDPrefix(:ConformanceLevel>
+ <)ZUGFeRDPrefix(:DocumentFileName>)ZUGFeRDDocumentFileName(</)ZUGFeRDPrefix(:DocumentFileName>
+ <)ZUGFeRDPrefix(:DocumentType>INVOICE</)ZUGFeRDPrefix(:DocumentType>
+ <)ZUGFeRDPrefix(:Version>)ZUGFeRDVersionData(</)ZUGFeRDPrefix(:Version>
+</rdf:Description>
+)
+ ] concatstringarray def
+
+/Usage {
+ (example usage: \n) print
+ ( gs --permit-file-read=/usr/home/me/zugferd/ \\\n) print
+ ( -sDEVICE=pdfwrite \\\n) print
+ ( -dPDFA=3 \\\n) print
+ ( -sColorConversionStrategy=RGB \\\n) print
+ ( -sZUGFeRDXMLFile=/usr/home/me/zugferd/invoice.xml \\\n) print
+ ( -sZUGFeRDProfile=/usr/home/me/zugferd\rgb.icc \\\n) print
+ ( -sZUGFeRDVersion=2p1 \\\n) print
+ ( -sZUGFeRDConformanceLevel=BASIC \\\n) print
+ ( -o /usr/home/me/zugferd/zugferd.pdf \\\n) print
+ ( /usr/home/me/zugferd/zugferd.ps \\\n) print
+ ( /usr/home/me/zugferd/original.pdf \n) print
+ flush
+} def
+
% First check that the user has defined the XML invoice file on the command line
%
/ZUGFeRDXMLFile where {
@@ -90,7 +354,9 @@ bind def
/ZUGFeRDProfile where {
pop % Discard the dictionary
- % Step 1, add the required PDF/A boilerplate. This is mostly copied from lib/pdfa_de.ps
+ % Step 1, add the required PDF/A boilerplate.
+ % This is mostly copied from lib/pdfa_def.ps
+
% Create a PDF stream object to hold the ICC profile.
[ /_objdef {icc_PDFA} /type /stream /OBJ pdfmark
@@ -157,45 +423,43 @@ bind def
/Type /OutputIntent
/S /GTS_PDFA1 % Required for PDF/A.
/DestOutputProfile {icc_PDFA} % The actual profile.
- /OutputConditionIdentifier (Custom) % A better solution is a string from the ICC Registry, but Custom is always valid.
+ /OutputConditionIdentifier (Custom) % TODO: A better solution is a
+ % a string from the ICC
+ % Registry, but Custom
+ % is always valid.
>> /PUT pdfmark
% And now add the OutputIntent to the Catalog dictionary
[ {Catalog} << /OutputIntents [ {OutputIntent_PDFA} ]>> /PUT pdfmark
-
% Step 2, define the XML file and read it into the PDF
% First we define the PDF stream to contain the XML invoice
[ /_objdef {InvoiceStream} /type /stream /OBJ pdfmark
-
% Fill in the dictionary elements we need. We believe the
% ModDate is not useful so it's just set to a valid value.
[ {InvoiceStream} <<
- /Type /EmbeddedFile
- /Subtype (text/xml) cvn
+ /Type /EmbeddedFile
+ /Subtype (text/xml) cvn
+ % TODO: Determine file length, and add /Length entry
/Params <<
- /ModDate (D:20130121081433+01’00’)
+ /ModDate (D:20130121081433+01'00') % TODO: Determine file date.
>>
>> /PUT pdfmark
-
% Now read the data from the file and store it in the stream
[ {InvoiceStream} ZUGFeRDXMLFile (r) file /PUT pdfmark
-
% and close the stream
[ {InvoiceStream} /CLOSE pdfmark
-
% Step 3 create the File Specification dictionary for the embedded file
% Create the dictionary
[ /_objdef {FSDict} /type /dict /OBJ pdfmark
-
% Fill in the required dictionary elements
[ {FSDict} <<
/Type /FileSpec
- /F ZUGFeRDXMLFile
- /UF ZUGFeRDXMLFile SimpleUTF16BE
+ /F ZUGFeRDDocumentFileName
+ /UF ZUGFeRDDocumentFileName SimpleUTF16BE
/Desc (ZUGFeRD electronic invoice)
- /AFRelationship /Alternative
+ /AFRelationship /Alternative
/EF <<
/F {InvoiceStream}
/UF {InvoiceStream}
@@ -203,114 +467,38 @@ bind def
>>
/PUT pdfmark
-
% Step 4 Create the Associated Files dictionary to hold the FS dict
% Create the dictionary
[ /_objdef {AFArray} /type /array /OBJ pdfmark
-
% Put (append) the FS dictionary into the Associated Files array
[ {AFArray} {FSDict} /APPEND pdfmark
-
% Step 5 Add an entry in the Catalog dictionary containing the AF array
[ {Catalog} << /AF {AFArray} >> /PUT pdfmark
-
% Step 6 use the EMBED pdfmark to add the XML file and FS dictionary to the PDF name tree
- [ /Name ZUGFeRDXMLFile /FS {FSDict} /EMBED pdfmark
-
+ [ /Name ZUGFeRDDocumentFileName /FS {FSDict} /EMBED pdfmark
% Step 7 Add the extra ZUGFeRD XML data to the Metadata
- [ /XML
-(
- <!-- XMP extension schema container for the zugferd schema -->
- <rdf:Description rdf:about=""
- xmlns:pdfaExtension="http://www.aiim.org/pdfa/ns/extension/"
- xmlns:pdfaSchema="http://www.aiim.org/pdfa/ns/schema#"
- xmlns:pdfaProperty="http://www.aiim.org/pdfa/ns/property#">
-
- <!-- Container for all embedded extension schema descriptions -->
- <pdfaExtension:schemas>
- <rdf:Bag>
- <rdf:li rdf:parseType="Resource">
- <!-- Optional description of schema -->
- <pdfaSchema:schema>ZUGFeRD PDFA Extension Schema</pdfaSchema:schema>
- <!-- Schema namespace URI -->
- <pdfaSchema:namespaceURI>urn:ferd:pdfa:invoice:rc#</pdfaSchema:namespaceURI>
- <!-- Preferred schema namespace prefix -->
- <pdfaSchema:prefix>zf</pdfaSchema:prefix>
-
- <!-- Description of schema properties -->
- <pdfaSchema:property>
- <rdf:Seq>!
- <rdf:li rdf:parseType="Resource">
- <!-- DocumentFileName: Name of the embedded file;
- must be equal with the value of the /F tag in the /EF
- structure -->
- <pdfaProperty:name>DocumentFileName</pdfaProperty:name>
- <pdfaProperty:valueType>Text</pdfaProperty:valueType>
- <pdfaProperty:category>external</pdfaProperty:category>
- <pdfaProperty:description>name of the embedded xml invoice file</pdfaProperty:description>
- </rdf:li>
- <rdf:li rdf:parseType="Resource">
- <!-- DocumentType: INVOICE -->
- <pdfaProperty:name>DocumentType</pdfaProperty:name>
- <pdfaProperty:valueType>Text</pdfaProperty:valueType>
- <pdfaProperty:category>external</pdfaProperty:category>
- <pdfaProperty:description>INVOICE</pdfaProperty:description>
- </rdf:li>
- <rdf:li rdf:parseType="Resource">
- <!-- Version: The actual version of the
- ZUGFeRD standard -->
- <pdfaProperty:name>Version</pdfaProperty:name>
- <pdfaProperty:valueType>Text</pdfaProperty:valueType>
- <pdfaProperty:category>external</pdfaProperty:category>
- <pdfaProperty:description>The actual version of the ZUGFeRD data</pdfaProperty:description>
- </rdf:li>
- <rdf:li rdf:parseType="Resource">
- <!-- ConformanceLevel: The actual conformance
- level of the ZUGFeRD standard,
- e.g. BASIC, COMFORT, EXTENDED -->
- <pdfaProperty:name>ConformanceLevel</pdfaProperty:name>
- <pdfaProperty:valueType>Text</pdfaProperty:valueType>
- <pdfaProperty:category>external</pdfaProperty:category>
- <pdfaProperty:description>The conformance level of the ZUGFeRD data</pdfaProperty:description>
- </rdf:li>
- </rdf:Seq>
- </pdfaSchema:property>
- </rdf:li>
- </rdf:Bag>
- </pdfaExtension:schemas>
- </rdf:Description>
-
- <rdf:Description rdf:about="" xmlns:zf="urn:ferd:pdfa:invoice:rc#">
- <zf:DocumentType>INVOICE</zf:DocumentType>
- <zf:DocumentFileName>ZUGFeRD-invoice.xml</zf:DocumentFileName>
- <zf:Version>RC</zf:Version>
- <zf:ConformanceLevel>BASIC</zf:ConformanceLevel>
- </rdf:Description>
-) /Ext_Metadata pdfmark
+ [ /XML ZUGFeRDMetadata /Ext_Metadata pdfmark
}
{
- % No ICC Profile definition on the command line; chide the user and give them an example
- %
- (\nERROR - ZUGFeRDProfile has not been supplied, you must supply an ICC profile\n) print
- ( Producing a potentially invalid PDF/A file!!\n) print
- (example usage - gs --permit-file-read=/usr/home/me/zugferd/ -sDEVICE=pdfwrite -dPDFA=3\\\n) print
- ( -sColorConversionStrategy=RGB -sZUGFeRDXMLFile=/usr/home/me/zugferd/invoice.xml\\\n) print
- ( -sZUGFeRDProfile=/usr/home/me/rgb.icc -o /usr/home/me/zugferd/zugferd.pdf\\\n) print
- ( /usr/home/me/zugferd/zugferd.ps /usr/home/me/zugferd/original.pdf\n\n) print flush
+ % No ICC Profile definition on the command line;
+ % chide the user and give them an example
+ (\nERROR - ZUGFeRDProfile has not been supplied, you must supply an ICC profile) print
+ (\n Producing a potentially INVALID PDF/A file. \n) print
+ Usage
} ifelse
}
{
- % No XML invoice definition on the command line; chide the user and give them an example
- %
- (\nERROR - ZUGFeRDXMLFile has not been supplied, you must supply an XML invoice file\n) print
- ( Producing a PDF/A file not a ZUGFeRD file.\n) print
- (example usage - gs --permit-file-read=/usr/home/me/zugferd/ -sDEVICE=pdfwrite -dPDFA=3\\\n) print
- ( -sColorConversionStrategy=RGB -sZUGFeRDXMLFile=/usr/home/me/zugferd/invoice.xml\\\n) print
- ( -sZUGFeRDProfile=/usr/home/me/rgb.icc -o /usr/home/me/zugferd/zugferd.pdf\\\n) print
- ( /usr/home/me/zugferd/zugferd.ps /usr/home/me/zugferd/original.pdf\n\n) print flush
+ % No XML invoice definition on the command line;
+ % chide the user and give them an example
+ (\nERROR - ZUGFeRDXMLFile has not been supplied, you must supply a XML invoice file) print
+ (\n Producing a PDF/A file, NOT a ZUGFeRD file. \n) print
+ Usage
} ifelse
-% That's all the ZUGFeRD and PDF/A-3 setup completed, all that remains now is to run the input file
+% That's all the ZUGFeRD and PDF/A-3 setup completed,
+% all that remains now is to run the input file
+
+%%EOF \ No newline at end of file