texlive[48582] Master: Upgrade gs-9.23 -> gs-9.24

commits+reinhardk at tug.org commits+reinhardk at tug.org
Wed Sep 5 00:33:59 CEST 2018


Revision: 48582
          http://tug.org/svn/texlive?view=revision&revision=48582
Author:   reinhardk
Date:     2018-09-05 00:33:58 +0200 (Wed, 05 Sep 2018)
Log Message:
-----------
Upgrade gs-9.23 -> gs-9.24

Modified Paths:
--------------
    trunk/Master/tlpkg/tlgs/README.TEXLIVE
    trunk/Master/tlpkg/tlgs/Resource/Init/gs_dps.ps
    trunk/Master/tlpkg/tlgs/Resource/Init/gs_fntem.ps
    trunk/Master/tlpkg/tlgs/Resource/Init/gs_init.ps
    trunk/Master/tlpkg/tlgs/Resource/Init/gs_lev2.ps
    trunk/Master/tlpkg/tlgs/Resource/Init/gs_ll3.ps
    trunk/Master/tlpkg/tlgs/Resource/Init/gs_pdfwr.ps
    trunk/Master/tlpkg/tlgs/Resource/Init/gs_setpd.ps
    trunk/Master/tlpkg/tlgs/Resource/Init/gs_typ32.ps
    trunk/Master/tlpkg/tlgs/Resource/Init/pdf_base.ps
    trunk/Master/tlpkg/tlgs/Resource/Init/pdf_draw.ps
    trunk/Master/tlpkg/tlgs/Resource/Init/pdf_font.ps
    trunk/Master/tlpkg/tlgs/Resource/Init/pdf_main.ps
    trunk/Master/tlpkg/tlgs/Resource/Init/pdf_ops.ps
    trunk/Master/tlpkg/tlgs/Resource/Init/pdf_rbld.ps
    trunk/Master/tlpkg/tlgs/Resource/Init/pdf_sec.ps
    trunk/Master/tlpkg/tlgs/bin/gsdll32.dll
    trunk/Master/tlpkg/tlgs/bin/gsdll32.lib
    trunk/Master/tlpkg/tlgs/bin/gswin32.exe
    trunk/Master/tlpkg/tlgs/bin/gswin32c.exe

Added Paths:
-----------
    trunk/Master/source/ghostscript-9.24.tar.xz

Removed Paths:
-------------
    trunk/Master/source/ghostscript-9.23.tar.xz

Deleted: trunk/Master/source/ghostscript-9.23.tar.xz
===================================================================
(Binary files differ)

Added: trunk/Master/source/ghostscript-9.24.tar.xz
===================================================================
(Binary files differ)

Index: trunk/Master/source/ghostscript-9.24.tar.xz
===================================================================
--- trunk/Master/source/ghostscript-9.24.tar.xz	2018-09-04 21:40:52 UTC (rev 48581)
+++ trunk/Master/source/ghostscript-9.24.tar.xz	2018-09-04 22:33:58 UTC (rev 48582)

Property changes on: trunk/Master/source/ghostscript-9.24.tar.xz
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/x-xz
\ No newline at end of property
Modified: trunk/Master/tlpkg/tlgs/README.TEXLIVE
===================================================================
--- trunk/Master/tlpkg/tlgs/README.TEXLIVE	2018-09-04 21:40:52 UTC (rev 48581)
+++ trunk/Master/tlpkg/tlgs/README.TEXLIVE	2018-09-04 22:33:58 UTC (rev 48582)
@@ -1,5 +1,5 @@
 
-This directory contains a subset of the Ghostscript 9.23 distribution
+This directory contains a subset of the Ghostscript 9.24 distribution
 for Windows.  The only purpose of this package is to support programs
 shipped with TeX Live.  It's not intended for general use. 
 
@@ -6,7 +6,7 @@
 Changes:
 
  * The directories "doc", "examples", "libpng", "trio", "zlib",
-   "openjpeg", and "lcms2art" were removed.
+   "openjpeg", and "lcms2{art,mt}" were removed.
 
  * All executable files except Ghostscript itself were removed.
 

Modified: trunk/Master/tlpkg/tlgs/Resource/Init/gs_dps.ps
===================================================================
--- trunk/Master/tlpkg/tlgs/Resource/Init/gs_dps.ps	2018-09-04 21:40:52 UTC (rev 48581)
+++ trunk/Master/tlpkg/tlgs/Resource/Init/gs_dps.ps	2018-09-04 22:33:58 UTC (rev 48582)
@@ -70,7 +70,7 @@
                 % Save a copy of the initial gstate.
   //systemdict /savedinitialgstate gstate readonly .forceput
   .setglobal
-} .bind def
+} .bind executeonly def % must be bound and hidden for .forceput
 
 % Initialize local dictionaries and gstate when creating a new context.
 % Note that until this completes, we are in the anomalous situation of

Modified: trunk/Master/tlpkg/tlgs/Resource/Init/gs_fntem.ps
===================================================================
--- trunk/Master/tlpkg/tlgs/Resource/Init/gs_fntem.ps	2018-09-04 21:40:52 UTC (rev 48581)
+++ trunk/Master/tlpkg/tlgs/Resource/Init/gs_fntem.ps	2018-09-04 22:33:58 UTC (rev 48582)
@@ -408,7 +408,7 @@
     exit
   } loop
   exch setglobal
-} bind def
+} .bind executeonly def % must be bound and hidden for .forceput
 
 currentdict end /ProcSet defineresource pop
 

Modified: trunk/Master/tlpkg/tlgs/Resource/Init/gs_init.ps
===================================================================
--- trunk/Master/tlpkg/tlgs/Resource/Init/gs_init.ps	2018-09-04 21:40:52 UTC (rev 48581)
+++ trunk/Master/tlpkg/tlgs/Resource/Init/gs_init.ps	2018-09-04 22:33:58 UTC (rev 48582)
@@ -29,7 +29,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!
-923
+924
 
 % Check the interpreter revision.
 dup revision ne
@@ -767,23 +767,6 @@
   { /run .systemvar exec } .execasresource
 } bind def
 
-% Define procedures for getting and setting the current device resolution.
-
-/gsgetdeviceprop	% <device> <propname> gsgetdeviceprop <value>
- { 2 copy mark exch //null .dicttomark .getdeviceparams
-   dup mark eq		% if true, not found
-    { pop dup /undefined signalerror }
-    { 5 1 roll pop pop pop pop }
-   ifelse
- } bind def
-/gscurrentresolution	% - gscurrentresolution <[xres yres]>
- { currentdevice /HWResolution gsgetdeviceprop
- } bind def
-/gssetresolution	% <[xres yres]> gssetresolution -
- { 2 array astore mark exch /HWResolution exch
-   currentdevice copydevice putdeviceprops setdevice
- } bind def
-
 % Define auxiliary procedures needed for the above.
 /shellarguments		% -> shell_arguments true (or) false
         { /ARGUMENTS where
@@ -1521,6 +1504,14 @@
   dup 150 lt //systemdict /DITHERPPI known not and
 } bind def
 
+/.gsgetdeviceprop	% <device> <propname> gsgetdeviceprop <value>
+ { 2 copy mark exch //null .dicttomark .getdeviceparams
+   dup mark eq		% if true, not found
+    { pop dup /undefined signalerror }
+    { 5 1 roll pop pop pop pop }
+   ifelse
+ } bind def
+
 % The following implementation uses LL2 extensions, but only in stopped
 % contexts so that with LL1, the .set??reshalftone will be used.
 %
@@ -1528,7 +1519,7 @@
 %			      false
 /.getdefaulthalftone {
   % try the device to see if it has a default halftone
-  { currentdevice /HalftoneDefault gsgetdeviceprop } .internalstopped
+  { currentdevice /HalftoneDefault //.gsgetdeviceprop exec } .internalstopped
   { pop pop //false }		% no device property
   { dup type /dicttype eq { //true } { pop //false } ifelse }
   ifelse
@@ -1541,6 +1532,7 @@
   }
   if
 } bind def
+currentdict /.gsgetdeviceprop .forceundef
 
 /.setdefaulthalftone {
   .getdefaulthalftone
@@ -2012,15 +2004,30 @@
 .currentglobal //true .setglobal
 /SAFETY 2 dict
   dup /safe //false put
-  dup /tempfiles 10 dict readonly put
+  dup /tempfiles 10 dict noaccess put
 readonly def
 .setglobal
 
+/tempfilepaths
+[
+  (TMPDIR) getenv not
+  {
+    (TEMP) getenv not
+    {
+      (TMP) getenv not
+      {
+        (/temp) (/tmp)
+      } if
+    } if
+  } if
+] def
+
 /.locksafe_userparams {
   SAFETY /safe get not {
     <<
       /PermitFileReading [
         currentuserparams /PermitFileReading get aload pop
+        //tempfilepaths aload pop
         /FONTPATH .systemvar (*) .generate_dir_list_templates
           % Library files :
         /LIBPATH  .systemvar (*) .generate_dir_list_templates
@@ -2036,6 +2043,14 @@
             concatstrings concatstrings .generate_dir_list_templates
         } if
       ]
+      /PermitFileWriting [
+          currentuserparams /PermitFileWriting get aload pop
+          //tempfilepaths aload pop
+      ]
+      /PermitFileControl [
+          currentuserparams /PermitFileControl get aload pop
+          //tempfilepaths aload pop
+      ]
       /LockFilePermissions //true
     >> setuserparams
   }
@@ -2042,6 +2057,8 @@
   if
 } bind def
 
+currentdict /tempfilepaths undef
+
 /.locksafe {
   .locksafe_userparams
   systemdict /getenv {pop //false} .forceput
@@ -2103,152 +2120,146 @@
   .locksafeglobal
 } bind executeonly odef
 
-/deletefile {
-  dup { deletefile } stopped {
-    pop //deletefile $error /errorname get signalerror
-  } {
-    % deletefile succeeded. Remove from tempfile list if present
-    //SAFETY /tempfiles get exch cvn 2 copy known {
-      .forceundef
-    } {
-      pop pop
-    }
-    ifelse
-  }
-  ifelse
-} .bind executeonly odef
-
-% If a file is opened with .tempfile with SAFER not (yet) set,
-% the file can be deleted later, even if SAFER is set.
-/.tempfile {
-  .tempfile	% filename file
-  //SAFETY /tempfiles get 2 .argindex //true .forceput
-} .bind executeonly odef
-
 % If we are running in SAFER mode, lock things down
 SAFER { .setsafeglobal } if
 
+/SAFERUndefinePostScriptOperators {
+  [
+  % Used by our own test suite files
+  /.pushpdf14devicefilter    % transparency-example.ps
+  /.poppdf14devicefilter     % transparency-example.ps
+  /.setopacityalpha          % transparency-example.ps
+  /.setshapealpha            % transparency-example.ps
+  /.endtransparencygroup     % transparency-example.ps
+  /.setdotlength             % Bug687720.ps
+  /.sort /.setdebug /.mementolistnewblocks /getenv
+
+  /.makeoperator /.setCPSImode              % gs_cet.ps, this won't work on cluster with -dSAFER
+
+  /unread
+  ]
+  {systemdict exch .forceundef} forall
+
+  //systemdict /SAFERUndefinePostScriptOperators .forceundef
+} .bind executeonly def % must be bound and hidden for .forceundef
+
 /UndefinePostScriptOperators {
 
-%% This list is of Display PostScript operators. We believe that Display PostScript
-%% was never fully implemented and the only known user, GNUStep, is no longer
-%% using it. So lets remove it.
-[
-/condition /currentcontext /detach /.fork /join /.localfork /lock /monitor /notify
-/wait /yield /.currentscreenphase /.setscreenphase /.image2 /eoviewclip /initviewclip
-/viewclip /viewclippath /defineusername
-%% NeXT DPS extensions
-/currentalpha /setalpha /.alphaimage /composite /compositerect /dissolve /sizeimagebox /.sizeimageparams
-]
-{systemdict exch .forceundef} forall
+  %% This list is of Display PostScript operators. We believe that Display PostScript
+  %% was never fully implemented and the only known user, GNUStep, is no longer
+  %% using it. So lets remove it.
+  [
+  /condition /currentcontext /detach /.fork /join /.localfork /lock /monitor /notify
+  /wait /yield /.currentscreenphase /.setscreenphase /.image2 /eoviewclip /initviewclip
+  /viewclip /viewclippath /defineusername
+  %% NeXT DPS extensions
+  /currentalpha /setalpha /.alphaimage /composite /compositerect /dissolve /sizeimagebox /.sizeimageparams
+  ]
+  {systemdict exch .forceundef} forall
 
-%% This list is of operators which no longer appear to be used, and which we do not believe
-%% to have any real use. For now we will undefine the operstors so they cannot easily be used
-%% but can be easily restored (just delete the name from the list in the array). In future
-%% we may remove the operator and the code implementation entirely.
-[
-/.bitadd /.charboxpath /.cond /.countexecstack /.execstack /.runandhide /.popdevicefilter
-/.execfile /.filenamesplit /.file_name_parent
-/.setdefaultmatrix /.isprocfilter /.unread /.psstringencode
-/.buildsampledfunction /.isencapfunction /.currentaccuratecurves /.currentcurvejoin /.currentdashadapt /.currentdotlength
-/.currentlimitclamp /.dotorientation /.setaccuratecurves /.setcurvejoin /.setdashadapt /.setdotorientation
-/.setlimitclamp /.currentscreenlevels /.dashpath /.pathbbox /.identeq /.identne /.tokenexec /.forgetsave /.pantonecallback
+  %% This list is of operators which no longer appear to be used, and which we do not believe
+  %% to have any real use. For now we will undefine the operstors so they cannot easily be used
+  %% but can be easily restored (just delete the name from the list in the array). In future
+  %% we may remove the operator and the code implementation entirely.
+  [
+  /.bitadd /.charboxpath /.cond /.countexecstack /.execstack /.runandhide /.popdevicefilter
+  /.execfile /.filenamesplit /.file_name_parent
+  /.setdefaultmatrix /.isprocfilter /.unread /.psstringencode
+  /.buildsampledfunction /.isencapfunction /.currentaccuratecurves /.currentcurvejoin /.currentdashadapt /.currentdotlength
+  /.currentlimitclamp /.dotorientation /.setaccuratecurves /.setcurvejoin /.setdashadapt /.setdotorientation
+  /.setlimitclamp /.currentscreenlevels /.dashpath /.pathbbox /.identeq /.identne /.tokenexec /.forgetsave /.pantonecallback
 
-%% Used by our own test suite files
-%%/.setdotlength % Bug687720.ps
-]
-{systemdict exch .forceundef} forall
+  %% Used by our own test suite files
+  %%/.setdotlength % Bug687720.ps
+  ]
+  {systemdict exch .forceundef} forall
 
-%% This list of operators are used internally by various parts of the Ghostscript startup code.
-%% Since each operator is a potential security vulnerability, and any operator listed here
-%% is not required once the initislisation is complete and functions are bound, we undefine
-%% the ones that aren't needed at runtime.
-[
-/.callinstall /.callbeginpage /.callendpage
-/.currentstackprotect /.setstackprotect /.errorexec /.finderrorobject /.installsystemnames /.bosobject /.fontbbox
-/.type1execchar /.type2execchar /.type42execchar /.setweightvector /.getuseciecolor /processcolors /.includecolorspace
-/.execn /.instopped /.stop /.stopped /.setcolorrendering /.setdevicecolorrendering /.buildcolorrendering1 /.builddevicecolorrendering1
-/.TransformPQR_scale_WB0 /.TransformPQR_scale_WB1 /.TransformPQR_scale_WB2 /.currentoverprintmode /.copydevice2
-/.devicename /.doneshowpage /.getbitsrect /.getdevice /.getdefaultdevice /.getdeviceparams /.gethardwareparams
-/makewordimagedevice /.outputpage /.putdeviceparams /.setdevice /.currentshowpagecount
-/.setpagedevice /.currentpagedevice /.knownundef /.setmaxlength /.rectappend /.initialize_dsc_parser /.parse_dsc_comments
-/.fillCIDMap /.fillIdentityCIDMap /.buildcmap /.filenamelistseparator /.libfile /.getfilename
-/.file_name_combine /.file_name_is_absolute /.file_name_separator /.file_name_directory_separator /.file_name_current /.filename
-/.peekstring /.writecvp /.subfiledecode /.setupUnicodeDecoder /.jbig2makeglobalctx /.registerfont /.parsecff
-/.getshowoperator /.getnativefonts /.beginform /.endform /.get_form_id /.repeatform /.reusablestream /.rsdparams
-/.buildfunction /.currentfilladjust2 /.setfilladjust2 /.sethpglpathmode /.currenthpglpathmode
-/.currenthalftone /.sethalftone5 /.image1 /.imagemask1 /.image3 /.image4
-/.getiodevice /.getdevparms /.putdevparams /.bbox_transform /.matchmedia /.matchpagesize /.defaultpapersize
-/.oserrno /.setoserrno /.oserrorstring /.getCPSImode
-/.getscanconverter /.setscanconverter /.type1encrypt /.type1decrypt/.languagelevel /.setlanguagelevel /.eqproc /.fillpage /.buildpattern1 /.saslprep
-/.buildshading1 /.buildshadin2 /.buildshading3 /.buildshading4 /.buildshading5 /.buildshading6 /.buildshading7 /.buildshadingpattern
-/.argindex /.bytestring /.namestring /.stringbreak /.stringmatch /.globalvmarray /.globalvmdict /.globalvmpackedarray /.globalvmstring
-/.localvmarray /.localvmdict /.localvmpackedarray /.localvmstring /.systemvmarray /.systemvmdict /.systemvmpackedarray /.systemvmstring /.systemvmfile /.systemvmlibfile
-/.systemvmSFD /.settrapparams /.currentsystemparams /.currentuserparams /.getsystemparam /.getuserparam /.setsystemparams /.setuserparams
-/.checkpassword /.locale_to_utf8 /.currentglobal /.gcheck /.imagepath
+  %% This list of operators are used internally by various parts of the Ghostscript startup code.
+  %% Since each operator is a potential security vulnerability, and any operator listed here
+  %% is not required once the initislisation is complete and functions are bound, we undefine
+  %% the ones that aren't needed at runtime.
+  [
+  /.callinstall /.callbeginpage /.callendpage
+  /.currentstackprotect /.setstackprotect /.errorexec /.finderrorobject /.installsystemnames /.bosobject /.fontbbox
+  /.type1execchar /.type2execchar /.type42execchar /.setweightvector /.getuseciecolor /processcolors /.includecolorspace
+  /.execn /.instopped /.stop /.stopped /.setcolorrendering /.setdevicecolorrendering /.buildcolorrendering1 /.builddevicecolorrendering1
+  /.TransformPQR_scale_WB0 /.TransformPQR_scale_WB1 /.TransformPQR_scale_WB2 /.currentoverprintmode /.copydevice2
+  /.devicename /.doneshowpage /.getbitsrect /.getdevice /.getdefaultdevice /.getdeviceparams /.gethardwareparams
+  /makewordimagedevice /.outputpage /.putdeviceparams /.setdevice /.currentshowpagecount
+  /.setpagedevice /.currentpagedevice /.knownundef /.setmaxlength /.rectappend /.initialize_dsc_parser /.parse_dsc_comments
+  /.fillCIDMap /.fillIdentityCIDMap /.buildcmap /.filenamelistseparator /.libfile /.getfilename
+  /.file_name_combine /.file_name_is_absolute /.file_name_separator /.file_name_directory_separator /.file_name_current /.filename
+  /.peekstring /.writecvp /.subfiledecode /.setupUnicodeDecoder /.jbig2makeglobalctx /.registerfont /.parsecff
+  /.getshowoperator /.getnativefonts /.beginform /.endform /.get_form_id /.repeatform /.reusablestream /.rsdparams
+  /.buildfunction /.currentfilladjust2 /.setfilladjust2 /.sethpglpathmode /.currenthpglpathmode
+  /.currenthalftone /.sethalftone5 /.image1 /.imagemask1 /.image3 /.image4
+  /.getiodevice /.getdevparms /.putdevparams /.bbox_transform /.matchmedia /.matchpagesize /.defaultpapersize
+  /.oserrno /.setoserrno /.oserrorstring /.getCPSImode
+  /.getscanconverter /.setscanconverter /.type1encrypt /.type1decrypt/.languagelevel /.setlanguagelevel /.eqproc /.fillpage /.buildpattern1 /.saslprep
+  /.buildshading1 /.buildshading2 /.buildshading3 /.buildshading4 /.buildshading5 /.buildshading6 /.buildshading7 /.buildshadingpattern
+  /.shfill /.argindex /.bytestring /.namestring /.stringbreak /.stringmatch /.globalvmarray /.globalvmdict /.globalvmpackedarray /.globalvmstring
+  /.localvmarray /.localvmdict /.localvmpackedarray /.localvmstring /.systemvmarray /.systemvmdict /.systemvmpackedarray /.systemvmstring /.systemvmfile /.systemvmlibfile
+  /.systemvmSFD /.settrapparams /.currentsystemparams /.currentuserparams /.getsystemparam /.getuserparam /.setsystemparams /.setuserparams
+  /.checkpassword /.locale_to_utf8 /.currentglobal /.gcheck /.imagepath
 
-% Used by a free user in the Library of Congress. Apparently this is used to
-% draw a partial page, which is then filled in by the results of a barcode
-% scanner and SQL database lookup. Its not clear to us exactly why this needs to be
-% done as a partial page, but its easiest to restore the operator, and it seems like
-% its a reasonably safe operator to restore, for the *very* few devices on which
-% it will have any effect. Currently this uses the 'sync_outptu' device method
-% to transfer the partial page, in future we may use a spec_op instead.
-%/flushpage
+  % Used by a free user in the Library of Congress. Apparently this is used to
+  % draw a partial page, which is then filled in by the results of a barcode
+  % scanner and SQL database lookup. Its not clear to us exactly why this needs to be
+  % done as a partial page, but its easiest to restore the operator, and it seems like
+  % its a reasonably safe operator to restore, for the *very* few devices on which
+  % it will have any effect. Currently this uses the 'sync_outptu' device method
+  % to transfer the partial page, in future we may use a spec_op instead.
+  %/flushpage
 
-% Used by our own test suite files
-%/.fileposition %image-qa.ps
-%/.makeoperator /.setCPSImode % gs_cet.ps
+  % Used by our own test suite files
+  %/.fileposition %image-qa.ps
+  %/.makeoperator /.setCPSImode % gs_cet.ps
 
-% Either our code uses these in ways which mean they can't be undefined, or they are used directly by
-% test files/utilities, or engineers expressed a desire to keep them visible.
-%
-%/currentdevice /.sort /.buildfont0 /.buildfont1 /.buildfont2 /.buildfont3 /.buildfont4 /.buildfont9 /.buildfont10 /.buildfont11
-%/.buildfotn32 /.buildfont42 /.type9mapcid /.type11mapcid /.swapcolors
-%/currentdevice  /.quit /.setuseciecolor /.needinput /.setoverprintmode /.special_op /.dicttomark /.knownget
-%/.FAPIavailable /.FAPIpassfont /.FAPIrebuildfont /.FAPIBuildGlyph /.FAPIBuildChar /.FAPIBuildGlyph9
-%/.tempfile /.numicc_components /.set_outputintent  /.max /.min /.shfill /.vmreclaim /.getpath /.setglobal
-%/.setdebug /.mementolistnewblocks /getenv
-]
-{systemdict exch .forceundef} forall
+  % Either our code uses these in ways which mean they can't be undefined, or they are used directly by
+  % test files/utilities, or engineers expressed a desire to keep them visible.
+  %
+  %/currentdevice /.sort /.buildfont0 /.buildfont1 /.buildfont2 /.buildfont3 /.buildfont4 /.buildfont9 /.buildfont10 /.buildfont11
+  %/.buildfotn32 /.buildfont42 /.type9mapcid /.type11mapcid /.swapcolors
+  %/currentdevice  /.quit /.setuseciecolor /.needinput /.setoverprintmode /.special_op /.dicttomark /.knownget
+  %/.FAPIavailable /.FAPIpassfont /.FAPIrebuildfont /.FAPIBuildGlyph /.FAPIBuildChar /.FAPIBuildGlyph9
+  %/.tempfile /.numicc_components /.set_outputintent  /.max /.min /.vmreclaim /.getpath /.setglobal
+  %/.setdebug /.mementolistnewblocks /getenv
+  ]
+  {systemdict exch .forceundef} forall
 
-//systemdict /UndefinePostScriptOperators .forceundef
-} bind def
+  //systemdict /UndefinePostScriptOperators .forceundef
+} .bind executeonly def % must be bound and hidden for .forceundef
 
 /UndefinePDFOperators {
-%% This list of operators are used internally by various parts of the Ghostscript PDF interpreter.
-%% Since each operator is a potential security vulnerability, and any operator listed here
-%% is not required once the initislisation is complete and functions are bound, we undefine
-%% the ones that aren't needed at runtime.
-[
-/.pdfawidthshow /.pdfwidthshow /.currentblackptcomp /.setblackptcomp
-/.setfillcolor /.setfillcolorspace /.setstrokecolor /.setstrokecolorspace /.currentrenderingintent /.setrenderingintent
-/.currenttextrenderingmode /.settextspacing /.currenttextspacing /.settextleading /.currenttextleading
-/.settextrise /.currenttextrise /.setwordspacing /.currentwordspacing /.settexthscaling /.currenttexthscaling
-/.settextlinematrix /.currenttextlinematrix /.currenttextmatrix /.settextmatrix /.currentblendmode
-/.currentopacityalpha /.currentshapealpha /.currenttextknockout
-/.pushextendedgstate /.popextendedgstate /.begintransparencytextgroup
-/.endtransparencytextgroup /.begintransparencymaskgroup /.begintransparencymaskimage /.endtransparencymask /.image3x
-/.abortpdf14devicefilter /.pdfinkpath /.pdfFormName /.setstrokeconstantalpha
-/.setfillconstantalpha /.setalphaisshape /.currentalphaisshape
-/.settextspacing /.currenttextspacing /.settextleading /.currenttextleading /.settextrise /.currenttextrise
-/.setwordspacing /.currentwordspacing /.settexthscaling /.currenttexthscaling /.setPDFfontsize /.currentPDFfontsize
+  %% This list of operators are used internally by various parts of the Ghostscript PDF interpreter.
+  %% Since each operator is a potential security vulnerability, and any operator listed here
+  %% is not required once the initislisation is complete and functions are bound, we undefine
+  %% the ones that aren't needed at runtime.
+  %% This function is only called if DELAYBIND is true. It is a copy of the code at the end of pdf_main.ps
+  %% and must be maintained in parallel with it.
+  [
+  /.pdfawidthshow /.pdfwidthshow /.currentblackptcomp /.setblackptcomp
+  /.setfillcolor /.setfillcolorspace /.setstrokecolor /.setstrokecolorspace /.currentrenderingintent /.setrenderingintent
+  /.currenttextrenderingmode /.settextspacing /.currenttextspacing /.settextleading /.currenttextleading
+  /.settextrise /.currenttextrise /.setwordspacing /.currentwordspacing /.settexthscaling /.currenttexthscaling
+  /.settextlinematrix /.currenttextlinematrix /.currenttextmatrix /.settextmatrix /.currentblendmode
+  /.currentopacityalpha /.currentshapealpha /.currenttextknockout
+  /.pushextendedgstate /.popextendedgstate /.begintransparencytextgroup
+  /.endtransparencytextgroup /.begintransparencymaskgroup /.begintransparencymaskimage /.endtransparencymask /.image3x
+  /.abortpdf14devicefilter /.pdfinkpath /.pdfFormName /.setstrokeconstantalpha
+  /.setfillconstantalpha /.setalphaisshape /.currentalphaisshape
+  /.settextspacing /.currenttextspacing /.settextleading /.currenttextleading /.settextrise /.currenttextrise
+  /.setwordspacing /.currentwordspacing /.settexthscaling /.currenttexthscaling /.setPDFfontsize /.currentPDFfontsize
+  /.setdistillerparams
 
-% Used by our own test suite files
-%/.pushpdf14devicefilter    % transparency-example.ps
-%/.poppdf14devicefilter     % transparency-example.ps
-%/.setopacityalpha          % transparency-example.ps
-%/.setshapealpha            % transparency-example.ps
-%/.endtransparencygroup     % transparency-example.ps
+  % undefining these causes errors/incorrect output
+  %/.settextrenderingmode /.setblendmode /.begintransparencygroup /.settextknockout /check_r6_password /.setstrokeoverprint /.setfilloverprint
+  %/.currentstrokeoverprint /.currentfilloverprint /.currentfillconstantalpha /.currentstrokeconstantalpha
+  ]
+  {systemdict exch .forceundef} forall
+  //systemdict /UndefinePDFOperators .forceundef
+} .bind executeonly def % must be bound and hidden for .forceundef
 
-% undefining these causes errors/incorrect output
-%/.settextrenderingmode /.setblendmode /.begintransparencygroup /.settextknockout /check_r6_password /.setstrokeoverprint /.setfilloverprint
-%/.currentstrokeoverprint /.currentfilloverprint /.currentfillconstantalpha /.currentstrokeconstantalpha
-]
-{systemdict exch .forceundef} forall
-//systemdict /UndefinePDFOperators .forceundef
-} bind def
-
 % If we delayed binding, make it possible to do it later.
 /.bindnow {
   currentuserparams /IdiomRecognition .knownget {
@@ -2262,8 +2273,11 @@
   //systemdict /.delaybind {} .forceput	% reclaim the space
   //systemdict /.bindnow .forceundef	% ditto
   put
-%  //systemdict /UndefinePostScriptOperators get exec
-%  //systemdict /UndefinePDFOperators get exec
+  SAFER {
+    //systemdict /SAFERUndefinePostScriptOperators get exec
+  } if
+  //systemdict /UndefinePostScriptOperators get exec
+  //systemdict /UndefinePDFOperators get exec
   //systemdict /.forcecopynew .forceundef	% remove temptation
   //systemdict /.forcedef .forceundef		% ditto
   //systemdict /.forceput .forceundef		% ditto
@@ -2375,6 +2389,9 @@
 %% If we are using DELAYBIND we have to defer the undefinition
 %% until .bindnow.
 DELAYBIND not {
+  SAFER {
+    //systemdict /SAFERUndefinePostScriptOperators get exec
+  } if
   //systemdict /UndefinePostScriptOperators get exec
   //systemdict /UndefinePDFOperators .forceundef
 } if
@@ -2385,6 +2402,7 @@
  { pop NOGC not { 2 .vmreclaim 0 vmreclaim } if
  } if
 DELAYBIND not {
+  systemdict /.bindnow .undef       % We only need this for DELAYBIND
   systemdict /.forcecopynew .undef	% remove temptation
   systemdict /.forcedef .undef		% ditto
   systemdict /.forceput .undef		% ditto

Modified: trunk/Master/tlpkg/tlgs/Resource/Init/gs_lev2.ps
===================================================================
--- trunk/Master/tlpkg/tlgs/Resource/Init/gs_lev2.ps	2018-09-04 21:40:52 UTC (rev 48581)
+++ trunk/Master/tlpkg/tlgs/Resource/Init/gs_lev2.ps	2018-09-04 22:33:58 UTC (rev 48582)
@@ -163,7 +163,8 @@
         % Set them again to the new values.  From here on, we are safe,
         % since a context switch will consult userparams.
   .setuserparams
-} .bind def
+} .bind executeonly def % must be bound and hidden for .forceput
+
 /setuserparams {		% <dict> setuserparams -
     .setuserparams2
 } .bind odef
@@ -1072,10 +1073,10 @@
 % the values given into an array.  This is consistent with what we see when
 % testing with Adobe Distiller 6.0.
 %   <cyan> <magenta> <yellow> <black> <key> findcmykcustomcolor <array>
-/findcmykcustomcolor { 5 array astore } bind def
+/findcmykcustomcolor { 5 array astore } bind executeonly def
 % The following isn't documented by Adobe, but was found in Adobe Illustrator (R)
 % Version 7.0 Full Prolog
-/findrgbcustomcolor { 4 array astore } bind def
+/findrgbcustomcolor { 4 array astore } bind executeonly def
 
 % Build a tint transform function for use by setcustomcolor.  This function
 % is for a Separation color space which has either a DeviceCMYK base color space
@@ -1104,7 +1105,7 @@
     ]
   } ifelse
   cvx bind exch pop		%  Make executable and remove the input array
-} bind def
+} bind executeonly def
 
 % Construct the colorspace array to be used by setcolorspace from the array
 % result of either findcmykcustomcolor or findrgbcustomcolor.
@@ -1124,7 +1125,7 @@
     ]
   } ifelse
   exch pop		% remove the input array
-} bind def
+} bind executeonly def
 
 % Set a custom color based upon a tint and array which describes the custom
 % color.  See findcmykcustomcolor.  First we create and then set a Separation
@@ -1133,14 +1134,51 @@
 % for some reason, so an alternate operational mode is tolerated:
 % 					    null setcustomcolor -
 /setcustomcolor			% <array> <tint> setcustomcolor -
-{ dup //null ne {
+{
+  dup //null eq {
+    pop pop
+  }{
+    % 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
+    } if
+    dup 1 le not {
+      /setcustomcolor /rangecheck cvx signalerror
+    } if
+    dup 0 ge not {
+      /setcustomcolor /rangecheck cvx signalerror
+    } if
+
+    % The array is supposed to be the result of fundcmykcustomcolor. Our
+    % implementation just pushes all the arguments into the array and that's
+    % what buildcolorspacearray expects. So check that now.
+    % Starting with the first N-1 elemenst which must be numbers where 0 <= x <= 1
+    1 index
+    0 1 2 index length 2 sub
+    {
+      1 index exch get dup
+      type dup /integertype eq exch /realtype eq or not {
+        /setcustomcolor /typecheck cvx signalerror
+      } if
+      dup
+      1 le not {
+        /setcustomcolor /rangecheck cvx signalerror
+      } if
+      0 ge not {
+        /setcustomcolor /rangecheck cvx 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
+    } if
+
     exch //buildcolorspacearray exec
     setcolorspace			% Set the Separation color space as current
     setcolor			% Set the tint as the current color
-  }
-  { pop pop }	% 'null' as the tint is ignored. pop tint and array
-  ifelse
-} bind def
+  } ifelse
+} bind executeonly def
 
 % This proc is supposed to implement a version of overprinting. TN 5044 says
 % that this proc is not used by any shipping host-based application. We have

Modified: trunk/Master/tlpkg/tlgs/Resource/Init/gs_ll3.ps
===================================================================
--- trunk/Master/tlpkg/tlgs/Resource/Init/gs_ll3.ps	2018-09-04 21:40:52 UTC (rev 48581)
+++ trunk/Master/tlpkg/tlgs/Resource/Init/gs_ll3.ps	2018-09-04 22:33:58 UTC (rev 48582)
@@ -440,6 +440,11 @@
     /shfill .systemvar /undefined signalerror
   } ifelse
 } bind def
+
+/.buildshading_and_shfill {
+  .buildshading .shfill
+} bind def
+
 systemdict /.reuseparamdict undef
 
 /.buildpattern2 {	% <template> <matrix> .buildpattern2
@@ -464,7 +469,7 @@
         % Currently, .shfill requires that the color space
         % in the pattern be the current color space.
         % Disable overprintmode for shfill
-  { dup gsave 0 .setoverprintmode .buildshading .shfill } stopped
+  { dup gsave 0 .setoverprintmode .buildshading_and_shfill } stopped
   grestore {
     /$error .systemvar /errorinfo 2 copy known {
       pop pop

Modified: trunk/Master/tlpkg/tlgs/Resource/Init/gs_pdfwr.ps
===================================================================
--- trunk/Master/tlpkg/tlgs/Resource/Init/gs_pdfwr.ps	2018-09-04 21:40:52 UTC (rev 48581)
+++ trunk/Master/tlpkg/tlgs/Resource/Init/gs_pdfwr.ps	2018-09-04 22:33:58 UTC (rev 48582)
@@ -197,7 +197,7 @@
   /ColorConversionStrategy /UseDeviceIndependentColor
   /ColorImageDownsampleType /Average
   /ColorImageResolution 300
-  /CompatibilityLevel 1.5
+  /CompatibilityLevel 1.7
   /CreateJobTicket //true
   /DoThumbnails //false
   /EmbedAllFonts //true
@@ -224,7 +224,7 @@
   /ColorConversionStrategy /LeaveColorUnchanged
   /ColorImageDownsampleType /Bicubic
   /ColorImageResolution 300
-  /CompatibilityLevel 1.5
+  /CompatibilityLevel 1.7
   /CreateJobTicket //true
   /DoThumbnails //true
   /EmbedAllFonts //true
@@ -660,8 +660,7 @@
   {
     pop
   } ifelse
-}
-bind def
+} .bind executeonly def % must be bound and hidden for .forceput
 
 % Use the DSC processing hook to pass DSC comments to the driver.
 % We use a pseudo-parameter named DSC whose value is an array:

Modified: trunk/Master/tlpkg/tlgs/Resource/Init/gs_setpd.ps
===================================================================
--- trunk/Master/tlpkg/tlgs/Resource/Init/gs_setpd.ps	2018-09-04 21:40:52 UTC (rev 48581)
+++ trunk/Master/tlpkg/tlgs/Resource/Init/gs_setpd.ps	2018-09-04 22:33:58 UTC (rev 48582)
@@ -204,8 +204,8 @@
     mark
     % First put the device's default page size in slot 0
     % This satifies those that have devices built with a4 as the default
-    0 mark /PageSize currentdevice /PageSize gsgetdeviceprop .dicttomark
-
+    0 mark /PageSize /GetDeviceParam .special_op
+    not {/setpagedevice .systemvar /configurationerror signalerror} if .dicttomark
     % Only populate the other entries if we aren't FIXEDMEDIA
     FIXEDMEDIA not {
       statusdict /.pagetypenames get {
@@ -624,7 +624,7 @@
          { 4 index 3 1 roll .forceput }
          { 3 index exch .undef }
         ifelse
-  } .bind
+  } .bind executeonly % must be bound and hidden for .forceput
   7 {		% For PageSize only, just impose the request.
         1 index /PageSize eq
          { pop pop 1 index /PageSize 7 put }

Modified: trunk/Master/tlpkg/tlgs/Resource/Init/gs_typ32.ps
===================================================================
--- trunk/Master/tlpkg/tlgs/Resource/Init/gs_typ32.ps	2018-09-04 21:40:52 UTC (rev 48581)
+++ trunk/Master/tlpkg/tlgs/Resource/Init/gs_typ32.ps	2018-09-04 22:33:58 UTC (rev 48582)
@@ -85,7 +85,7 @@
 { dup /FontType 32 .forceput
   dup /CharStrings 20 dict .forceput
   1 index exch .buildfont32 exch pop
-} bind def
+} .bind executeonly def % must be bound and hidden for .forceput
 
 end		% .cidfonttypes
 

Modified: trunk/Master/tlpkg/tlgs/Resource/Init/pdf_base.ps
===================================================================
--- trunk/Master/tlpkg/tlgs/Resource/Init/pdf_base.ps	2018-09-04 21:40:52 UTC (rev 48581)
+++ trunk/Master/tlpkg/tlgs/Resource/Init/pdf_base.ps	2018-09-04 22:33:58 UTC (rev 48582)
@@ -28,14 +28,14 @@
 
 % Define the name interpretation dictionary for reading values.
 /valueopdict mark
-  (<<) cvn { mark } bind	% don't push an actual mark!
+  (<<) cvn { mark } bind executeonly	% don't push an actual mark!
   (>>) cvn { { .dicttomark } stopped {
       (   **** Error: File has an unbalanced >> \(close dictionary\).\n)
       pdfformaterror
       (                Output may be incorrect.\n) pdfformaterror
     } if
-  } bind
-  ([) cvn { mark } bind		% ditto
+  } bind executeonly
+  ([) cvn { mark } bind executeonly		% ditto
   (]) cvn dup load
 %  /true true		% see .pdfexectoken below
 %  /false false		% ibid.
@@ -62,7 +62,7 @@
       pop
     } ifelse
   } if
-} bind def
+} bind executeonly def
 /name#escape			% <post> <(#)> <pre> name#escape <string>
 { exch pop
   1 index 2 () /SubFileDecode filter dup (x) readhexstring
@@ -77,7 +77,7 @@
     exch 2 1 index length 2 sub getinterval
   } ifelse
   (#) search { name#escape } if concatstrings
-} bind def
+} bind executeonly def
 
 /num-chars-dict mark (0123456789-.) {dup} forall .dicttomark readonly def
 
@@ -124,7 +124,7 @@
   pop pop count exch sub { pop } repeat	% pop all the operands
   } if
   (                Output may be incorrect.\n) pdfformaterror
-} bind def
+} bind executeonly def
 
 currentdict /num-chars-dict .undef
 
@@ -218,7 +218,7 @@
       } ifelse
     } ifelse
   } ifelse
-} bind def
+} bind executeonly def
 /PDFScanRules_true << /PDFScanRules //true >> def
 /PDFScanRules_null << /PDFScanRules //null >> def
 /.pdfrun {			% <file> <opdict> .pdfrun -
@@ -278,7 +278,7 @@
   .packtomark cvx                       % file { { {cnt <<>> file ... } loop } stopped /PDFsource PDFsource store {...} if}
   /PDFsource 3 -1 roll store            % {...} 
   exec
-} bind def
+} bind executeonly def
 
 % Execute a file, like .pdfrun, for a marking context.
 % This temporarily rebinds LocalResources and DefaultQstate.
@@ -289,7 +289,7 @@
   3 .execn
   /DefaultQstate exch store
   /LocalResources exch store
-} bind def
+} bind executeonly def
 
 % Get the depth of the PDF operand stack.  The caller sets pdfemptycount
 % before calling .pdfrun or .pdfruncontext.  It is initially set by
@@ -298,7 +298,7 @@
 % of .pdfrun{context} which have not been checked for opstack depth.
 /.pdfcount {		% - .pdfcount <count>
   count pdfemptycount sub
-} bind def
+} bind executeonly def
 
 % Read a token, but simply return false (no token read) in the case of an
 % error.  This is messy because 'token' either may or may not pop its operand
@@ -306,12 +306,12 @@
 % on whether the source is a file or a string. To avoid closing the file
 % check for '{' before trying 'token'.
 /token_nofail_dict mark
-  ( )  { dup ( ) readstring pop pop } bind
+  ( )  { dup ( ) readstring pop pop } bind executeonly
   (\t) 1 index
   (\r) 1 index
   (\n) 1 index
   (\000) 1 index
-  ({) { //null //true exit } bind
+  ({) { //null //true exit } bind executeonly
 .dicttomark def
 
 /token_nofail {		% <file|string> token_nofail false
@@ -341,7 +341,7 @@
       ifelse
     } ifelse
    } ifelse
-} bind def
+} bind executeonly def
 
 currentdict /token_nofail_dict .undef
 
@@ -384,7 +384,7 @@
   /GlobalObjects 20 dict def
   .setglobal
   /IsGlobal 0 string def
-} bind def
+} bind executeonly def
 
 % Grow the tables to a specified size.
 /growPDFobjects {		% <minsize> growPDFobjects -
@@ -401,7 +401,7 @@
     dup IsGlobal exch string dup 3 1 roll copy pop /IsGlobal exch def
   } if
   pop
-} bind def
+} bind executeonly def
 
 % We represent an unresolved object reference by a procedure of the form
 % {obj# gen# resolveR}.  This is not a possible PDF object, because PDF has
@@ -429,7 +429,7 @@
   } {				% Else object is not executable.
     exch pop //true		% Therefore it must have been resolved.
   } ifelse
-} bind def
+} bind executeonly def
 /oforce /exec load def
 /oget {		% <array> <index> oget <object>
                 % <dict> <key> oget <object>
@@ -437,15 +437,15 @@
                 % object back into the referring slot.  In order to support
                 % PDF linearization, we no longer do this.
   get oforce
-} bind def
+} bind executeonly def
 
 /oforce_array { % <array> oforce_array <array>
   [ exch { oforce } forall ]
-} bind def
+} bind executeonly def
 
 /oforce_elems { % <array> oforce_elems <first> ... <last>
   { oforce } forall
-} bind def
+} bind executeonly def
 
 %% Safe recursion maintain a dicitonary in which we record all the object numbers
 %% of objects which we resolve. Whenever it resolves a new one, it checks all the
@@ -485,11 +485,11 @@
       << exch 2 index <<>> copy  exch { 3 -1 roll exch safe_recursive 3 -1 roll oforce 3 1 roll exch } forall pop>>
     } if
   } ifelse
-} bind def
+} bind executeonly def
 
 /oforce_recursive {
   << >> exch safe_recursive exch pop
-} bind def
+} bind executeonly def
 
 % A null value in a dictionary is equivalent to an omitted key;
 % we must check for this specially.
@@ -501,12 +501,12 @@
   } {
     //false
   } ifelse
-} bind def
+} bind executeonly def
 
 % See /knownoget above.
 /oknown {	% <dict> <key> oknown <bool>
   .knownget { oforce //null ne } { //false } ifelse
-} bind def
+} bind executeonly def
 
 /knownogetdict { % <dict> <key> knownogetdict <dict> true
                  % <dict> <key> knownogetdict false
@@ -513,7 +513,7 @@
   //knownoget exec dup {
     1 index type /dicttype ne { pop pop //false } if
   } if
-} bind def
+} bind executeonly def
 
 % PDF 1.1 defines a 'foreign file reference', but not its meaning.
 % Per the specification, we convert these to nulls.
@@ -520,7 +520,7 @@
 /F {		% <file#> <object#> <generation#> F <object>
                 % Some PDF 1.1 files use F as a synonym for f!
    .pdfcount 3 lt { f } { pop pop pop //null } ifelse
-} bind def
+} bind executeonly def
 
 % Verify the generation number for a specified object
 % Note:  The values in Generations is the generation number plus 1.
@@ -550,7 +550,7 @@
     % Ghostscript tolerant of of bad generation numbers.
     //true
   } ifelse
-} bind def
+} bind executeonly def
 /R {		% <object#> <generation#> R <object>
   %% Parameter validation; this should not be required but we have found files
   %% (Bug 697351) which are corrupted in ways that mean we see a 'R' in a stream
@@ -567,7 +567,7 @@
     (   **** Error: indirect object reference \(R\) encountered with invalid arguments.) pdfformaterror
     (               Output may be incorrect.\n) pdfformaterror
   } ifelse
-} bind def
+} bind executeonly def
 
 % If we encounter an object definition while reading sequentially,
 % we just store it away and keep going.
@@ -578,7 +578,7 @@
 
 /obj {			% <object#> <generation#> obj <object>
   PDFfile objopdict .pdfrun
-} bind def
+} bind executeonly def
 
 /endobj {		% <object#> <generation#> <object> endobj <object>
 
@@ -631,7 +631,7 @@
       pop pop //null
     } ifelse
   }ifelse
-} bind def
+} bind executeonly def
 
 % When resolving an object reference in an object stream, we stop at
 % the end of file.  Note:  Objects in an object stream do not have either
@@ -638,12 +638,12 @@
 % a starting 'obj' or and ending 'endobj'.
 /resolveobjstreamopdict mark
   valueopdict { } forall
-  (%%EOF) cvn { exit } bind
+  (%%EOF) cvn { exit } bind executeonly
   /endobj {  % bug 689795
     (   **** Error: Objects in an object stream should not have 'endobj'.\n)
     pdfformaterror
     (               Output may be incorrect.\n) pdfformaterror
-  } bind
+  } bind executeonly
 .dicttomark readonly def
 
 % Note: This version of this function is not currently being used.
@@ -722,7 +722,7 @@
     Objects exch 2 index exch put	% Put object into Objects array
   } if
   pop pop pop pop		% Clear stack
-} bind def
+} bind executeonly def
 
 /no_debug_dict <<
   /PDFDEBUG //false
@@ -792,7 +792,7 @@
     pop 			% Remove loop index
   } for
   pop pop pop pop pop		% Remove strm# objstream, N, (obj#], and [objects]
-} bind def
+} bind executeonly def
 
 currentdict /no_debug_dict undef
 
@@ -803,7 +803,7 @@
      (   **** Error: Encountered 'xref' while expecting 'endobj'.\n) pdfformaterror
      (               Treating this as a missing 'endobj', output may be incorrect.\n) pdfformaterror
      endobj exit
-  } bind
+  } bind executeonly
   /endstream { endobj exit } bind
   /endobj { endobj exit } bind
   /endjobj { % Bug 689876.
@@ -810,12 +810,12 @@
      (   **** Error: Operator 'endobj' is misspelled as 'endjobj'.\n) pdfformaterror
      (               Output may be incorrect.\n) pdfformaterror
      endobj exit
-  } bind
+  } bind executeonly
   /enbobj { % Bug 690397.
      (   **** Error: Operator 'endobj' is misspelled as 'enbobj'.\n) pdfformaterror
      (               Output may be incorrect.\n) pdfformaterror
      endobj exit
-  } bind
+  } bind executeonly
   /obj {
                 % OmniForm generates PDF file with endobj missing in some
                 % objects. AR ignores this. So we have to do it too.
@@ -822,7 +822,7 @@
      (   **** Error: Encountered 'obj' while expecting 'endobj'.\n) pdfformaterror
      (               Treating this as a missing 'endobj', output may be incorrect.\n) pdfformaterror
      pop pop endobj exit
-  } bind
+  } bind executeonly
 .dicttomark readonly def
 
 /resolveR {             % <object#> <generation#> resolveR <object>
@@ -896,7 +896,7 @@
    }
    {exch pop}
    ifelse
-} bind def
+} bind executeonly def
 
 % ================================ Streams ================================ %
 
@@ -1010,11 +1010,11 @@
     } if
   } ifelse
   cvx
-} bind def
+} bind executeonly def
 
 /endstream {
   exit
-} bind def
+} bind executeonly def
 
 % Contrary to the published PDF (1.3) specification, Acrobat Reader
 % accepts abbreviated filter names everywhere, not just for in-line images,
@@ -1053,7 +1053,7 @@
                 % No filters: ignore parameters, if any.
     pop //null { }
   } ifelse
-} bind def
+} bind executeonly def
 /filtername {		% <filtername> filtername <filtername'>
   //unabbrevfilterdict 1 index .knownget { exch pop } if
   dup /Filter resourcestatus { pop pop } {
@@ -1067,7 +1067,7 @@
     % provide a filter that returns EOF (no data)
     /.EOFDecode
   } ifelse
-} bind def
+} bind executeonly def
 
 /pdf_rules_dict << /PDFRules //true >> readonly def
 
@@ -1084,7 +1084,7 @@
       //pdf_rules_dict exch
     } ifelse
   } if
-} bind def
+} bind executeonly def
 
 currentdict /pdf_rules_dict undef
 
@@ -1114,7 +1114,7 @@
     } ifelse
   } ifelse
   forall exch pop
-} bind def
+} bind executeonly def
 
 % JBIG2 streams have an optional 'globals' stream obj for
 % sharing redundant data between page images. Here we resolve
@@ -1136,7 +1136,7 @@
     1 index exch
     /.jbig2globalctx exch put
   } if
-} bind def
+} bind executeonly def
 
 % Resolve a stream dictionary to a PostScript stream.
 % Streams with no filters require special handling:
@@ -1197,17 +1197,17 @@
   } ifelse
                 % Stack: readdata? dict file
   exch pop exch pop
-} bind def
+} bind executeonly def
 
 % ============================ Name/number trees ============================ %
 
 /nameoget {		% <nametree> <key> nameoget <obj|null>
   exch /Names exch .treeget
-} bind def
+} bind executeonly def
 
 /numoget {		% <numtree> <key> numoget <obj|null>
   exch /Nums exch .treeget
-} bind def
+} bind executeonly def
 
 /.treeget {		% <key> <leafkey> <tree> .treeget <obj|null>
   dup /Kids knownoget {
@@ -1215,7 +1215,7 @@
   } {
     exch oget .leafget
   } ifelse
-} bind def
+} bind executeonly def
 
 /.branchget {		%  <key> <leafkey> <kids> .branchget <obj|null>
   dup length 0 eq {
@@ -1237,7 +1237,7 @@
       } ifelse
     } ifelse
   } ifelse
-} bind def
+} bind executeonly def
 
 /.leafget {		% <key> <pairs> .leafget <obj|null>
   dup length 2 eq {
@@ -1249,7 +1249,57 @@
     3 index gt { 0 exch } { 1 index length 1 index sub } ifelse
     getinterval .leafget
   } ifelse
-} bind def
+} bind executeonly def
 
+% The following variants return tree entry whose key is closest but
+% less or equal to the given key.
+
+/numogetle {		% <numtree> <key> numogetle <key obj true|false>
+  exch /Nums exch .treegetle
+} bind executeonly def
+
+/.treegetle {		% <key> <leafkey> <tree> .treegetle <key obj true|false>
+  dup /Kids knownoget {
+    exch pop .branchgetle
+  } {
+    exch oget .leafgetle
+  } ifelse
+} bind executeonly def
+
+/.branchgetle {		%  <key> <leafkey> <kids> .branchgetle  <key obj true|false>
+    dup length 0 eq {
+        pop pop pop false
+    } {
+        dup length -1 bitshift 2 copy oget
+        dup /Limits oget aload pop
+        % Stack: key leafkeyb kids mid kids[mid] min max
+        6 index ge {
+            5 index le {
+                exch pop exch pop .treegetle
+            } {
+                pop 0 exch getinterval .branchgetle
+            } ifelse
+        } {
+            pop 2 index length 2 index sub 1 gt {
+                pop 1 index length 1 index sub getinterval .branchgetle
+            } {
+                exch pop exch pop .treegetle
+            } ifelse
+        } ifelse
+    } ifelse
+} bind executeonly def
+
+/.leafgetle {		% <key> <pairs> .leafget <obj|null>
+    dup length 2 eq {
+        dup 0 get
+        2 index le { exch pop aload pop true } { pop pop false } ifelse
+    } {
+        dup length -1 bitshift -2 and 2 copy oget
+        % Stack: key pairs mid pairs[mid]
+        3 index gt { 0 exch } { 1 index length 1 index sub } ifelse
+        getinterval .leafgetle
+    } ifelse
+} bind executeonly def
+
 end			% pdfdict
 .setglobal

Modified: trunk/Master/tlpkg/tlgs/Resource/Init/pdf_draw.ps
===================================================================
--- trunk/Master/tlpkg/tlgs/Resource/Init/pdf_draw.ps	2018-09-04 21:40:52 UTC (rev 48581)
+++ trunk/Master/tlpkg/tlgs/Resource/Init/pdf_draw.ps	2018-09-04 22:33:58 UTC (rev 48582)
@@ -68,7 +68,7 @@
                 % Stack: filepos fndict data
   exch dup /DataSource 4 -1 roll put
   exch PDFfile exch setfileposition
-} bdef
+} bind executeonly def
 
 /.resolvefn2 {
   dup length dict .copydict
@@ -75,7 +75,7 @@
   dup /C0 2 copy knownoget { put } { pop pop } ifelse
   dup /C1 2 copy knownoget { put } { pop pop } ifelse
   dup /N 2 copy knownoget { put } { pop pop } ifelse
-} bdef
+} bind executeonly def
 
 /.resolvefn3 {
   dup length dict .copydict
@@ -85,7 +85,7 @@
     oforce .resolvefn
   } forall
   counttomark -1 roll astore exch pop put
-} bdef
+} bind executeonly def
 
 /.resolvefn4 {
   PDFfile fileposition exch             % filepos fndict
@@ -102,7 +102,7 @@
   .bind
   1 index /Function 3 -1 roll put
   exch PDFfile exch setfileposition
-} bdef
+} bind executeonly def
 
 /.resolvefn {		% <fndict> .resolvefn <fndict'>
   dup length dict .copydict
@@ -109,24 +109,24 @@
   dup /Domain 2 copy knownoget { put } { pop pop } ifelse
   dup /Range 2 copy knownoget { put } { pop pop } ifelse
   dup /FunctionType oget //fnrdict exch get exec
-} bdef
+} bind executeonly def
 
 /resolvefunction {	% <fndict> resolvefunction <function>
   .resolvefn
   PDFDEBUG { pdfdict /PDFSTEPcount .knownget { 1 le } { //true } ifelse { (%Function: ) print dup === flush } if } if
-} bdef
+} bind executeonly def
 
 /resolvefnproc {	% <fndict> resolvefnproc <proc>
   resolvefunction .buildfunction
-} bdef
+} bind executeonly def
 
 /resolveidfnproc {	% <fndict> resolveidfnproc <proc>
   dup /Identity eq { pop { } } { resolvefnproc } ifelse
-} bdef
+} bind executeonly def
 
 /resolvedefaultfnproc {	% <fndict> <default> resolved'fnproc <proc>
   1 index /Default eq { exch pop } { pop resolveidfnproc } ifelse
-} bdef
+} bind executeonly def
 
 %% A BBox where width or height (or both) is 0 should still paint one pixel
 %% See the ISO 32000-2:2017 spec, section 8.7.4.3, p228 'BBox' and 8.7.3.1
@@ -140,7 +140,7 @@
     2 index 0.000001 add exch pop
   }if
   5 -1 roll astore
-}bind def
+}bind executeonly def
 
 % ---------------- Shadings ---------------- %
 
@@ -159,15 +159,15 @@
     } repeat
     5 -1 roll
     astore
-  } bind
+  } bind executeonly
   /BBox {
     dup dup dup aload pop normrect_elems
     5 -1 roll astore
     FixPatternBBox
-  } bind
+  } bind executeonly
   /ColorSpace {
     resolvecolorspace
-  } bind
+  } bind executeonly
   /Function {
     dup type /dicttype eq {
       resolvefunction
@@ -174,10 +174,10 @@
     } {
       [ exch { oforce resolvefunction } forall ]
     } ifelse
-  } bind
+  } bind executeonly
   /Extend {
     mark exch {oforce} forall ]
-  } bind
+  } bind executeonly
 .dicttomark readonly def
 
 /resolveshading {	% <shadingstream> resolveshading <shading>
@@ -201,7 +201,7 @@
     exch PDFfile exch setfileposition
     dup 3 1 roll /.shading_dict exch put
   } ifelse
-} bdef
+} bind executeonly def
 /resolvesh {		% <shname> resolvesh <shading>
                         % <shname> resolvesh <null>
   Page /Shading rget {
@@ -218,7 +218,7 @@
   } {
     //null
   }ifelse
-} bdef
+} bind executeonly def
 
 % ---------------- Halftones ---------------- %
 
@@ -229,7 +229,7 @@
     } {
       1 sub dup mul exch 1 sub dup mul add 1 sub
     } ifelse
-  } bind
+  } bind executeonly
   /Diamond {
     abs exch abs 2 copy add .75 le {
       dup mul exch dup mul add 1 exch sub
@@ -240,7 +240,7 @@
         1 sub dup mul exch 1 sub dup mul add 1 sub
       } ifelse
     } ifelse
-  } bind
+  } bind executeonly
   /Ellipse {
     abs exch abs 2 copy 3 mul exch 4 mul add 3 sub dup 0 lt {
       pop dup mul exch .75 div dup mul add 4 div 1 exch sub
@@ -252,27 +252,27 @@
         .5 exch sub exch pop exch pop
       } ifelse
     } ifelse
-  } bind
-  /EllipseA { dup mul .9 mul exch dup mul add 1 exch sub } bind
-  /InvertedEllipseA { dup mul .9 mul exch dup mul add 1 sub } bind
-  /EllipseB { dup 5 mul 8 div mul exch dup mul exch add sqrt 1 exch sub } bind
-  /EllipseC { dup mul .9 mul exch dup mul add 1 exch sub } bind
-  /InvertedEllipseC { dup mul .9 mul exch dup mul add 1 sub } bind
-  /Line { exch pop abs neg } bind
-  /LineX { pop } bind
-  /LineY { exch pop } bind
-  /Square { abs exch abs 2 copy lt { exch } if pop neg } bind
-  /Cross { abs exch abs 2 copy gt { exch } if pop neg } bind
-  /Rhomboid { abs exch abs 0.9 mul add 2 div } bind
-  /DoubleDot { 2 {360 mul sin 2 div exch } repeat add } bind
-  /InvertedDoubleDot { 2 {360 mul sin 2 div exch } repeat add neg } bind
-  /SimpleDot { dup mul exch dup mul add 1 exch sub } bind
-  /InvertedSimpleDot { dup mul exch dup mul add 1 sub } bind
-  /CosineDot { 180 mul cos exch 180 mul cos add 2 div } bind
-  /Double { exch 2 div exch 2 { 360 mul sin 2 div exch } repeat add } bind
+  } bind executeonly
+  /EllipseA { dup mul .9 mul exch dup mul add 1 exch sub } bind executeonly
+  /InvertedEllipseA { dup mul .9 mul exch dup mul add 1 sub } bind executeonly
+  /EllipseB { dup 5 mul 8 div mul exch dup mul exch add sqrt 1 exch sub } bind executeonly
+  /EllipseC { dup mul .9 mul exch dup mul add 1 exch sub } bind executeonly
+  /InvertedEllipseC { dup mul .9 mul exch dup mul add 1 sub } bind executeonly
+  /Line { exch pop abs neg } bind executeonly
+  /LineX { pop } bind executeonly
+  /LineY { exch pop } bind executeonly
+  /Square { abs exch abs 2 copy lt { exch } if pop neg } bind executeonly
+  /Cross { abs exch abs 2 copy gt { exch } if pop neg } bind executeonly
+  /Rhomboid { abs exch abs 0.9 mul add 2 div } bind executeonly
+  /DoubleDot { 2 {360 mul sin 2 div exch } repeat add } bind executeonly
+  /InvertedDoubleDot { 2 {360 mul sin 2 div exch } repeat add neg } bind executeonly
+  /SimpleDot { dup mul exch dup mul add 1 exch sub } bind executeonly
+  /InvertedSimpleDot { dup mul exch dup mul add 1 sub } bind executeonly
+  /CosineDot { 180 mul cos exch 180 mul cos add 2 div } bind executeonly
+  /Double { exch 2 div exch 2 { 360 mul sin 2 div exch } repeat add } bind executeonly
   /InvertedDouble {
     exch 2 div exch 2 { 360 mul sin 2 div exch } repeat add neg
-  } bind
+  } bind executeonly
 .dicttomark readonly def
 
 /.resolveht1 {
@@ -309,13 +309,13 @@
       } if
     } ifelse
   } forall .dicttomark
-} bdef
+} bind executeonly def
 
 /.resolveht5 {
   mark exch {
     oforce dup type /dicttype eq { resolvehalftone } if
   } forall .dicttomark
-} bdef
+} bind executeonly def
 
 /.resolveht6 {
   %% resolvestream will reposition PDFfile. If we are in the middle
@@ -332,7 +332,7 @@
     1 index exch /TransferFunction exch put
   } if
   exch PDFfile exch setfileposition
-} bdef
+} bind executeonly def
 
 /htrdict mark
   1 //.resolveht1
@@ -357,7 +357,7 @@
     (               Output may be incorrect.\n) pdfformaterror
     gsave .setdefaulthalftone currenthalftone grestore
   } ifelse
-} bdef
+} bind executeonly def
 
 % ---------------- Graphics state management ---------------- %
 
@@ -364,8 +364,8 @@
 /cmmatrix matrix def
 drawopdict begin
                         % Graphics state stack
-  /q { q } def
-  /Q { Q } def
+  /q { q } executeonly def
+  /Q { Q } executeonly def
                         % Graphics state setting
   /cm { //cmmatrix astore
         .getpath
@@ -380,15 +380,15 @@
         currentdict /qTextSaveMatrix .knownget {
          //cmmatrix exch dup concatmatrix pop
         } if
-      } bdef
+      } bind executeonly def
 
-  /i { 1 .min setflat } bdef
+  /i { 1 .min setflat } bind executeonly def
   /J { setlinecap } bind 0 get def
   /d { setdash } bind 0 get def
   /j { setlinejoin } bind 0 get def
   /w { setlinewidth } bind 0 get def
-  /M { 1 .max setmiterlimit } bdef
-  /gs { gs } def
+  /M { 1 .max setmiterlimit } bind executeonly def
+  /gs { gs } executeonly def
 end
 
 % Each entry in this dictionary is
@@ -395,10 +395,10 @@
 %	<gsres> <value> -proc- <gsres>
 /gsbg {
   /BGDefault load resolvedefaultfnproc setblackgeneration
-} bdef
+} bind executeonly def
 /gsucr {
   /UCRDefault load resolvedefaultfnproc setundercolorremoval
-} bdef
+} bind executeonly def
 /gstr {
   dup type /arraytype eq {
     { oforce /TRDefault load resolvedefaultfnproc } forall
@@ -406,17 +406,17 @@
   } {
     /TRDefault load resolvedefaultfnproc settransfer
   } ifelse
-} bdef
+} bind executeonly def
 /gsparamdict mark
-  /SA { setstrokeadjust }
-  /OP { 1 index /op known not { dup op } if OP }
+  /SA { setstrokeadjust } executeonly
+  /OP { 1 index /op known not { dup op } if OP } executeonly
         % The PDF 1.3 specification says that the name /Default is only
         % recognized for {BG,UCR,TR}2.  However, PDF 1.3 files produced
         % by Adobe Acrobat Distiller 4.0 for Windows use the name /Default
         % with the older keys, so we have to implement this.
-  /BG { 1 index /BG2 known { pop } { gsbg } ifelse }
-  /UCR { 1 index /UCR2 known { pop } { gsucr } ifelse }
-  /TR { 1 index /TR2 known { pop } { gstr } ifelse }
+  /BG { 1 index /BG2 known { pop } { gsbg } ifelse } executeonly
+  /UCR { 1 index /UCR2 known { pop } { gsucr } ifelse } executeonly
+  /TR { 1 index /TR2 known { pop } { gstr } ifelse } executeonly
 
   % Some functions used to implement phases of HT and HTP
   /sethalftones {
@@ -425,10 +425,10 @@
     } {
       resolvehalftone sethalftone
     } ifelse
-  } bdef
+  } bind executeonly def
   /sethalftonephases {
     /sethalftonephase where { pop aload pop sethalftonephase } { pop } ifelse
-  } bdef
+  } bind executeonly def
 
   /HT {
     dup sethalftones .swapcolors sethalftones .swapcolors
@@ -442,34 +442,34 @@
         /dup /Default eq { oforce gsparamdict /TR get exec } { pop } ifelse
       } if
     } ifelse
-  }
+  } executeonly
   /HTP {
     % HTP may be present even if this isn't a DPS interpreter.
     dup sethalftonephases .swapcolors sethalftonephases .swapcolors
-  }
+  } executeonly
         % PDF 1.3
   % The font is an indirect reference, not a resource name
   /Font { aload pop exch oforce resourcefont exch Tf }
-  /LW { setlinewidth }
-  /LC { setlinecap }
-  /LJ { setlinejoin }
-  /ML { 1 .max setmiterlimit }
-  /D { aload pop setdash }
-  /RI { ri }
-  /op { op }
-  /OPM { OPM }
-  /BG2 { gsbg }
-  /UCR2 { gsucr }
-  /TR2 { gstr }
-  /FL { 1 .min setflat }
+  /LW { setlinewidth } executeonly
+  /LC { setlinecap } executeonly
+  /LJ { setlinejoin } executeonly
+  /ML { 1 .max setmiterlimit } executeonly
+  /D { aload pop setdash } executeonly
+  /RI { ri } executeonly
+  /op { op } executeonly
+  /OPM { OPM } executeonly
+  /BG2 { gsbg } executeonly
+  /UCR2 { gsucr } executeonly
+  /TR2 { gstr } executeonly
+  /FL { 1 .min setflat } executeonly
   /SM {
         % SM may be present even if this is only a Level 2 interpreter.
     /setsmoothness where { pop setsmoothness } { pop } ifelse
-  }
+  } executeonly
         % PDF 1.4
         % All of these require the "transparency" feature in the interpreter.
-  /ca { ca }
-  /CA { CA }
+  /ca { ca } executeonly
+  /CA { CA } executeonly
   /SMask {
     {gssmask} PDFSTOPONERROR { exec //false } { stopped } ifelse
     {
@@ -476,17 +476,17 @@
       pop (\n   **** Error in SMask during ExtGState. Ignoring the mask, output may be incorrect.\n)
       pdfformaterror
     } if
-  }
-  /AIS { AIS }
-  /BM { BM }
-  /TK { TK }
-  /UseBlackPtComp { UseBlackPtComp }
+  } executeonly
+  /AIS { AIS } executeonly
+  /BM { BM } executeonly
+  /TK { TK } executeonly
+  /UseBlackPtComp { UseBlackPtComp } executeonly
   /HTO {
     % PDF 2.0, supposed to be 'similar' to halftone phase but using a different
     % co-ordiate system. Treat the same for now and fix if anyone ever complains.
     aload pop transform cvi exch cvi exch 2 array astore
     dup sethalftonephases .swapcolors sethalftonephases .swapcolors
-  }
+  } executeonly
 .dicttomark readonly def
 /gs {			% <gsres> gs -
   Page /ExtGState rget {
@@ -496,7 +496,7 @@
       oforce exch gsparamdict exch .knownget { exec } { pop } ifelse
     } forall pop
   } if
-} bdef
+} bind executeonly def
 
 % ------ Transparency support ------ %
 
@@ -583,7 +583,7 @@
     exit
   } loop
   SMask
-} bdef
+} bind executeonly def
 
 % Functions specific to the Device* colorspaces to force the switch to
 % the Device* colorspace so that the SMask will not get a CIEBased* colorspace
@@ -592,7 +592,7 @@
 /forceDefaultCS <<
   {
     currentcolorspace setcolorspace	% this will switch to Device colorspace
-  } bind
+  } bind executeonly
   /DeviceGray exch
   /DeviceRGB 1 index
   /DeviceCMYK 1 index
@@ -664,7 +664,7 @@
   setmatrix
   end	% restore colorspace, color and ExtGState (end)
   .currentSMask /Processed //true put % special setting to tell us it has been rendered
-} bdef
+} bind executeonly def
 
 % Paint a Form+Group XObject, either for a transparency mask or for a Do.
 /.execgroup {		% [colour values] <colour space> <resdict> <stream> .execgroup -
@@ -699,7 +699,7 @@
   .pdfruncontext
   end grestore
   /pdfemptycount exch store
-} bdef
+} bind executeonly def
 
 /.beginformgroup {	% groupdict bbox .beginformgroup -
   exch mark exch			% bbox mark groupdict
@@ -710,7 +710,7 @@
                 % Stack: bbox paramdict
   exch aload pop
   .begintransparencygroup
-} bdef
+} bind executeonly def
 
 % .paintgroupform implements the Form PaintProc in the case where the
 % Form XObject dictionary includes a Group key.  See .paintform below.
@@ -725,7 +725,7 @@
   .beginformgroup
   .execgroup
   .endtransparencygroup
-} bdef
+} bind executeonly def
 
 % Make an ImageType 103 (soft-masked) image.
 /makesoftmaskimage {	% <datasource> <imagemask> <SMask> makesoftmaskimage
@@ -759,7 +759,7 @@
   .currentalphaisshape
   { /ShapeMaskDict } { /OpacityMaskDict } ifelse exch def
   /ColorSpace DataDict /ColorSpace get def
-} bdef
+} bind executeonly def
 
 % ---------------- Color setting ---------------- %
 
@@ -769,17 +769,17 @@
 
 % The keys here are resolved (PostScript, not PDF) color space names.
 /csncompdict 9 dict begin
-  /DeviceGray { pop 1 } bdef
-  /DeviceRGB { pop 3 } bdef
-  /DeviceCMYK { pop 4 } bdef
+  /DeviceGray { pop 1 } bind executeonly def
+  /DeviceRGB { pop 3 } bind executeonly def
+  /DeviceCMYK { pop 4 } bind executeonly def
   /CIEBasedA //DeviceGray def
   /CIEBasedABC //DeviceRGB def
   /CalGray //DeviceGray def
   /CalRGB //DeviceRGB def
   /Lab //DeviceRGB def
-  /ICCBased { 1 oget /N oget } bdef
+  /ICCBased { 1 oget /N oget } bind executeonly def
   /Separation //DeviceGray def
-  /DeviceN { 1 oget length } bdef
+  /DeviceN { 1 oget length } bind executeonly def
   /Indexed  //DeviceGray def
 currentdict end readonly def
 
@@ -787,7 +787,7 @@
 /csncomp {
   dup dup type /arraytype eq { 0 oget } if
   //csncompdict exch get exec
-} bdef
+} bind executeonly def
 
 currentdict /csncompdict undef
 
@@ -832,26 +832,26 @@
   } {
     pop 			% remove colorspace dictionary
   } ifelse
-} bdef
+} bind executeonly def
 
 /csrdict 13 dict begin
-  /DeviceGray { } bdef
-  /DeviceRGB { } bdef
-  /DeviceCMYK { } bdef
+  /DeviceGray { } bind executeonly def
+  /DeviceRGB { } bind executeonly def
+  /DeviceCMYK { } bind executeonly def
 
-  /CalGray { 1 oget [ exch /CalGray exch ] } bdef
-  /CalRGB { 1 oget [ exch /CalRGB exch ] } bdef
-  /Lab { 1 oget [ exch /Lab exch ] } bdef
+  /CalGray { 1 oget [ exch /CalGray exch ] } bind executeonly def
+  /CalRGB { 1 oget [ exch /CalRGB exch ] } bind executeonly def
+  /Lab { 1 oget [ exch /Lab exch ] } bind executeonly def
 
   /CalCMYK {
     pop /DeviceCMYK		% not defined by Adobe
-  } bdef
+  } bind executeonly def
 
   /ICCBased {
     dup 1 get type /dicttype ne {	% don't resolve more than once
       ICCBased-resolve
     } if
-  } bdef
+  } bind executeonly def
 
   /Separation {
     aload pop exch oforce resolvecolorspace
@@ -863,7 +863,7 @@
     3 -1 roll oforce 3 1 roll
 
     4 array astore
-  } bdef
+  } bind executeonly def
 
   /DeviceN {
     [ exch aload pop ]			% Copy into a new array
@@ -890,7 +890,7 @@
         } if
       4 exch put			% Put resolved or new attributes dict
     } if
-  } bdef
+  } bind executeonly def
 
   /Indexed {
     aload pop
@@ -959,7 +959,7 @@
         } if
       } if
     } if pop
-  } bdef
+  } bind executeonly def
 
   /I { % Bug 689815
     (   **** Error: The name /Indexed cannot be abbreviated to /I in the color space\n)
@@ -967,7 +967,7 @@
     (               Output may be incorrect.\n) pdfformaterror
     dup 0 /Indexed put
     //Indexed exec
-  } bdef
+  } bind executeonly def
 
   /Pattern {
     dup type /nametype ne {
@@ -976,7 +976,7 @@
         /Pattern exch 2 array astore
       } if
     } if
-  } bdef
+  } bind executeonly def
 
 currentdict end readonly def
 
@@ -984,7 +984,7 @@
                         % <csname> cssubst false
   dup resolvecolorspace
   dup 1 index ne { exch pop //true } { pop pop //false } ifelse
-} bdef
+} bind executeonly def
 
 /csnames mark
   /DeviceGray dup  /DeviceRGB dup  /DeviceCMYK dup  /Pattern dup
@@ -1012,7 +1012,7 @@
       } ifelse
     } ifelse
   } ifelse
-} bdef
+} bind executeonly def
 
 /resolvecolorspace {	% <cspace> resolvecolorspace <cspace'>
   dup type /dicttype eq {
@@ -1043,7 +1043,7 @@
       } ifelse
     } ifelse
   } if
-} bdef
+} bind executeonly def
 
 /scresolve {	% <c0> ... scresolve <multi>
                 % We can't really make sc[n] and SC[N] work, because
@@ -1061,7 +1061,7 @@
   } {
     .pdfcount 1 gt
   } ifelse
-} bdef
+} bind executeonly def
 
 %% Bug #696017 When we begin a text block, we switch to a special set of marking operations
 %% for paths, these ops don't use the current CTM, but the 'SavedTextMatrix', in order to
@@ -1158,19 +1158,24 @@
   Q
   PDFDEBUG { pdfdict /PDFSTEPcount .knownget { 1 le } { //true } ifelse { (%End PaintProc) print dup === flush } if } if
   PDFfile exch setfileposition
-} bdef
+} bind executeonly def
 
 /.pdfpaintproc {
     %% Get the /m from pdfopdict (must be present)
     %% and check its a packedarray
     pdfopdict /m get dup type /packedarraytype eq {
-      %% get the initial element of the packedarray
-      %% and check its a name
-      0 get dup type /nametype eq {
-        %% If the name is inside_text_m then we are in a text block
-        /inside_text_m eq
+      %% The non-text version of /m is executeonly, so if we can't read it, its not a text block.
+      dup rcheck {
+        %% get the initial element of the packedarray
+        %% and check its a name
+        0 get dup type /nametype eq {
+          %% If the name is inside_text_m then we are in a text block
+          /inside_text_m eq
+          }{
+             pop false
+          } ifelse
         }{
-           pop false
+          pop false
         } ifelse
     }{
       pop false
@@ -1184,7 +1189,7 @@
     {
       switch_to_text_marking_ops
     } if
-}bdef
+}bind executeonly def
 
 /resolvepattern {	% <patternstreamdict> resolvepattern <patterndict>
                 % Don't do the resolvestream now: just capture the data
@@ -1223,7 +1228,7 @@
   dup /BBox 2 copy knownoget { normrect FixPatternBBox put } { pop pop } ifelse
   dup /.pattern_uses_transparency  1 index patternusestransparency put
   PDFDEBUG { pdfdict /PDFSTEPcount .knownget { 1 le } { //true } ifelse { (%Pattern: ) print dup === flush } if } if
-} bdef
+} bind executeonly def
 
 /ignore_color_op  (   **** Error: Ignoring a color operation in a cached context.\n               Output may be incorrect.\n) readonly def
 
@@ -1233,7 +1238,7 @@
         } {
           /DeviceGray cssubst { cs sc1 } { g } ifelse
         } ifelse
-      } bdef
+      } bind executeonly def
 
   /rg { .incachedevice {
           pop pop pop //ignore_color_op pdfformaterror
@@ -1240,7 +1245,7 @@
         } {
           /DeviceRGB cssubst { cs sc* } { rg } ifelse
         } ifelse
-      } bdef
+      } bind executeonly def
 
   /k  { .incachedevice {
           pop pop pop pop //ignore_color_op pdfformaterror
@@ -1247,7 +1252,7 @@
         } {
           k
         } ifelse
-      } bdef
+      } bind executeonly def
 
   /cs { .incachedevice {
           pop //ignore_color_op pdfformaterror
@@ -1254,7 +1259,7 @@
         } {
           csresolve { cs } if
         } ifelse
-      } bdef
+      } bind executeonly def
 
   /sc { .incachedevice {
           .pdfcount { pop } repeat //ignore_color_op pdfformaterror
@@ -1266,7 +1271,7 @@
             { sc*_and_set } { sc1_and_set } ifelse
           } ifelse
         } ifelse
-      } bdef
+      } bind executeonly def
 
   /scn /sc load def
 
@@ -1275,7 +1280,7 @@
         } {
           /DeviceGray cssubst { CS SC1 } { G } ifelse
         } ifelse
-      } bdef
+      } bind executeonly def
 
   /RG { .incachedevice {
           pop pop pop //ignore_color_op pdfformaterror
@@ -1282,7 +1287,7 @@
         } {
           /DeviceRGB cssubst { CS SC* } { RG } ifelse
         } ifelse
-      } bdef
+      } bind executeonly def
 
   /K  { .incachedevice {
           pop pop pop pop //ignore_color_op pdfformaterror
@@ -1289,7 +1294,7 @@
         } {
           K
         } ifelse
-      } bdef
+      } bind executeonly def
 
   /CS { .incachedevice {
           pop //ignore_color_op pdfformaterror
@@ -1296,7 +1301,7 @@
         } {
           csresolve { CS } if
         } ifelse
-      } bdef
+      } bind executeonly def
 
   /ri { .incachedevice {
           pop //ignore_color_op pdfformaterror
@@ -1303,7 +1308,7 @@
         } {
           ri
         } ifelse
-      } bdef
+      } bind executeonly def
 
   /SC { .incachedevice {
           .pdfcount { pop } repeat //ignore_color_op pdfformaterror
@@ -1315,7 +1320,7 @@
             { SC*_and_set } { SC1_and_set } ifelse
           }ifelse
         } ifelse
-      } bdef
+      } bind executeonly def
 
   /SCN /SC load def
 end
@@ -1326,9 +1331,9 @@
 
 drawopdict begin
                         % Path construction
-  /m { { moveto }  stopped { count pdfemptycount sub 2 .min { pop } repeat 0 0 moveto } if } bdef
-  /l { { lineto }  stopped { count pdfemptycount sub 2 .min { pop } repeat } if } bdef
-  /c { { curveto } stopped { count pdfemptycount sub 6 .min { pop } repeat } if } bdef
+  /m { { moveto }  stopped { count pdfemptycount sub 2 .min { pop } repeat 0 0 moveto } if } bind executeonly def
+  /l { { lineto }  stopped { count pdfemptycount sub 2 .min { pop } repeat } if } bind executeonly def
+  /c { { curveto } stopped { count pdfemptycount sub 6 .min { pop } repeat } if } bind executeonly def
 
   /v { count pdfemptycount sub 4 ge {
          { currentpoint 6 2 roll curveto } stopped { count pdfemptycount sub 6 .min { pop } repeat  } if
@@ -1335,27 +1340,27 @@
        } {
          count pdfemptycount sub { pop } repeat
        } ifelse
-     } bdef
-  /y { { 2 copy curveto } stopped { count pdfemptycount sub 6 .min { pop } repeat } if } bdef
+     } bind executeonly def
+  /y { { 2 copy curveto } stopped { count pdfemptycount sub 6 .min { pop } repeat } if } bind executeonly def
 
   /re {
    4 2 roll moveto  exch dup 0 rlineto  0 3 -1 roll rlineto  neg 0 rlineto
    closepath
-  } bdef
+  } bind executeonly def
 
   /h { closepath } bind 0 get def
                         % Path painting and clipping
-  /n { n } def
-  /S { S } def
-  /s { s } def
-  /f { f } def
-  /f* { f* } def
-  /B { B } def
-  /b { b } def
-  /B* { B* } def
-  /b* { b* } def
-  /W { W } def
-  /W* { W* } def
+  /n { n } executeonly def
+  /S { S } executeonly def
+  /s { s } executeonly def
+  /f { f } executeonly def
+  /f* { f* } executeonly def
+  /B { B } executeonly def
+  /b { b } executeonly def
+  /B* { B* } executeonly def
+  /b* { b* } executeonly def
+  /W { W } executeonly def
+  /W* { W* } executeonly def
 
   /sh_save 1 array def
   /sh_group  << /Subtype /Group /Isolated //true >> readonly def
@@ -1365,15 +1370,14 @@
     { dup /.shading .knownget {
         exch pop
       } {
-       .buildshading
+       .buildshading_and_shfill
       } ifelse
-      .shfill
     } stopped {
       pop
       (   **** Error: Ignoring invalid smooth shading object, output may be incorrect.\n)
       pdfformaterror
     } if
-  } bdef
+  } bind executeonly def
 
   /sh {
       OFFlevels length 0 eq {
@@ -1417,7 +1421,7 @@
       } {
         pop
       } ifelse
-    } bdef
+    } bind executeonly def
   currentdict dup /sh_save undef /sh_group undef
 end
 
@@ -1424,22 +1428,22 @@
 % ---------------- XObjects ---------------- %
 
 /xobjectprocs mark		% <dict> -proc- -
-  /Image { DoImage }
-  /Form { DoForm }
-  /PS { DoPS }
+  /Image { DoImage } executeonly
+  /Form { DoForm } executeonly
+  /PS { DoPS } executeonly
 .dicttomark readonly def
 
 % Note that the keys in defaultdecodedict are resolved (PostScript, not PDF)
 % color space names.
 /defaultdecodedict mark
-  /DeviceGray { pop //01_1 } bind
-  /DeviceRGB { pop //01_3 } bind
-  /DeviceCMYK { pop //01_4 } bind
-  /CIEBasedA { 1 get /RangeA knownoget not { //01_1 } if } bind
-  /CIEBasedABC { 1 get /RangeABC knownoget not { //01_3 } if } bind
-  /CalGray { pop //01_1 } bind
-  /CalRGB { pop //01_3 } bind
-  /Lab { 1 get /Range knownoget not { [-100 100 -100 100] } {aload pop 0 100 6 2 roll 6 array astore}ifelse } bind
+  /DeviceGray { pop //01_1 } bind executeonly
+  /DeviceRGB { pop //01_3 } bind executeonly
+  /DeviceCMYK { pop //01_4 } bind executeonly
+  /CIEBasedA { 1 get /RangeA knownoget not { //01_1 } if } bind executeonly
+  /CIEBasedABC { 1 get /RangeABC knownoget not { //01_3 } if } bind executeonly
+  /CalGray { pop //01_1 } bind executeonly
+  /CalRGB { pop //01_3 } bind executeonly
+  /Lab { 1 get /Range knownoget not { [-100 100 -100 100] } {aload pop 0 100 6 2 roll 6 array astore}ifelse } bind executeonly
   /ICCBased {
      1 oget dup /Range knownoget {
        exch pop
@@ -1446,14 +1450,14 @@
      }{
        /N get [ exch {0 1} repeat ] readonly
      } ifelse
-  } bind
-  /Separation { pop //01_1 } bind
+  } bind executeonly
+  /Separation { pop //01_1 } bind executeonly
   /DeviceN {
     1 oget length [ exch {0 1} repeat ] readonly
-  } bind
+  } bind executeonly
   /Indexed {
     pop [ 0 1 BitsPerComponent bitshift 1 sub ]
-  } bind
+  } bind executeonly
 .dicttomark readonly def
 
 /checkaltimage {	% <resdict> checkaltimage <resdict[']>
@@ -1472,23 +1476,23 @@
       } forall
     } if
   } if
-} bdef
+} bind executeonly def
 
 % <string> <index> getu16 <integer>
 /getu16 {
   2 copy get 8 bitshift 3 1 roll 1 add get add
-} bind def
+} bind executeonly def
 
 % <string> <index> getu32 <integer>
 /getu32 {
   2 copy getu16 16 bitshift 3 1 roll 2 add getu16 add
-} bind def
+} bind executeonly def
 
 /jp2_csp_dict mark
   12 { /DeviceCMYK }       % CMYK
   14 { [ /Lab << /WhitePoint [ 0.9505 1 1.0890 ] readonly >> ] }              % LAB, WhitePoint == D65
-  16 { /sRGBICC /ColorSpace findresource } bind
-  17 { /sGrayICC /ColorSpace findresource } bind
+  16 { /sRGBICC /ColorSpace findresource } bind executeonly
+  17 { /sGrayICC /ColorSpace findresource } bind executeonly
   18 3 index               % YCC is converted to RGB
 % 19                       % CIEJab not supportec by PDF 1.7
 % 20                       % e-sRGB
@@ -1502,7 +1506,7 @@
 
   /jp2h { % descend into a sub-stream, don't return.
     () /SubFileDecode filter 0
-  } bdef
+  } bind executeonly def
 
   /ihdr {
     14 sub                                   % file len-14
@@ -1519,7 +1523,7 @@
       dup 12 eq { pop 16 } if
       /BitsPerComponent exch def               % file len-14
     } {pop} ifelse
-  } bdef
+  } bind executeonly def
 
   %% if the ihdr has a BPC of 255 then we get a bpcc box which
   %% gives the bpc for each component individually. We cannot
@@ -1540,7 +1544,7 @@
 
     pop
     /BitsPerComponent BitsPerComponent 1 add def
-  } bdef
+  } bind executeonly def
 
   /colr {
     currentdict /ColorSpace known not {
@@ -1569,7 +1573,7 @@
         } ifelse
       } ifelse
     } if
-  } bdef
+  } bind executeonly def
 
   % Palette colors are decoded by the library.
   /pclr {
@@ -1577,7 +1581,7 @@
     1 index (1234) readstring pop
     3 get 16#7F and 1 add
     /BitsPerComponent exch def
-  } bdef
+  } bind executeonly def
 
   /cdef {
     pop
@@ -1593,7 +1597,7 @@
       } ifelse
     } repeat
     0
-  } bdef
+  } bind executeonly def
 
 currentdict end readonly def
 
@@ -1635,7 +1639,7 @@
     } ifelse
   } loop
   pop
-} bind def
+} bind executeonly def
 
 currentdict /jp2_tag_dict .undef
 currentdict /jp2_csp_dict .undef
@@ -1677,7 +1681,7 @@
   } ifelse
   1 index exch
   /DecodeParms exch put                  % <resdict>
-} bdef
+} bind executeonly def
 
 /last-ditch-bpc-csp {
   currentdict /BitsPerComponent oknown not {
@@ -1749,7 +1753,7 @@
     } if
   } if
   /ColorSpace exch def
-} bdef
+} bind executeonly def
 
 /get-smask-in-data { % <dict> -> <int>
   /SMaskInData knownoget {
@@ -1759,7 +1763,7 @@
   } {
     0
   } ifelse
-} bdef
+} bind executeonly def
 
 /makeimagedict {	% <resdict> <newdict> makeimagedict <imagemask?>
                         % On return, newdict' is currentdict
@@ -1770,7 +1774,7 @@
   /BitsPerComponent 2 copy knownoget { cvi def } { pop } ifelse
   /Interpolate 2 copy knownoget { def } { pop } ifelse
   makeimagekeys
-} bdef
+} bind executeonly def
 
 /makeimagekeys {	% <resdict> makeimagekeys <imagemask>
                 % newdict is currentdict
@@ -2034,7 +2038,7 @@
     //false resolvestream /DataSource exch def
     //false
   } ifelse
-} bdef
+} bind executeonly def
 
 currentdict /add-to-last-param undef
 currentdict /last-ditch-bpc-csp undef
@@ -2072,7 +2076,7 @@
   } if
   1 index /Mask knownoget { 1 index exch /Mask exch put } if
   makeimagedict doimagesmask
-} bdef
+} bind executeonly def
 /makemaskimage {	% <datasource> <imagemask> <Mask> makemaskimage
                         %   <datasource> <imagemask>, updates currentdict =
                         %   imagedict
@@ -2174,7 +2178,7 @@
     /MaskDict exch def
     /ColorSpace DataDict /ColorSpace get def
   } ifelse
-} bdef
+} bind executeonly def
 
 /doimagesmask { % <imagemask> doimagesmask -
   PDFusingtransparency {
@@ -2224,7 +2228,7 @@
     { doimage }
     ifelse
   } ifelse
-} bdef
+} bind executeonly def
 
 % For development needs we define a special option for running with a new handler
 % for images with a soft mask.
@@ -2231,7 +2235,7 @@
 //systemdict /NEW_IMAGE3X .knownget not { //false } if {
   /doimagesmask { % <imagemask> doimagesmask -
     doimage
-  } bdef
+  } bind executeonly def
 } if
 
 /ValidateDecode { % <<image dict>> -imagemask- ValidateDecode <<image dict>>
@@ -2270,7 +2274,7 @@
   } {
     exch pop
   }ifelse
-}bdef
+}bind executeonly def
 
 /doimage {	% <imagemask> doimage -
                 % imagedict is currentdict, gets popped from dstack
@@ -2332,7 +2336,7 @@
      .endtransparencygroup
      OPsavedict dup /saveOA get .setopacityalpha /saveBM get .setblendmode
   } if
-} bdef
+} bind executeonly def
 
 /.paintform {	% <formdict> <resdict> <stream> .paintform -
   1 index /FormResDict gput  % For broken forms that inherit resources from the context.
@@ -2341,7 +2345,7 @@
   } {
     pop pdfopdict .pdfruncontext
   } ifelse
-} bdef
+} bind executeonly def
 
 /IncrementAppearanceNumber {
   pdfdict /AppearanceNumber .knownget {
@@ -2349,7 +2353,7 @@
   }{
     pdfdict /AppearanceNumber 0 .forceput
   } ifelse
-}bdef
+}bind executeonly def
 
 /MakeAppearanceName {
   pdfdict /AppearanceNumber get
@@ -2358,12 +2362,12 @@
   dup 3 -1 roll
   9 exch putinterval
   dup dup length 1 sub (\}) putinterval
-} bdef
+} bind executeonly def
 
 /MakeNewAppearanceName {
   IncrementAppearanceNumber
   MakeAppearanceName
-}bdef
+}bind executeonly def
 
 /DoAppearance {
 %% Might need to rethink this. The problem is that if the page has a CropBox, we apply
@@ -2378,7 +2382,7 @@
   DoForm
   pdfdict /.PreservePDFForm 3 -1 roll .forceput
   grestore
-} bdef
+} bind executeonly def
 
 /DoForm {
   %% save the current value, if its true we will set it to false later, in order
@@ -2537,7 +2541,7 @@
     end
   } if
   pdfdict /.PreservePDFForm 3 -1 roll .forceput
-} bdef
+} bind executeonly def
 
 /_dops_save 1 array def
 
@@ -2550,7 +2554,7 @@
    }
    { pop }
   ifelse
-} bdef
+} bind executeonly def
 
 currentdict /_dops_save undef
 
@@ -2563,7 +2567,7 @@
         pop
       } ifelse
     } forall
-  } bdef
+  } bind executeonly def
   /AnyOn {
     //false exch {
       oforce dup type /dicttype eq {
@@ -2572,13 +2576,13 @@
         pop
       } ifelse
     } forall
-  } bdef
+  } bind executeonly def
   /AnyOff {
     //AllOn exec not
-  } bdef
+  } bind executeonly def
   /AllOff {
     //AnyOn exec not
-  } bdef
+  } bind executeonly def
 currentdict end readonly def
 
 % Check whether OCG or OCMD is visible
@@ -2654,7 +2658,7 @@
   } {
     /OFF known not % OFF is inserted by process_trailer_attrs
   } ifelse
-} bdef
+} bind executeonly def
 
 drawopdict begin
   /Do {                                                  % /Name
@@ -2744,7 +2748,7 @@
       % Otherwise ignore it and tidy up the stacks
       pop pop
     } ifelse
-  } bdef
+  } bind executeonly def
 end
 
 currentdict /xobjectprocs .undef
@@ -2778,12 +2782,12 @@
 .dicttomark readonly def
 /unabbrevvalue {	% <obj> unabbrevvalue <obj'>
   oforce //unabbrevtypedict 1 index type .knownget { exec } if
-} bdef
+} bind executeonly def
 
 /is_space_dict << 0 0 9 9 10 10 12 12 13 13 32 32 >> readonly def
 
 drawopdict begin
-  /BI { mark } bdef
+  /BI { mark } bind executeonly def
   /ID {
     gsave
     %% Bug 696547, related to Bug 695897 (see /Do above) This file has an inline image inside
@@ -2852,7 +2856,7 @@
       } ifelse
     } loop
     grestore
-  } bdef
+  } bind executeonly def
 end
 
 currentdict /is_space_dict undef
@@ -2861,26 +2865,26 @@
 
 drawopdict begin
                         % Text control
-  /BT { BT } def
-  /ET { ET } def
-  /Tc { Tc } def
-  /TL { TL } def
-  /Tr { Tr } def
-  /Ts { Ts } def
-  /Tw { Tw } def
-  /Tz { Tz } def
+  /BT { BT } executeonly def
+  /ET { ET } executeonly def
+  /Tc { Tc } executeonly def
+  /TL { TL } executeonly def
+  /Tr { Tr } executeonly def
+  /Ts { Ts } executeonly def
+  /Tw { Tw } executeonly def
+  /Tz { Tz } executeonly def
                         % Text positioning
-  /Td { Td } def
-  /TD { TD } def
-  /Tm { Tm } def
-  /T* { T* } def
+  /Td { Td } executeonly def
+  /TD { TD } executeonly def
+  /Tm { Tm } executeonly def
+  /T* { T* } executeonly def
                         % Text painting
-  /Tj { Tj } def
-  /' { ' } def
-  /" { " } def
-  /TJ { TJ } def
+  /Tj { Tj } executeonly def
+  /' { ' } executeonly def
+  /" { " } executeonly def
+  /TJ { TJ } executeonly def
 
-  /Tform { Tform } def  % Text formatting and painting for AcroForm
+  /Tform { Tform } executeonly def  % Text formatting and painting for AcroForm
                         % without appearance streams.
 end
 
@@ -2892,7 +2896,7 @@
     (   **** Error: invalid operator QBT processed as Q BT .\n)
     pdfformaterror  % Bug 690089
     (               Output may be incorrect.\n) pdfformaterror
-  } def
+  } executeonly def
 
   /. {
     0.
@@ -2899,7 +2903,7 @@
     (   **** Error: invalid operator . processed as number 0. .\n)
     pdfformaterror  % Bug 690730
     (               Output may be incorrect.\n) pdfformaterror
-  } def
+  } executeonly def
 end
 
 % ============================== Annotations ============================== %
@@ -2919,7 +2923,7 @@
   dup /Parent oknown not {
     2 copy exch /ParentField exch put
   } if
-} bdef
+} bind executeonly def
 
 % Get and normalize an annotation's rectangle.
 /annotrect {		% <annot> annotrect <x> <y> <w> <h>
@@ -2926,7 +2930,7 @@
   /Rect oget oforce_recursive aload pop
   exch 3 index sub dup 0 lt { dup 5 -1 roll add 4 1 roll neg } if
   exch 2 index sub dup 0 lt { dup 4 -1 roll add 3 1 roll neg } if
-} bdef
+} bind executeonly def
 
 % Set an annotation color.
 % If the /C array is empty we don't want to draw the annotation
@@ -2955,7 +2959,7 @@
     } ifelse
   }
   { 0 setgray true} ifelse
-} bdef
+} bind executeonly def
 
 % Set an annotation color.
 % If the /C array is empty we don't want to draw the annotation
@@ -2984,7 +2988,7 @@
     } ifelse
   }
   { 0 setgray true} ifelse
-} bdef
+} bind executeonly def
 
 % Draw the border.  Currently, we ignore requests for beveling, and we
 % don't round the corners of rectangles.
@@ -3005,7 +3009,7 @@
   } {
     pop pop pop
   }ifelse
-} bdef
+} bind executeonly def
 
 % Draw an annotation border.
 /drawborder {		% <annot> drawborder -
@@ -3049,7 +3053,7 @@
     1 {} strokeborder
   } ifelse
   grestore
-} bdef
+} bind executeonly def
 
 % stroke the path of an annotation border.
 /strokeborderpath {		% <annot> strokeborderpath -
@@ -3098,7 +3102,7 @@
   } ifelse
   pop
   grestore
-} bdef
+} bind executeonly def
 
 /fillborderpath {		% <annot> fillborderpath -
   gsave
@@ -3106,7 +3110,7 @@
   annotsetinteriorcolor
   {fill} if
   grestore
-}bdef
+}bind executeonly def
 
 %
 %   The PDF annotation F (flags) integer is bit encoded.
@@ -3135,12 +3139,12 @@
   } {
     pop pop //false                            % Hidden
   } ifelse
-} bdef
+} bind executeonly def
 
 /set_bc_color <<
- 1 { 0 get oforce setgray } bind
- 3 { { oforce } forall setrgbcolor } bind
- 4 { { oforce } forall setcmykcolor } bind
+ 1 { 0 get oforce setgray } bind executeonly
+ 3 { { oforce } forall setrgbcolor } bind executeonly
+ 4 { { oforce } forall setcmykcolor } bind executeonly
 >> readonly def
 
 % Get an inherited attribute from a node through /Parent and /ParentField
@@ -3164,7 +3168,7 @@
        } ifelse
      } ifelse
    } loop
- } bind def
+ } bind executeonly def
 
 % <annot> foo <annot>
 /make_tx_da {
@@ -3218,7 +3222,7 @@
   /File File 0 Length getinterval def
   closefile             % <annot>
   end
-} bdef
+} bind executeonly def
 
 /can-regenerate-ap { % <annot> -> <bool>
   //false exch
@@ -3239,7 +3243,7 @@
     } if
   } if
   pop
-} bdef
+} bind executeonly def
 
 /drawwidget {			% <scalefactor_x> <scalefactor_y> <annot> drawwidget -
 
@@ -3359,7 +3363,7 @@
     } if
   } ifelse
   pop pop pop
-} bdef
+} bind executeonly def
 
 currentdict /set_bc_color undef
 
@@ -3409,7 +3413,7 @@
     (               Output may be incorrect.\n) pdfformaterror
     pop 1 1
   } ifelse
-} bdef
+} bind executeonly def
 
 % Draw an annotation.
 /drawannottypes 20 dict begin
@@ -3433,13 +3437,13 @@
 %      } ifelse
       .begintransparencygroup
     } if
-  }bdef
+  }bind executeonly def
 
   /endannottransparency {
     PDFusingtransparency {
       .endtransparencygroup
     } if
-  }bdef
+  }bind executeonly def
 
   % x0 y0 x1 y1 x2 y2 x3 y3 -> x0 y0 x1-x0 y1-y0 x2-x0 y2-y0
   /quadpoints2basis {
@@ -3482,7 +3486,7 @@
     4 index sub exch  % x0 y0 x2-x0 y2-y0 y1-y0 x1
     5 index sub exch  % x0 y0 x2-x0 y2-y0 x1-x0 y1-y0
     4 2 roll          % x0 y0 x1-x0 y1-y0 x2-x0 y2-y0
-  } bdef
+  } bind executeonly def
 
   /Square {
     dup /AP oknown {
@@ -3506,7 +3510,7 @@
       //endannottransparency exec
       grestore
     }ifelse
-  } bdef
+  } bind executeonly def
 
 %% Width Height drawellipse -
 /drawellipse {
@@ -3525,7 +3529,7 @@
                                                                 % Stack: yrad xrad xmag ymag
   exch neg 4 1 roll 3 -1 roll neg 3 1 roll exch neg exch
   neg 1 index 0 curveto                                         % xmag neg yrad neg xrad neg ymag neg 0 curveto
-}bdef
+}bind executeonly def
 
   /Circle {
     dup /AP oknown {
@@ -3542,7 +3546,7 @@
       grestore
       //false
     } ifelse
-  } bdef
+  } bind executeonly def
 
   /Polygon {
     dup /AP oknown {
@@ -3591,7 +3595,7 @@
       //false
       grestore
     } ifelse
-  } bdef
+  } bind executeonly def
 
   /LineEnd_dict 10 dict begin
     %% Stack contains <annot>
@@ -3624,7 +3628,7 @@
       dup neg lineto
       closepath
       strokeborderpath
-    } bdef
+    } bind executeonly def
     /Circle {
       dup
       /BS knownoget {
@@ -3647,7 +3651,7 @@
       0 moveto
       0 0 3 -1 roll 0 360 arc
       strokeborderpath
-    } bdef
+    } bind executeonly def
     /Diamond {
       dup
       /BS knownoget {
@@ -3675,7 +3679,7 @@
       0 lineto
       closepath
       strokeborderpath
-    } bdef
+    } bind executeonly def
     /OpenArrow {
       dup
       gsave
@@ -3692,7 +3696,7 @@
       dup 6 mul neg exch 4 mul lineto
       strokeborderpath
       grestore
-    } bdef
+    } bind executeonly def
     /ClosedArrow {
       dup
       gsave
@@ -3718,8 +3722,8 @@
       dup /CA knownoget {.setopacityalpha} if
       fillborderpath
       grestore
-    } bdef
-    /None {} bdef
+    } bind executeonly def
+    /None {} bind executeonly def
     /Butt {
       dup
       /BS knownoget {
@@ -3732,7 +3736,7 @@
       }ifelse
       3 mul dup neg 0 exch moveto 0 exch lineto
       strokeborderpath
-    } bdef
+    } bind executeonly def
     /ROpenArrow {
       gsave
       dup
@@ -3750,7 +3754,7 @@
       dup 6 mul neg exch 4 mul lineto
       strokeborderpath
       grestore
-    } bdef
+    } bind executeonly def
     /RClosedArrow {
       gsave
       dup
@@ -3777,7 +3781,7 @@
       dup /CA knownoget {.setopacityalpha} if
       fillborderpath
       grestore
-    } bdef
+    } bind executeonly def
     /Slash {
       gsave
       dup
@@ -3793,7 +3797,7 @@
       3 mul dup neg 0 exch moveto 0 exch lineto
       strokeborderpath
       grestore
-    } bdef
+    } bind executeonly def
 
   currentdict end readonly def
 
@@ -3837,7 +3841,7 @@
       //false
       grestore
     } ifelse
-  } bdef
+  } bind executeonly def
 
   /PolyLine {
     dup /AP oknown {
@@ -3895,7 +3899,7 @@
       //false
       grestore
     } ifelse
-  } bdef
+  } bind executeonly def
 
   /Link { % <annot> -> <false>
     //startannottransparency exec
@@ -3908,7 +3912,7 @@
       (               Output may be incorrect.\n) pdfformaterror
     }ifelse
     //endannottransparency exec
-  } bdef
+  } bind executeonly def
 
   /Ink { % <annot> -> <annot> <true>
          % <annot> -> <false>
@@ -3960,7 +3964,7 @@
       //endannottransparency exec
       //false
     } ifelse
-  } bdef
+  } bind executeonly def
 
   /Underline {
     dup /AP oknown {
@@ -3999,7 +4003,7 @@
       } if
       //false
     } ifelse
-  } bdef
+  } bind executeonly def
 
   /StrikeOut {
     dup /AP oknown {
@@ -4038,7 +4042,7 @@
       } if
       //false
     } ifelse
-  } bdef
+  } bind executeonly def
 
   % Connect 2 points with an arc that has max distance from the line
   % segment to the ark equal 1/4 of the radius.
@@ -4058,7 +4062,7 @@
     atan                                % x0 y0 x1 y1 xc yc r a1 a2
     exch arcn                           % x0 y0 x1 y1
     pop pop pop pop
-  } bind def
+  } bind executeonly def
 
   /emptydict 0 dict readonly def
 
@@ -4093,7 +4097,7 @@
     } if
     //false
 %    } ifelse
-  } bdef
+  } bind executeonly def
   currentdict /emptydict undef
   currentdict /highlight-arc undef
 
@@ -4153,7 +4157,7 @@
       //endannottransparency exec
       //false
     } ifelse
-  } bdef
+  } bind executeonly def
 
   /Text {
     dup /AP oknown {
@@ -4195,7 +4199,7 @@
       //endannottransparency exec
       //false
     } ifelse
-  } bdef
+  } bind executeonly def
 
   /FreeText {
     dup /AP knownoget {
@@ -4382,7 +4386,7 @@
     {
       //true
     } ifelse
-  } bdef
+  } bind executeonly def
 
   /frame {
     { 255 div } forall setrgbcolor
@@ -4406,7 +4410,7 @@
    }
    gsave 1 -1 translate 0.75 setgray dup exec grestore
    exec
-  } bdef
+  } bind executeonly def
 
   % (text) y h -> -
   /text {
@@ -4425,7 +4429,7 @@
     PDFusingtransparency {
       .endtransparencytextgroup
     } if
-  } bdef
+  } bind executeonly def
 
   /red   <ef4023> readonly def
   /green <3fae49> readonly def
@@ -4435,44 +4439,44 @@
     /Approved {
       //green //frame exec
       (APPROVED) 13 30 //text exec
-    } bdef
+    } bind executeonly def
     /AsIs {
       //red //frame exec
       (AS IS) 13 30 //text exec
-    } bdef
+    } bind executeonly def
     /Confidential {
       //red //frame exec
       (CONFIDENTIAL) 17 20 //text exec
-    } bdef
+    } bind executeonly def
     /Departmental {
       //blue //frame exec
       (DEPARTMENTAL) 17 20 //text exec
-    } bdef
+    } bind executeonly def
     /Draft {
       //red //frame exec
       (DRAFT) 13 30 //text exec
-    } bdef
+    } bind executeonly def
     /Experimental {
       //blue //frame exec
       (EXPERIMENTAL) 17 20 //text exec
-    } bdef
+    } bind executeonly def
     /Expired {
       //red //frame exec
       (EXPIRED) 13 30 //text exec
-    } bdef
+    } bind executeonly def
     /Final {
       //red //frame exec
       (FINAL) 13 30 //text exec
-    } bdef
+    } bind executeonly def
     /ForComment {
       //green //frame exec
       (FOR COMMENT) 17 20 //text exec
-    } bdef
+    } bind executeonly def
     /ForPublicRelease {
       //green //frame exec
       (FOR PUBLIC) 26 18 //text exec
       (RELEASE)  8.5 18 //text exec
-    } bdef
+    } bind executeonly def
     /NotApproved {
       //red //frame exec
       (NOT APPROVED) 17 20 //text exec
@@ -4481,15 +4485,15 @@
       //red //frame exec
       (NOT FOR) 26 18 //text exec
       (PUBLIC RELEASE) 8.5 18 //text exec
-    } bdef
+    } bind executeonly def
     /Sold {
       //blue //frame exec
       (SOLD) 13 30 //text exec
-    } bdef
+    } bind executeonly def
     /TopSecret {
       //red //frame exec
       (TOP SECRET) 14 26 //text exec
-    } bdef
+    } bind executeonly def
   currentdict end readonly def
 
   {/text/frame/red/green/blue} {currentdict exch undef} forall
@@ -4524,7 +4528,7 @@
       //endannottransparency exec
       //false
     } ifelse
-  } bdef
+  } bind executeonly def
 
   /Popup {
     dup /Open oknown {
@@ -4613,7 +4617,7 @@
     } {
       pop //false
     }ifelse
-  } bdef
+  } bind executeonly def
 
   /Redact {
     %% Redact annotations are part of a process, a Redact annotation is only present
@@ -4625,7 +4629,7 @@
     } {
       //false
     } ifelse
-  } bdef
+  } bind executeonly def
 
 currentdict /startannottransparency undef
 currentdict /endannottransparency undef
@@ -4650,7 +4654,7 @@
    }
    {pop pop //true}
    ifelse
-} bind def
+} bind executeonly def
 
 /drawannot {		% <annot> drawannot -
   dup annotvisible {
@@ -4681,7 +4685,7 @@
     } ifelse
     grestore
   } if pop			% annotvisible
-} bdef
+} bind executeonly def
 currentdict /drawannottypes undef
 
 % Draw an annotation.
@@ -4739,6 +4743,7 @@
           dup {oforce} stopped not {exch pop} if
           2 index 3 1 roll put
         } forall
+        Removepdfobj#
       } if
       dup type /arraytype eq {
         0 1 2 index length 1 sub{
@@ -4748,7 +4753,7 @@
       } if
     } if
   } forall
-} bdef
+} bind executeonly def
 
 
 /ApplyCTMToQuadPoints {
@@ -4781,13 +4786,13 @@
   exch pop % the mark
 
   grestore
-} bdef
+} bind executeonly def
 
 /preserveannottypes 20 dict begin
 
-/Circle {mark exch loadannot /ANN pdfmark  false} bdef
-/FileAttachment {mark exch loadannot /ANN pdfmark  false} bdef
-/FreeText {mark exch loadannot /ANN pdfmark  false} bdef
+/Circle {mark exch loadannot /ANN pdfmark  false} bind executeonly def
+/FileAttachment {mark exch loadannot /ANN pdfmark  false} bind executeonly def
+/FreeText {mark exch loadannot /ANN pdfmark  false} bind executeonly def
 
 /Highlight {
   mark exch
@@ -4797,9 +4802,9 @@
     put
   } if
   loadannot /ANN pdfmark  false
-} bdef
+} bind executeonly def
 
-/Ink {mark exch loadannot /ANN pdfmark  false} bdef
+/Ink {mark exch loadannot /ANN pdfmark  false} bind executeonly def
 
 /Line {
   mark exch dup /L .knownget {
@@ -4808,15 +4813,101 @@
     1 index /L 3 -1 roll put
   } if
   loadannot /ANN pdfmark false
-} bdef
+} bind executeonly def
 
-/Link {mark exch {drawannot} PDFSTOPONERROR {exec}{stopped {(Error: Ignoring invalid annotation, output may be incorrect.\n) pdfformaterror} if} ifelse cleartomark false} bdef
+/Link {
+    /NO_PDFMARK_DESTS where {pop NO_PDFMARK_DESTS not}{true}ifelse
+    {
+    mark exch
+    dup /BS knownoget { << exch { oforce } forall >> /BS exch 3 -1 roll } if
+    dup /F knownoget { /F exch 3 -1 roll } if
+    dup /C knownoget { /Color exch 3 -1 roll } if
+    dup /Rect knownoget { /Rect exch 3 -1 roll } if
+    dup /Border knownoget {
+      dup type /arraytype eq {
+        dup length 3 lt
+      } {
+        //true
+      } ifelse {
+        pop [ 0 0 0 ] % Following AR5 use invisible border.
+      } if
+      /Border exch 3 -1 roll
+    } if
+    dup /A knownoget {
+      dup /URI known {
+        /A mark 3 2 roll    % <<>> /A [ <<action>>
+        { oforce } forall
+        .dicttomark
+        3 2 roll
+      } {
+        dup /S knownoget  {
+          %% Because we process GoTo Destinations into absolute references in the PDF file
+          %% we need to resolve the /D or /Dest. However, we must *not* do this for
+          %% GoToR Destinations because (obviously) those are in a different file and
+          %% we cannot resolve them into absolute references. We don't need to anyway
+          %% because that file must already have a named destination.
+          dup /GoTo eq {
+            pop
+            dup /D knownoget {
+              exch pop exch dup length dict copy dup /Dest 4 -1 roll put
+            } if
+          }{
+            dup /GoToR eq {
+              pop /A mark       % <<..action dict..>> /A [
+              3 2 roll          % /A [ <<..action dict..>>
+              { oforce } forall
+              .dicttomark
+              3 2 roll
+            }{
+              dup /Launch eq {
+                pop /A mark       % <<..action dict..>> /A [
+                3 2 roll          % /A [ <<..action dict..>>
+                { oforce } forall
+                .dicttomark
+                3 2 roll
+              }{
+                /Named eq {
+                  /N knownoget {
+                    namedactions exch .knownget {
+                      exec {
+                        pop
+                        (   **** Warning: Ignoring a named action pointing out of the document page range.\n)
+                        pdfformatwarning
+                      } {
+                        /Page exch 3 -1 roll
+                      } ifelse
+                    } if
+                  } if
+                } if
+              }ifelse
+            } ifelse
+          } ifelse
+        } if
+      } ifelse
+    } if
+    { linkdest } stopped {
+      cleartomark
+      (   **** Warning: Link annotation points out of the document page range.\n)
+      pdfformatwarning
+    } {
+      pop
+      {
+        %% Need to remove any '/.gs.pdfobj# key/value pairs from any dictionaries
+        counttomark array astore dup length 1 sub 0 1 3 -1 roll {
+          dup 2 index exch get Removepdfobj# 2 index 3 1 roll put
+        } for aload pop
+        /LNK pdfmark
+      } stopped {cleartomark} if
+    } ifelse
+    }{pop} ifelse
+    false
+} bind executeonly def
 
-/Movie {mark exch loadannot /ANN pdfmark  false} bdef
-/Popup {mark exch loadannot /ANN pdfmark  false} bdef
-/Sound {mark exch loadannot /ANN pdfmark  false} bdef
-/Square {mark exch loadannot /ANN pdfmark false} bdef
-/Stamp {mark exch loadannot /ANN pdfmark  false} bdef
+/Movie {mark exch loadannot /ANN pdfmark  false} bind executeonly def
+/Popup {mark exch loadannot /ANN pdfmark  false} bind executeonly def
+/Sound {mark exch loadannot /ANN pdfmark  false} bind executeonly def
+/Square {mark exch loadannot /ANN pdfmark false} bind executeonly def
+/Stamp {mark exch loadannot /ANN pdfmark  false} bind executeonly def
 
 /StrikeOut {
   mark exch
@@ -4826,7 +4917,7 @@
     put
   } if
   loadannot /ANN pdfmark  false
-} bdef
+} bind executeonly def
 
 /Squiggly {
   mark exch
@@ -4836,10 +4927,10 @@
     put
   } if
   loadannot /ANN pdfmark  false
-} bdef
+} bind executeonly def
 
-/Text {mark exch loadannot /ANN pdfmark  false} bdef
-/TrapNet {mark exch loadannot /ANN pdfmark  false} bdef
+/Text {mark exch loadannot /ANN pdfmark  false} bind executeonly def
+/TrapNet {mark exch loadannot /ANN pdfmark  false} bind executeonly def
 
 /Underline {
   mark exch
@@ -4849,7 +4940,7 @@
     put
   } if
   loadannot /ANN pdfmark  false
-} bdef
+} bind executeonly def
 
 %% Widget annotations are only used with AcroForms, and since we don't preserve AcroForms
 %% we don't want to preserve widget annotations either, because the consumer of the new
@@ -4856,11 +4947,16 @@
 %% PDF won't know what values they should take. So we draw widget annotations instead. If we
 %% ever preserve AcroForms then we should alter this to preserve Widgets as well.
 %% simply chane "drawannot" to "mark exch loadannot /ANN pdfmark"
-/Widget {mark exch {drawannot} PDFSTOPONERROR {exec}{stopped {(Error: Ignoring invalid annotation, output may be incorrect.\n) pdfformaterror} if} ifelse cleartomark false} bdef
+/Widget {mark exch {drawannot} PDFSTOPONERROR {exec}{stopped {(Error: Ignoring invalid annotation, output may be incorrect.\n) pdfformaterror} if} ifelse cleartomark false} bind executeonly def
 
 currentdict end readonly def
 
 /preserveannot {		% <annot> preserveannot -
+
+  dup /.gs.pdfobj# known {
+    dup /.gs.pdfobj# undef
+  } if
+
   dup annotvisible {
     gsave
     dup dup /Subtype knownoget {
@@ -4888,7 +4984,7 @@
     } ifelse
     grestore
   } if pop			% annotvisible
-} bdef
+} bind executeonly def
 
 currentdict /preserveannottypes undef
 currentdict /.PDFDrawAnnotType? undef
@@ -4902,7 +4998,7 @@
   } {
     oget
   } ifelse
-} bdef
+} bind executeonly def
 
 % All procedures have the signature:
 % <acroform> <field> <annot|field> foo <acroform> <field> <annot|field>
@@ -4936,7 +5032,7 @@
         } ifelse
     } ifelse
   } ifelse
-} bdef
+} bind executeonly def
 
 /Tx {
   dup /AP known {
@@ -4984,7 +5080,7 @@
       dup 1 1 3 -1 roll drawwidget
     } if
   } ifelse
-} bdef
+} bind executeonly def
 
 /Ch {
   dup /AP known 3 index /NeedAppearances knownoget not { //true } if not and {
@@ -5032,11 +5128,11 @@
       dup 1 1 3 -1 roll drawwidget
     } if
   } ifelse
-} bdef
+} bind executeonly def
 
 /Sig {
   (Sig is not yet implemened ) //== exec
-} bdef
+} bind executeonly def
 
 currentdict end def
 
@@ -5050,7 +5146,7 @@
    } if
  } if
  pop pop
-} bdef
+} bind executeonly def
 
 % We distinguish 4 types of nodes on the form field tree:
 %  - non-terminal field - has a kid that refers to the parent (or anywhere else)
@@ -5077,7 +5173,7 @@
   } {
     draw_terminal_field % merged annotation   % -
   } ifelse
-} bdef
+} bind executeonly def
 
 /draw_acro_form {		% <form> draw_acro_form -
   dup /Fields knownoget {
@@ -5084,7 +5180,7 @@
     { oforce draw_form_field } forall
   } if
   pop
-} bdef
+} bind executeonly def
 
 currentdict /draw_terminal_field_dict undef
 

Modified: trunk/Master/tlpkg/tlgs/Resource/Init/pdf_font.ps
===================================================================
--- trunk/Master/tlpkg/tlgs/Resource/Init/pdf_font.ps	2018-09-04 21:40:52 UTC (rev 48581)
+++ trunk/Master/tlpkg/tlgs/Resource/Init/pdf_font.ps	2018-09-04 22:33:58 UTC (rev 48582)
@@ -68,7 +68,7 @@
       { 3 copy put pop 1 add }
     ifelse
   } forall pop
-} bdef
+} bind executeonly def
 
 /good_encoding_names <<
   /MacRomanEncoding 0 /MacExpertEncoding 0 /WinAnsiEncoding 0
@@ -130,7 +130,7 @@
        (                 Output may be incorrect.\n) pdfformaterror
      }
      ifelse
- } bdef
+ } bind executeonly def
 
 currentdict /good_encoding_names undef
 currentdict /known_symbolic_fonts undef
@@ -146,7 +146,7 @@
     } if
   } if
   pop
-} bind def
+} bind executeonly def
 
 % Define a font using it's FontName as the key.
 % Adjust a font according to the Encoding and Widths in the font resource.
@@ -166,7 +166,7 @@
       /Helvetica findfont
     }if
   } if
-} bind def
+} bind executeonly def
 
 % Get the (possibly modified) encoding of a font.
 /getfontencoding {	% <font-resource> <font> getfontencoding
@@ -213,7 +213,7 @@
       } ifelse
     } ifelse
   } ifelse
-} bdef
+} bind executeonly def
 
 % Returns true if the current glyph is in the Differences array at
 % the specified index value. This is needed because the Widths
@@ -240,7 +240,7 @@
   % stack: true  false index     glyphname
   %  or  : false index glyphname at_index
   pop pop pop
-} bdef
+} bind executeonly def
 
 /unique_name {  % <dict> </root> unique_name </unique>
   %
@@ -262,7 +262,7 @@
     pop
   } for
   exch pop cvn      % /root0
-} bdef
+} bind executeonly def
 
 % Get the metrics of a font, if specified.
 /getfontmetrics {       % <font-resource> <font> <Encoding|null> getfontmetrics
@@ -397,7 +397,7 @@
   } {
     //null //null
   } ifelse
-} bdef
+} bind executeonly def
 
 currentdict /unique_name undef
 currentdict /match_in_diff undef
@@ -408,13 +408,13 @@
     pop
     dup userdict exch /.lastToUnicode exch put
     exch pop
-  } bdef
+  } bind executeonly def
 
   /CIDSystemInfo
   {
     (   **** Warning: ToUnicode CMap has invalid syntax near CIDSystemInfo.\n)  pdfformatwarning
     /CIDSystemInfo
-  } bdef % A work around a bug in Altona.Page_3.2002-09-27.pdf - a slash is missed.
+  } bind executeonly def % A work around a bug in Altona.Page_3.2002-09-27.pdf - a slash is missed.
 
   /CMapName
   {
@@ -421,7 +421,7 @@
     (   **** Warning: ToUnicode CMap has no CMapName.\n\
         See the comment to revision 6201 in gs/doc/ps2pdf.htm#Problems .\n) pdfformatwarning
     /CMap1   % arbitrary, PDF defineresource tolerates non-unique names
-  } bdef % A work around incorrect ToUnicode CMap generated by GS before rev. 6201.
+  } bind executeonly def % A work around incorrect ToUnicode CMap generated by GS before rev. 6201.
 
   % Split large ranges into smaller chunks to stay withing the limits
   % of various PS% objects and speed up operand stack manipulation,
@@ -448,7 +448,7 @@
         mark
       } ifelse
     } loop
-  } bdef
+  } bind executeonly def
 currentdict end readonly def
 
 /string2number     % <string> string2number <number>
@@ -457,7 +457,7 @@
     3 2 roll 256 mul add exch                 % v+n*256 ()
   } for
   pop                                         % N
-} bind def
+} bind executeonly def
 
 /copy&def    % <key> <value> <bool> copy&def -
 {
@@ -474,7 +474,7 @@
     setglobal
   } if
   def
-} bind def
+} bind executeonly def
 
 /.convert_ToUnicode-into-g2u % <GlyphNames2Unicode> <Encoding|null> <CMap> .convert_ToUnicode-into-g2u -
 {
@@ -578,7 +578,7 @@
   CMAPDEBUG {
     (.convert_ToUnicode-into-g2u end) =
   } if
-} bind def
+} bind executeonly def
 
 /.DoToUnicode?
 {
@@ -585,7 +585,7 @@
   /IgnoreToUnicode where
   {/IgnoreToUnicode get not}
   {//true} ifelse
-} bind def
+} bind executeonly def
 
 /.processToUnicode   % <font-resource> <font-dict> <encoding|null> .processToUnicode -
 {
@@ -718,7 +718,7 @@
   {pop pop pop}
   ifelse
 
-} bind def
+} bind executeonly def
 
 currentdict /.DoToUnicode? .forceundef
 
@@ -768,7 +768,7 @@
       4 2 roll .growput
     } ifelse
   } ifelse
-} bind def
+} bind executeonly def
 
 % Add original font to cache to prevent adjustfont to accumulate changes.
 /pdfaddcachedfont {   % <font_name> pdfaddcachedfont <font>
@@ -776,7 +776,7 @@
   dup gcheck { //.pdforigfontcache_g } {.pdforigfontcache_l} ifelse
   4 2 roll                           % font d name font
   put                                % font
-} bind def
+} bind executeonly def
 
 /.remove_font_name_prefix {  % <name>  .remove_font_name_prefix <name>
   dup .namestring (+) search {
@@ -792,7 +792,7 @@
   } {
     pop
   } ifelse
-} bind def
+} bind executeonly def
 
 % Find a font (except for embedded ones), and adjust its encoding if necessary.
 /.pdfdfndict mark
@@ -965,18 +965,18 @@
     } ifelse
   } ifelse
   exch pop
-} bdef
+} bind executeonly def
 
 % ---------------- Type 1 fonts ---------------- %
 
 /buildType1		% <Type1-font-resource> buildType1 <font>
  { dup /BaseFont get pdffindfont
- } bdef
+ } bind executeonly def
 
 % Read an embedded Type 1 font.
 /readfontfilter {	% <proc> readfontfilter <filter>
   0 () /SubFileDecode filter
-} bdef
+} bind executeonly def
 
 % Adobe Acrobat doesn't skip space characters after eexec
 /eexec_pdf_param_dict mark
@@ -1051,12 +1051,12 @@
       } ifelse
     } if
     prev_definefont
-  } bdef
+  } bind executeonly def
 
   /undef_proc_warning {
     /Repaired //true store     % flag that we have warnings
     UndefProcList exch 2 copy .knownget { 1 add } { 1 } ifelse put
-  } bdef
+  } bind executeonly def
 
   /missing-type1-procs 6 dict begin
     /-| { string currentfile exch readstring pop /-| //undef_proc_warning exec } executeonly bdef
@@ -1080,7 +1080,7 @@
     currentfile flushfile % Skip the trailer after return from eexec, bug 690701.
     { currentdict end //missing-type1-procs eq { exit } if } loop
     { stop } if
-  } bdef
+  } bind executeonly def
 
   /readonly-op-dict <<
     /stringtype 0
@@ -1094,7 +1094,7 @@
       (   **** Warning: Type 1 font applies operator readonly to an invalid object type.\n)
       pdfformatwarning
     } if
-  } bdef
+  } bind executeonly def
 
   /prev_get /get load def
 
@@ -1110,7 +1110,7 @@
         prev_get
       } ifelse
     } ifelse
-  } bdef
+  } bind executeonly def
 
   /prev_begin /begin load def
 
@@ -1117,7 +1117,7 @@
   /begin {
     dup //systemdict eq { pop 0 dict } if
     prev_begin
-  } bdef
+  } bind executeonly def
 
   { /undef_proc_warning /missing-type1-procs /readonly-op-dict }
   { currentdict exch undef } forall
@@ -1152,7 +1152,7 @@
    PDFfile file-position setfileposition
    count stack-count sub { pop } repeat
    topFontDict end end
- } bdef
+ } bind executeonly def
 
 % ---------------- Type 3 fonts ---------------- %
 
@@ -1241,7 +1241,7 @@
     } bdef
     dup currentdict Encoding .processToUnicode
     currentdict end .completefont exch pop
-} bdef
+} bind executeonly def
 /.adjustcharwidth {	% <wx> <wy> .adjustcharwidth <wx'> <wy'>
   % Enforce the metrics, in glyph space, to the values found in the PDF Font object
   % - force wy == 0 (assumed, and not stored in the PDF font)
@@ -1258,7 +1258,7 @@
       exch pop Widths CharCode FirstChar sub get exch
     } if end
   } if
-} bdef
+} bind executeonly def
 
 % ---------------- TrueType fonts ---------------- %
 
@@ -1318,7 +1318,7 @@
   } {
     pdffindfont
   } ifelse
-} bdef
+} bind executeonly def
 
 % Read an embedded TrueType font.
 /readtruetype {		% <font-resource> <stream-dict> readtruetype <font>
@@ -1328,6 +1328,18 @@
                 % Stack: filepos fontres stream
   1 index /CIDSystemInfo oknown {
     1 index /CIDSystemInfo get dup type /packedarraytype eq {exec}if
+    dup /Registry known not {
+      (   **** Warning: a CIDFont's CIDSystemInfo is missing the required Registry entry\n) pdfformatwarning
+      dup /Registry (Adobe) put
+    } if
+    dup /Ordering known not {
+      (   **** Warning: a CIDFont's CIDSystemInfo is missing the required Ordering entry\n) pdfformatwarning
+      dup /Ordering (Identity) put
+    } if
+    dup /Supplement known not {
+      (   **** Warning: a CIDFont's CIDSystemInfo is missing the required Supplement entry\n) pdfformatwarning
+      dup /Supplement 0 put
+    } if
     3 1 roll
     1 index /Subtype knownoget {
       /CIDFontType2 ne {
@@ -1371,7 +1383,7 @@
   PDFfile 3 -1 roll setfileposition
                 % Ignore both the Encoding and the Widths.
   exch pop
-} bdef
+} bind executeonly def
 
 % ---------------- Type 0 fonts ---------------- %
 
@@ -1413,7 +1425,7 @@
   end		% CMap
   end		% CIDInit ProcSet
   exch .setglobal
-} bdef
+} bind executeonly def
 
 /CMap_read_dict 3 dict begin
   /defineresource % <name> <dict> <cat-name> defineresource <dict>
@@ -1421,13 +1433,13 @@
     pop
     /.last_CMap_def 1 index store
     exch pop
-  } bdef
+  } bind executeonly def
   /CIDSystemInfo
   {
     (   **** Error: CMap has invalid syntax near CIDSystemInfo.\n)  pdfformaterror
     (               Output may be incorrect.\n) pdfformaterror
     /CIDSystemInfo
-  } bdef % A work around a bug in Altona.Page_3.2002-09-27.pdf - a slash is missed.
+  } bind executeonly def % A work around a bug in Altona.Page_3.2002-09-27.pdf - a slash is missed.
   /CMapName
   {
     (   **** Error: CMap has no CMapName.\n\
@@ -1434,7 +1446,7 @@
         See the comment to revision 6201 in gs/doc/ps2pdf.htm#Problems .\n) pdfformaterror
     (               Output may be incorrect.\n) pdfformaterror
     /CMap1   % arbitrary, PDF defineresource tolerates non-unique names
-  } bdef % A work around incorrect ToUnicode CMap generated by GS before rev. 6201.
+  } bind executeonly def % A work around incorrect ToUnicode CMap generated by GS before rev. 6201.
 currentdict end readonly def
 
 % Read an embedded stream that we *hope* is a PostScript CMap. According
@@ -1451,7 +1463,7 @@
   currentdict end
   dup /CMapName get exch
   /CMap defineresource end
-} bdef
+} bind executeonly def
 
 % Read embedded CMap stream.
 % if the <wmode> parameter is null, it indicates there is no WMode, and we
@@ -1475,7 +1487,7 @@
   { currentdict end //CMap_read_dict eq { exit } if } loop
   dup /.last_CMap_def undef
   /CMap defineresource
-} bdef
+} bind executeonly def
 
 currentdict /CMap_read_dict undef
 
@@ -1536,7 +1548,7 @@
       pop
     } ifelse
   } if exch pop
-} bdef
+} bind executeonly def
 
 % ---------------- CIDFontType0/2 fonts ---------------- %
 
@@ -1589,7 +1601,7 @@
 
   dup /CDevProc 1 index /CIDWProc load /exec load 3 packedarray cvx put
   exch pop
-} bdef
+} bind executeonly def
 
 /.pdfMakeInternalMTXArray { % <mtx_array> <item_size> .pdfConvertInternalW <mtx_array'>
   % convert /W or /W2 to internal expression
@@ -1645,10 +1657,10 @@
 
     [ { putMTXEntry Mi1 type get exec i Msize ge { exit } if } loop ]
   end
-} def
+} executeonly def
 
-/.pdfMakeInternalW  { dup length 0 gt { oforce_recursive 1 .pdfMakeInternalMTXArray } if } def
-/.pdfMakeInternalW2 { dup length 0 gt { oforce_recursive 3 .pdfMakeInternalMTXArray } if } def
+/.pdfMakeInternalW  { dup length 0 gt { oforce_recursive 1 .pdfMakeInternalMTXArray } if } executeonly def
+/.pdfMakeInternalW2 { dup length 0 gt { oforce_recursive 3 .pdfMakeInternalMTXArray } if } executeonly def
 
 /.pdfGetMTXByCID { % <internalMTXArray> <cid>
                    %     .pdfGetMTXByCID
@@ -1668,7 +1680,7 @@
     { exit } if
   } forall
   dup type /arraytype eq { exch pop //true } { pop //false } ifelse
-} def
+} executeonly def
 
 % Apply the [D]W[2] metrics to a character before displaying.
 /CIDWProc {		% <w0x> <w0y> <llx> <lly> <urx> <ury>
@@ -1776,7 +1788,7 @@
     11 -1 roll pop
     % Stack: <w0x'> <w0y'> <llx> <lly> <urx> <ury> <w1x'> <w1y'> <vx'> <vy'>
   end                                   % recover currentdict
-} def
+} executeonly def
 
 % <string> <match> tailmatch ==> <pre> true
 %                            ==> <string> false
@@ -1789,7 +1801,7 @@
   } {
     pop //false
   } ifelse
-} bind def
+} bind executeonly def
 
 /makeboldfont {
   16 dict begin
@@ -1830,7 +1842,7 @@
    currentdict
   end
   dup /CIDFontName get exch /CIDFont defineresource
-} bind def
+} bind executeonly def
 
 % <CIDFont-resource> <CIDFontName> findCIDFont <CIDFont-resource> <font>
 %   CIDFont-resource is not modified.
@@ -2014,15 +2026,15 @@
     } if
     /findresource cvx /undefined signalerror
   } loop
-} bdef
+} bind executeonly def
 
 /buildCIDType0 {	% <CIDFontType0-font-resource> buildCIDType0 <font>
   dup /BaseFont get findCIDFont exch pop
-} bdef
+} bind executeonly def
 
 /buildCIDType2 {	% <CIDFontType2-font-resource> buildCIDType2 <font>
   dup /BaseFont get findCIDFont exch pop
-} bdef
+} bind executeonly def
 
 /processCIDToGIDMap { % <fontres> <cidfont> processCIDToGIDMap <fontres> <cidfont>
   1 index /CIDToGIDMap knownoget {
@@ -2055,7 +2067,7 @@
     } ifelse
     3 2 roll PDFfile exch setfileposition
   } if
-} bdef
+} bind executeonly def
 
 % Adjust a CIDFontType0 DW[2] in the font resource.
 /adjustCIDType0 {		% <font-resource> <font> adjustfont <font'>
@@ -2067,7 +2079,7 @@
     addCIDmetrics
     dup /CIDFontName get exch /CIDFont defineresource
   } ifelse
-} bind def
+} bind executeonly def
 
 % Adjust a CIDFontType2 DW[2] and CIDToGIDMap in the font resource.
 /adjustCIDType2 {		% <font-resource> <font> adjustfont <font'>
@@ -2082,7 +2094,7 @@
     } if
     dup /CIDFontName get exch /CIDFont defineresource
   } ifelse
-} bind def
+} bind executeonly def
 
 % ---------------- Other embedded fonts ---------------- %
 
@@ -2108,7 +2120,7 @@
   closefile closefile pop
   PDFfile 3 -1 roll setfileposition
   pop pop
-} bdef
+} bind executeonly def
 
 % Read an embedded CFF CIDFont.
 /readCIDFontType0C {  % <font-resource> <stream-dict> readCIDFontType0C <font>
@@ -2126,7 +2138,7 @@
                 % Use the FontName, rather than the BaseFont, here.
   dup /FontDescriptor oget /FontName oget /CIDFont findresource
   addCIDmetrics dup /CIDFontName get exch /CIDFont defineresource
-} bdef
+} bind executeonly def
 
 % Read an embedded OpenType font.
 /readOTTOfont {		% <font-resource> <stream-dict> readOTTOfont <font>
@@ -2184,7 +2196,7 @@
   closefile closefile pop pop     % font res pos
   PDFfile exch setfileposition    % font res
   pop                             % font
-} bdef
+} bind executeonly def
 
 % ---------------- Font lookup ---------------- %
 
@@ -2216,10 +2228,10 @@
 % Bind a proc and define n names
 % /name ... /name {proc} n bndef -
 /bndef
-  { exch bind exch
+  { exch bind executeonly exch
     { dup 3 1 roll def } repeat
     pop
-  } bdef
+  } bind executeonly def
 
 % <res> run-fonttypeproc <font>
 /run-fonttypeproc {
@@ -2232,7 +2244,7 @@
     2 copy /Subtype exch put
   } if
   //fonttypeprocs exch get exec
-} bdef
+} bind executeonly def
 
 % Prototype for all procedures: <res> <desc> <stream> foo <font>
 /font_tag_dict 13 dict begin
@@ -2241,7 +2253,7 @@
   /no_stream
     { pop pop
       run-fonttypeproc
-    } bdef
+    } bind executeonly def
 
   /bad_stream
     { (   **** Error: Error reading font stream, attempting to load the font using its name\n)
@@ -2248,12 +2260,12 @@
       pdfformaterror
       (               Output may be incorrect.\n) pdfformaterror
       //no_stream exec
-    } bdef
+    } bind executeonly def
 
   <8001>          % PFB
     { dup /PFB //true put
       exch pop readtype1
-    } bdef
+    } bind executeonly def
 
   (%!PS) (%!Fo)   % Type1
     { exch pop readtype1
@@ -2276,7 +2288,7 @@
   (OTTO)
     { exch pop
       readOTTOfont
-    } bdef
+    } bind executeonly def
 
 currentdict end readonly def
 currentdict /bndef undef
@@ -2311,7 +2323,7 @@
     16#7FFFFFFF and
     xor                   % object_number CRC<newhash>
     xor                   % final hashed value
-}bind def
+}bind executeonly def
 
 % Either patch or create a new XUID based on the existing
 % XUID or UniqueID and incorporating the PDF object number
@@ -2344,7 +2356,7 @@
       .completefont
     } ifelse
   } ifelse
-} bind def
+} bind executeonly def
 
 /resourcefont                   % <font-resource> resourcefont <font>
 {
@@ -2489,7 +2501,7 @@
     dup 3 1 roll /PSFont exch put
   } ifelse
   dup checkGlyphNames2Unicode
-} bdef
+} bind executeonly def
 
 currentdict /font_tag_dict .undef
 currentdict /fonttypeprocs .undef
@@ -2499,7 +2511,7 @@
   /d0 {
     currentcolor currentcolorspace .swapcolors setcolorspace setcolor .swapcolors
     .adjustcharwidth setcharwidth
-  } bdef
+  } bind executeonly def
   /d1 {
     2 copy                           % ... llx lly urx ury | urx ury
     0 ne exch 0 ne                   % ... llx lly urx ury | ury!=0 urx!=0
@@ -2511,7 +2523,7 @@
     } {
       6 -2 roll .adjustcharwidth 6 2 roll setcachedevice
     } ifelse
-  } bdef
+  } bind executeonly def
   /Tf {
     1 index Page /Font rget {
       dup type /dicttype eq {
@@ -2550,7 +2562,7 @@
         Tf
       } ifelse
     } ifelse
-  } bdef
+  } bind executeonly def
 end
 
 end			% pdfdict

Modified: trunk/Master/tlpkg/tlgs/Resource/Init/pdf_main.ps
===================================================================
--- trunk/Master/tlpkg/tlgs/Resource/Init/pdf_main.ps	2018-09-04 21:40:52 UTC (rev 48581)
+++ trunk/Master/tlpkg/tlgs/Resource/Init/pdf_main.ps	2018-09-04 22:33:58 UTC (rev 48582)
@@ -30,7 +30,7 @@
   currentdevice //.writepdfmarkdict .getdeviceparams
   mark eq { //false } { pop pop //true } ifelse
   systemdict /DOPDFMARKS known or
-} bind def
+} bind executeonly def
 
 % For simplicity, we use a single interpretation dictionary for all
 % PDF graphics execution, even though this is too liberal.
@@ -37,21 +37,21 @@
 /pdfopdict mark
   objopdict { } forall
   drawopdict { } forall
-  /endstream { exit } bind
-  (%%EOF) cvn { exit } bind		% for filters
+  /endstream { exit } bind executeonly
+  (%%EOF) cvn { exit } bind	executeonly	% for filters
   /obj { (   **** Error: Content stream is not terminated by 'endstream'.\n)
          pdfformaterror
          (                Output may be incorrect.\n) pdfformaterror
-       } bind
+       } bind executeonly
         % PDF 1.1 operators
-  /BX { /BXlevel BXlevel 1 add store } bind
-  /EX { /BXlevel BXlevel 1 sub store } bind
-  /PS { cvx exec } bind
+  /BX { /BXlevel BXlevel 1 add store } bind executeonly
+  /EX { /BXlevel BXlevel 1 sub store } bind executeonly
+  /PS { cvx exec } bind executeonly
         % PDF 1.2 operators
   /BMC {
     /BMClevel BMClevel 1 add store
     pop
-  } bind
+  } bind executeonly
   /BDC {
     /BMClevel BMClevel 1 add store
     exch /OC eq {
@@ -69,7 +69,7 @@
     } {
       pop
     } ifelse
-  } bind
+  } bind executeonly
   /EMC {
     OFFlevels BMClevel
     2 copy known {
@@ -77,7 +77,7 @@
     } if
     1 sub /BMClevel exch store
     pop
-  } bind
+  } bind executeonly
   /MP { pop } bind
   /DP { pop pop } bind
   /- { 0  % Bug 690016
@@ -84,12 +84,111 @@
        (   **** Error: Invalid operator '-' is assumed to be the number 0.\n)
        pdfformaterror
        (               Output may be incorrect.\n) pdfformaterror
-     } bind
+     } bind executeonly
 
   /Recursive_XObject_D 1 dict def
 
 .dicttomark readonly def
 
+
+% This dictionaty encapsulates all that is needed to generate pagelabel pdfmarks.
+%
+% This is provided by Leon Bottou for the benefit of the djvudigital device
+% which is a device developed and maintained outside of Artifex, and which is
+% not a contributed device.
+%
+% This device does not cope with the method used by pdfwrite to pass the pagelabels
+% number tree as a 'blob' of data, but requires that the page labels be passed using
+% a PAGELABEL pdfmark.
+%
+% We don't want to do that with pdfwrite because there is no mechanism in pdfmark syntax
+% to pass a tree, which means we'd have to laboriously disassemble the pdfmarks for the
+% page labels and rebuild a number tree for it. This would mean pattern matching each
+% string passed via PAGELABEL to see if it could be defined as a continuation
+% of the preceding string, uing prefixes. Its much easier for us just to pass the tree.
+%
+% Note that this code simply translates the PageLabels Number tree into a number of
+% individual PAGELABEL pdfmarks, if used for pdfwrite this would result in a number
+% tree which consists solely of leaf nodes, where each node has a string for its label.
+% This can be considerably more verbose than the shorthand possible with a Page Label
+% dictionary.
+%
+/pagelabeldict mark
+  % (TEXT) .toLower (text)
+  /.toLower {
+      dup length 1 sub  -1 0 {
+          1 index exch 2 copy get 2#00100000 or put
+      } for
+  } bind executeonly
+  % int .cvAlpha (int in alphabetic base 26)
+  /.cvAlpha {
+      [ exch % construct an array of ASCII values, in reverse
+        { % the remainder stays on the top of stack
+            dup 0 eq { pop exit } if % quit if the value is zero
+            dup 26 mod dup 0 eq { 26 add } if % so that the division is correct
+            dup 64 add 3 1 roll sub 26 idiv % save the ASCII value and iterate
+        } loop ]
+      dup length dup string 3 1 roll
+      dup -1 1 { % put the letters in a string
+          4 copy sub exch 4 -1 roll 1 sub get put
+      } for pop pop
+  } bind executeonly
+  % int  .cvRoman  (int in capital Roman numerals)
+  % convert a positive integer to capital Roman numerals
+  % return a decimal string if >= 4000
+  /.cvRoman {
+      dup 255 string cvs % start with the decimal representation
+      exch 4000 lt { % convert only if Roman numerals can represent this
+          dup length
+          [ [ () (I) (II) (III) (IV) (V) (VI) (VII) (VIII) (IX) ]
+            [ () (X) (XX) (XXX) (XL) (L) (LX) (LXX) (LXXX) (XC) ]
+            [ () (C) (CC) (CCC) (CD) (D) (DC) (DCC) (DCCC) (CM) ]
+            [ () (M) (MM) (MMM) ] ] % Roman equivalents
+          () % append the Roman equivalent of each decimal digit to this string
+          2 index  -1 1 {
+              2 index 1 index 1 sub get
+              5 index 5 index 4 -1 roll sub get
+              48 sub get concatstrings
+          } for
+          4 1 roll pop pop pop
+      } if
+  } bind executeonly
+  % style printers
+  /PageStyle <<
+    /D { 255 string cvs } bind executeonly
+    /R { .cvRoman } executeonly
+    /r { .cvRoman .toLower } executeonly
+    /A { .cvAlpha } executeonly
+    /a { .cvAlpha .toLower } executeonly >>
+  % check whether we want to generate pdfmarks
+  /wantpagelabelmarks {
+      % WantsPageLabels means that pagelabels will be passed
+      % using .pdfpagelabels and not using pdfmarks
+    /WantsPageLabels /GetDeviceParam .special_op
+    {pop pop false}{true} ifelse
+  } bind executeonly
+  % generate pagelabel pdfmark
+  /dopagelabel {  % -- dopagelabel --
+      << /S null /P () /O 0 >> begin
+      wantpagelabelmarks {
+          Trailer /Root knownoget {
+              oforce /PageLabels knownoget {
+                  oforce Page# 1 sub
+                  numogetle
+                  { oforce
+                    dup /S knownoget not { //false } if /S exch def
+                    dup /P knownoget not { 0 string } if /P exch def
+                    /St knownoget not { 1 } if exch sub /O exch def
+                  } if
+                  P Page# 1 sub O add PageStyle S knownoget { exec concatstrings } if
+                  mark /Label 3 -1 roll /PAGELABEL pdfmark
+              } if
+          } if
+      } if
+      end
+  } bind executeonly
+.dicttomark readonly def
+
 % ======================== Main program ======================== %
 
 end			% pdfdict
@@ -199,7 +298,7 @@
    pdfdict begin
    pdfopen begin
    /CumulativePageCount currentpagedevice /PageCount get def
-} bind def
+} bind executeonly def
 
 /runpdfpagerange {	% - runpdfpagerange <firstpage#> <lastpage#>
 <</DisablePageHandler true>> setpagedevice
@@ -386,7 +485,7 @@
        } ifelse
      } ifelse
    }ifelse
-} bind def
+} bind executeonly def
 
 /dopdfpages {   % firstpage# lastpage# dopdfpages -
   << /PDFScanRules //true >> setuserparams	% set scanning rules for PDF vs. PS
@@ -412,7 +511,7 @@
   % imaged is a PS file.
   currentpagedevice /PageSpotColors known { << /PageSpotColors -1 >> setpagedevice } if
   << /PDFScanRules //null >> setuserparams	% restore scanning rules for PS
-} bind def
+} bind executeonly def
 
 /runpdfend {
    RepairedAnError
@@ -428,7 +527,7 @@
    PDFTopSave restore
    end			% userdict
    2 vmreclaim		% couldn't hurt
-} bind def
+} bind executeonly def
 
 % Copy stream to an external temporary file and
 % return the file name as PS name.
@@ -459,7 +558,7 @@
   } {
     closefile
   } ifelse
-} bind def
+} bind executeonly def
 
 % Recursively enumerate /Names entries
 % <node> pdf_collection_names /temp_file_name ...
@@ -488,7 +587,7 @@
       } forall
     } if
   } ifelse
-} bind def
+} bind executeonly def
 
 % Copy selected subfiles to temporary files and return the file names
 % as a PostScript names to protect them from restore.
@@ -508,7 +607,7 @@
       pop
     } ifelse
   } if
-} bind def
+} bind executeonly def
 
 /runpdf {		% <file> runpdf -
   %% Get the PDF filename (it *must* be a file even if it came from stdin it gets
@@ -551,7 +650,7 @@
     } forall
     pop
   } ifelse
-} bind def
+} bind executeonly def
 
 currentdict /pdf_collection_files .undef
 
@@ -560,7 +659,7 @@
 % It is OK to use { (%stdin) run } here, because a startjob cannot occur.
 /.runstdin {
   { (%stdin) run } execute0
-} bind def
+} bind executeonly def
 
 end			% userdict
 pdfdict begin
@@ -577,14 +676,14 @@
 % they are invalid, the PDF file is probably unreadable anyway.
 
 /traileropdict mark
-  (<<) cvn { /dictlevelcount dictlevelcount 1 add store mark } bind
+  (<<) cvn { /dictlevelcount dictlevelcount 1 add store mark } bind executeonly
   (>>) cvn { { .dicttomark } stopped {
               (   **** Warning: File has unbalanced >> in trailer.\n) pdfformatwarning
              } if
              /dictlevelcount dictlevelcount 1 sub def
              dictlevelcount 0 eq { exit } if
-           } bind
-  ([) cvn { mark } bind		% ditto
+           } bind executeonly
+  ([) cvn { mark } bind executeonly		% ditto
   (]) cvn dup load
 %  /true true		% see .pdfexectoken in pdf_base.ps
 %  /false false		% ibid.
@@ -596,7 +695,7 @@
     (   **** Error: indirect object reference \(R\) encountered with invalid arguments.) pdfformaterror
     (               Output may be incorrect.\n) pdfformaterror
   } ifelse
-  } bind	% see Objects below
+  } bind executeonly	% see Objects below
 .dicttomark readonly def
 
 % After reading entry count: skip whitespace, exit on a digit
@@ -777,7 +876,7 @@
      pdfformatwarning
    } if
    PDFfile traileropdict .pdfrun
- } bind def
+ } bind executeonly def
 
 currentdict /xref-char-dict undef
 
@@ -784,15 +883,15 @@
  % This dicitonary is used to read the xref dictionary.  It should work for
  % reading any dictionary.  dictlevelcount must contain 0.
 /xrefopdict mark
-  (<<) cvn { /dictlevelcount dictlevelcount 1 add def mark } bind
+  (<<) cvn { /dictlevelcount dictlevelcount 1 add def mark } bind executeonly
   (>>) cvn { .dicttomark /dictlevelcount dictlevelcount 1 sub def
-             dictlevelcount 0 eq { exit} if } bind
-  ([) cvn { mark } bind		% ditto
+             dictlevelcount 0 eq { exit} if } bind executeonly
+  ([) 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	% see Objects below
+  /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
@@ -800,7 +899,7 @@
 /getintn {	% <stream> <count> getintn int
   0 exch { 256 mul 1 index read pop add } repeat
   exch pop			% Discard stream
-} bind def
+} bind executeonly def
 
 % This array contains handlers for processing the different types of
 % entries in the XRef stream.
@@ -813,7 +912,7 @@
 %    (obj num: ) print 2 index pdfstring cvs print ( ) print
 %    (loc: ) print 1 index pdfstring cvs print ( ) print
 %    (gen: ) print dup === flush
-  } bind		% 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
 %    (normal ) print
@@ -823,7 +922,7 @@
     0 3 1 roll			% set stream number = 0
     //false setxrefentry
     3 -1 roll pop		% remove stream number
-  } bind
+  } bind executeonly
         % XRef entry type 2 - compressed object type xref entry
   {	% field 2 = object stream num, field 3 = index into object stream
 %    (Compressed objects: ) print
@@ -831,7 +930,7 @@
 %    (field 2: ) print 1 index pdfstring cvs print ( ) print
 %    (field 3: ) print dup === flush
     0 //false setxrefentry pop	% set generation number = 0
-  } bind
+  } bind executeonly
 ] def
 
  %  Read the PDF 1.5 version of the xref table.
@@ -913,7 +1012,7 @@
      pop				% Remove Index array pair loc
    } for				% Loop through Index array entries
    pop pop				% Remove Index array and xref stream
- } bind def
+ } bind executeonly def
 
 % Read the cross-reference table.
 % <pos> is the position either from the startxref statement or the /Prev
@@ -967,7 +1066,7 @@
    }
    { readpdf15xref }	% otherwise assume PDF 1.5 xref stream
    ifelse
- } bind def
+ } bind executeonly def
 
 % Open a PDF file and read the header, trailer, and cross-reference.
 /pdfopen {		% <file> pdfopen <dict>
@@ -997,7 +1096,7 @@
   pdfopenfile begin
   pdfopencache
   currentdict end
-} bind def
+} bind executeonly def
 
 /process_trailer_attrs {  % - process_trailer_attrs -
   writeoutputintents
@@ -1216,7 +1315,7 @@
     } ifelse
   } if
   } if
-} bind def
+} bind executeonly def
 
 % Verify that each entry in the xref table is pointing at an object with
 % the correct object number and generation number.
@@ -1278,7 +1377,7 @@
   /PageCount pdfpagecount def
   /PageNumbers PageCount 65534 .min dict def
   /PageIndex PageCount 65534 .min array def
-} bind def
+} bind executeonly def
 
 /pdfopenfile {		% <file> pdfopenfile <dict>
    pdfdict readonly pop		% can't do it any earlier than this
@@ -1441,7 +1540,7 @@
    verify_page_tree
 
    currentdict end
- } bind def
+ } bind executeonly def
 
 %% Executing token on a file will close the file if we reach EOF while
 %% processing. When repairing broken files (or searching for startxref
@@ -1468,7 +1567,7 @@
   } {
       token
   } ifelse
-} bind def
+} bind executeonly def
 
 % Look for the last (startxref) from the current position
 % of the file. Return the position after (startxref) if found or -1 .
@@ -1478,7 +1577,7 @@
     bytesavailable 9 lt { exit } if
     pop dup fileposition
   } loop
-} bind def
+} bind executeonly def
 
 % Search for the last 'startxfer' and read a following token, which
 % must be a number. Don't pay any attention to %%EOF because it's
@@ -1510,7 +1609,7 @@
     (               Output may be incorrect.\n) pdfformaterror
         /findxref cvx /syntaxerror signalerror
   } if
-} bind def
+} bind executeonly def
 
 /stderrfile (%stderr) (w) file def
 /stdoutfile (%stdout) (w) file def
@@ -1517,23 +1616,23 @@
 
 /stderrprint {                % <string> stderrprint -
   //stderrfile dup 3 -1 roll writestring flushfile
-} bind def
+} bind executeonly def
 
 /stdoutprint {                % <string> stderrprint -
   //stdoutfile dup 3 -1 roll writestring flushfile
-} bind def
+} bind executeonly def
 
 /pdfformaterror {	% <string> pdfformaterror -
   stdoutprint
   /Repaired //true store
   /RepairedAnError //true store
-} bind def
+} bind executeonly def
 
 /pdfformatwarning {	% <string> pdfformaterror -
   QUIET not {stdoutprint}{pop}ifelse
   /Repaired //true store
   PDFSTOPONWARNING {/warning cvx /undefined signalerror} if
-} bind def
+} bind executeonly def
 
 /knownoget_safe
 { 2 copy knownoget { 3 1 roll pop pop //true } { pop pop //false } ifelse
@@ -1559,7 +1658,7 @@
     stderrprint
     ( <<<<\n) stderrprint
   } ifelse
-} bind def
+} bind executeonly def
 % The UndefProcList collects noisy warnings.
 % This gets rid of many multiple warnings from pdf_font.ps
 /printCollectedWarnings {
@@ -1571,7 +1670,7 @@
       } forall
       (\n) stderrprint
    } if
-} bind def
+} bind executeonly def
 
 /printrepaired {
   QUIET not
@@ -1587,7 +1686,7 @@
     (   **** specification.\n\n)
     stdoutprint
   } if
-} bind def
+} bind executeonly def
 
 /printrepairederror {
   QUIET not
@@ -1596,7 +1695,7 @@
     (   **** The rendered output from this file may be incorrect.\n)
     stdoutprint
   } if
-} bind def
+} bind executeonly def
 
 % Write the outline structure for a file.  Uses linkdest (below).
 % omit links to pages that don't exist.
@@ -1677,7 +1776,7 @@
    /First knownoget
     { { dup writeoutline /Next knownoget not { exit } if } loop }
    if
- } bind def
+ } bind executeonly def
 
 % Close a PDF file.
 /pdfclose		% <dict> pdfclose -
@@ -1684,7 +1783,7 @@
  { begin
    PDFfile closefile
    end
- } bind def
+ } bind executeonly def
 
 % ======================== Page accessing ======================== %
 
@@ -1730,7 +1829,7 @@
       ifelse
     }
    ifelse
- } bind def
+ } bind executeonly def
 
 /obj_get {
   LocalResources 1 index knownoget {
@@ -1754,7 +1853,7 @@
       pop pop pop 0
     }ifelse
   }ifelse
-}bind def
+}bind executeonly def
 
 % Get the value of a resource on a given page.
 /rget {			% <resname> <pagedict> <restype> rget <value> -true-
@@ -1790,7 +1889,7 @@
       pop pop pop pop
     } ifelse
   } ifelse
-} bind def
+} bind executeonly def
 
 % Get the total number of pages in the document.
 /pdfpagecount		% - pdfpagecount <int>
@@ -1835,7 +1934,7 @@
   }{
    0
   } ifelse
- } bind def
+ } bind executeonly def
 
 % Check for loops in the 'page tree' but accept an acyclic graph.
 % - verify_page_tree -
@@ -1864,7 +1963,7 @@
       end
     } if
   } if
-} bind def
+} bind executeonly def
 
 /pdffindpage? {		% <int> pdffindpage? 1 null 	(page not found)
                         %  <int> pdffindpage? 1 noderef (page found)
@@ -1886,7 +1985,7 @@
                 % Stack: index null|noderef
       dup //null eq { pop pop 1 //null exit } if
     } loop
-} bind def
+} bind executeonly def
 
 % Find the N'th page of the document by iterating through the Pages tree.
 % The first page is numbered 1.
@@ -1901,10 +2000,10 @@
     { pop pop pop }	% don't store more than 65534 pagenumbers
    ifelse
    exch pop
-} bind def
+} bind executeonly def
 /pdffindpage {		% <int> pdffindpage <pagedict>
   pdffindpageref oforce
-} bind def
+} bind executeonly def
 
 % Find the N'th page of the document.
 % The first page is numbered 1.
@@ -1917,7 +2016,7 @@
     { exch pop oforce }
     { pop pdffindpage }
    ifelse
- } bind def
+ } bind executeonly def
 
 % Find the page number of a page object (inverse of pdfgetpage).
 /pdfpagenumber		% <pagedict> pdfpagenumber <int>
@@ -1931,7 +2030,7 @@
       for exch pop
     }
    ifelse
- } bind def
+ } bind executeonly def
 
 % Arrange the four elements that define a rectangle into a 'normal' order.
 /normrect_elems   % <x1> <y1> <x2> <y2> normrect_elems <llx> <lly> <urx> <ury>
@@ -1949,7 +2048,7 @@
     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 def
+} bind executeonly def
 
 % Arrange a rectangle into a 'normal' order.  I.e the lower left corner
 % followed by the upper right corner.
@@ -1956,7 +2055,7 @@
 /normrect 	% <rect> normrect <rect>
 {
     aload pop normrect_elems 4 array astore
-} bind def
+} bind executeonly def
 
 /fix_empty_rect_elems % </Name> <x1> <y1> <x2> <y2> fix_empty_rect_elems <x1> <y1> <x2'> <y2'>
 {  dup 3 index eq { //true } { 1 index 4 index eq } ifelse {
@@ -1968,11 +2067,11 @@
    } {
      5 -1 roll pop
    } ifelse
-} bind def
+} bind executeonly def
 
 /boxrect		% <llx> <lly> <urx> <ury> boxrect <x> <y> <w> <h>
  { exch 3 index sub exch 2 index sub
- } bind def
+ } bind executeonly def
 /resolvedest {		% <name|string|other> resolvedest <other|null>
   dup type /nametype eq {
     Trailer /Root oget /Dests knownoget {
@@ -1993,12 +2092,12 @@
       } ifelse
     } if
   } ifelse
-} bind def
+} bind executeonly def
 
 % Procedures to do the necessary transformations of view destinations
 % <PDF2PS_matrix> <rot> <view> -- <view'>
 /viewdestprocs 8 dict dup begin
-    /Fit  { exch pop exch pop } bind def
+    /Fit  { exch pop exch pop } bind executeonly def
     /FitH {
         aload length 2 lt {
           1 array astore
@@ -2008,7 +2107,7 @@
           4 -1 roll transform exch pop
           2 array astore
         } ifelse
-    } bind def
+    } bind executeonly def
     /FitV {
         aload length 2 lt {
           1 array astore
@@ -2018,7 +2117,7 @@
           4 -1 roll transform pop
           2 array astore
         } ifelse
-    } bind def
+    } bind executeonly def
     /FitB  /Fit  load def
     /FitBH /FitH load def
     /FitBV /FitV load def
@@ -2051,7 +2150,7 @@
         2 { 3 -1 roll //null eq { pop //null } if exch } repeat % put the nulls back
         3 -1 roll
         4 array astore
-    } bind def
+    } bind executeonly def
     /FitR {
         exch pop
         aload pop
@@ -2058,7 +2157,7 @@
         2 { 5 index transform 4 2 roll } repeat normrect_elems
         5 array astore
         exch pop
-    } bind def
+    } bind executeonly def
 end readonly def
 
 /linkdest {		% <link|outline> linkdest
@@ -2109,102 +2208,31 @@
       ifelse
     }
    if
-} bind def
+} bind executeonly def
+
+
+%% Used to recursively check dictionaries for any /.gs.pdfobj# keys
+%% and remove them if so
+%% -any- /Removepdfobj# -any-
+
+/Removepdfobj#
+{
+  dup type /dicttype eq {
+    dup /.gs.pdfobj# known {
+      dup /.gs.pdfobj# undef
+    } if
+    dup {Removepdfobj# 2 index 3 1 roll put} forall
+  } if
+}bind executeonly def
+
 % <pagedict> mark ... -proc- <page#> <error>
 /namedactions 8 dict dup begin
-  /FirstPage { 1 /CumulativePageCount where {pop CumulativePageCount}{0}ifelse add //false } def
-  /LastPage { pdfpagecount /CumulativePageCount where {pop CumulativePageCount}{0}ifelse add //false } def
-  /NextPage { counttomark 2 add index pdfpagenumber 1 add dup pdfpagecount gt exch /CumulativePageCount where {pop CumulativePageCount}{0}ifelse add exch} bind def
-  /PrevPage { counttomark 2 add index pdfpagenumber 1 sub dup 1 lt exch /CumulativePageCount where {pop CumulativePageCount}{0}ifelse add exch} bind def
+  /FirstPage { 1 /CumulativePageCount where {pop CumulativePageCount}{0}ifelse add //false } bind executeonly def
+  /LastPage { pdfpagecount /CumulativePageCount where {pop CumulativePageCount}{0}ifelse add //false } bind executeonly def
+  /NextPage { counttomark 2 add index pdfpagenumber 1 add dup pdfpagecount gt exch /CumulativePageCount where {pop CumulativePageCount}{0}ifelse add exch} bind executeonly def
+  /PrevPage { counttomark 2 add index pdfpagenumber 1 sub dup 1 lt exch /CumulativePageCount where {pop CumulativePageCount}{0}ifelse add exch} bind executeonly def
 end readonly def
 % <pagedict> <annotdict> -proc- -
-/annottypes 5 dict dup begin
-  /Text {
-    mark exch
-     { /Rect /Open /Contents /F}
-     { 2 copy knownoget { 3 -1 roll } { pop } ifelse }
-    forall pop {/ANN pdfmark} stopped {cleartomark} if
-  } bind def
-  /Link {
-    /NO_PDFMARK_DESTS where {pop NO_PDFMARK_DESTS not}{true}ifelse
-    {
-    mark exch
-    dup /BS knownoget { << exch { oforce } forall >> /BS exch 3 -1 roll } if
-    dup /F knownoget { /F exch 3 -1 roll } if
-    dup /C knownoget { /Color exch 3 -1 roll } if
-    dup /Rect knownoget { /Rect exch 3 -1 roll } if
-    dup /Border knownoget {
-      dup type /arraytype eq {
-        dup length 3 lt
-      } {
-        //true
-      } ifelse {
-        pop [ 0 0 0 ] % Following AR5 use invisible border.
-      } if
-      /Border exch 3 -1 roll
-    } if
-    dup /A knownoget {
-      dup /URI known {
-        /A mark 3 2 roll    % <<>> /A [ <<action>>
-        { oforce } forall
-        .dicttomark
-        3 2 roll
-      } {
-        dup /S knownoget  {
-          %% Because we process GoTo Destinations into absolute references in the PDF file
-          %% we need to resolve the /D or /Dest. However, we must *not* do this for
-          %% GoToR Destinations because (obviously) those are in a different file and
-          %% we cannot resolve them into absolute references. We don't need to anyway
-          %% because that file must already have a named destination.
-          dup /GoTo eq {
-            pop
-            dup /D knownoget {
-              exch pop exch dup length dict copy dup /Dest 4 -1 roll put
-            } if
-          }{
-            dup /GoToR eq {
-              pop /A mark       % <<..action dict..>> /A [
-              3 2 roll          % /A [ <<..action dict..>>
-              { oforce } forall
-              .dicttomark
-              3 2 roll
-            }{
-              dup /Launch eq {
-                pop /A mark       % <<..action dict..>> /A [
-                3 2 roll          % /A [ <<..action dict..>>
-                { oforce } forall
-                .dicttomark
-                3 2 roll
-              }{
-                /Named eq {
-                  /N knownoget {
-                    namedactions exch .knownget {
-                      exec {
-                        pop
-                        (   **** Warning: Ignoring a named action pointing out of the document page range.\n)
-                        pdfformatwarning
-                      } {
-                        /Page exch 3 -1 roll
-                      } ifelse
-                    } if
-                  } if
-                } if
-              }ifelse
-            } ifelse
-          } ifelse
-        } if
-      } ifelse
-    } if
-    { linkdest } stopped {
-      cleartomark
-      (   **** Warning: Link annotation points out of the document page range.\n)
-      pdfformatwarning
-    } {
-      pop {/LNK pdfmark} stopped {cleartomark} if
-    } ifelse
-    }{pop} ifelse
-  } bind def
-end readonly def
 
 % **** The following procedure should not be changed to allow clients
 % **** to directly interface with the constituent procedures. GSview
@@ -2216,14 +2244,14 @@
    pdfshowpage_init     % <pagedict>
    pdfshowpage_setpage  % <pagedict>
    pdfshowpage_finish   % -
- } bind def
+ } bind executeonly def
 
 /pdfpagecontents	% <pagedict> pdfpagecontents <contents>
- { } bind def
+ { } bind executeonly def
 
 /pdfshowpage_init 	% <pagedict> pdfshowpage_init <pagedict>
  { /DSCPageCount DSCPageCount 1 add store
- } bind def
+ } bind executeonly def
 
 /get_media_box { % <pagedict> get_media_box <box> <bool>
   /MediaBox pget {
@@ -2234,7 +2262,7 @@
     (               Output may be incorrect.\n) pdfformaterror
     [ 0 0 currentpagedevice /PageSize get aload pop ] //false
   } ifelse
-} bind def
+} bind executeonly def
 
 /get_any_box { % <pagedict> get_any_box <box name> <box>
   //systemdict /UseBleedBox .knownget dup { and } if {
@@ -2325,7 +2353,7 @@
     } ifelse
     4 array astore            % /SomeBox [mX0 mY0 mX1 mY1]
   } ifelse
-} bind def
+} bind executeonly def
 
 % Compute the matrix that transforms the PDF->PS "default" user space
 /pdf_PDF2PS_matrix {	% <pdfpagedict> -- matrix
@@ -2405,7 +2433,7 @@
   % stack: savedCTM <pdfpagedict>
   pop
   matrix currentmatrix exch setmatrix
-} bind def
+} bind executeonly def
 
 % Cache the matrix that transforms the PDF->PS "default" user space
 % into <pdfpagedict> under the key //PDF2PS_matrix_key, then return it
@@ -2417,13 +2445,13 @@
     dup dup pdf_PDF2PS_matrix //PDF2PS_matrix_key exch put
     //PDF2PS_matrix_key get
   } ifelse
-} bind def
+} bind executeonly def
 currentdict /PDF2PS_matrix_key undef
 
 /.pdfshowpage_Install {	% <pagedict> [<prevproc>] .pdfshowpage_Install -
   0 get exec
   pdf_cached_PDF2PS_matrix concat
-} bind def
+} bind executeonly def
 
 /pdfshowpage_setpage {	% <pagedict> pdfshowpage_setpage <pagedict>
   6 dict begin		% for setpagedevice
@@ -2524,7 +2552,7 @@
   /Install exch def
         % Stack: pagedict currentpagedict
   pop currentdict end setpagedevice
-} bind def
+} bind executeonly def
 
 /.free_page_resources {   % - .free_page_resources -
   Page /Resources pget {
@@ -2538,7 +2566,7 @@
       } forall
     } if
   } if
-} bind def
+} bind executeonly def
 
 /pdfshowpage_finish {	% <pagedict> pdfshowpage_finish -
    save /PDFSave exch store
@@ -2551,6 +2579,9 @@
 
   .writepdfmarks {
 
+    % Pagelabel
+      pagelabeldict begin dopagelabel end
+    % Copy the boxes.
         % Copy the boxes.
     { /CropBox /BleedBox /TrimBox /ArtBox } {
       2 copy pget {
@@ -2563,20 +2594,6 @@
         pop
       } ifelse
     } forall
-
-    % Copy annotations and links.
-    dup /Annots knownoget {
-      0 1 2 index length 1 sub
-       { 1 index exch oget
-         dup type /dicttype eq {
-           dup /Subtype oget annottypes exch .knownget { exec } { pop } ifelse
-         } {
-           pop
-         } ifelse
-       }
-      for pop
-    } if
-
   } if		% end .writepdfmarks
 
         % Display the actual page contents.
@@ -2688,7 +2705,7 @@
   .setglobal
   /RepairedAnError exch def
   /Repaired exch def
-} bind def
+} bind executeonly def
 
 % Display the contents of a page (including annotations).
 /showpagecontents {	% <pagedict> showpagecontents -
@@ -2746,7 +2763,7 @@
   //systemdict /ShowAcroForm .knownget { //true eq } { //false } ifelse {
     Trailer /Root oget /AcroForm knownoget { draw_acro_form } if
   } if
-} bind def
+} bind executeonly def
 
 /processcolorspace {	% - processcolorspace <colorspace>
         % The following is per the PLRM3.
@@ -2754,7 +2771,7 @@
   exch pop exch pop
   dup type /nametype ne { cvn } if
   dup { setcolorspace } .internalstopped { pop /DeviceRGB } if
-} bind def
+} bind executeonly def
 
 % ------ Transparency support ------ %
 
@@ -2795,7 +2812,7 @@
     % Also check for transparency in the annotation (if not in resources).
     { pop //true } { annotsusetransparency } ifelse
   } ifelse
-} bind def
+} bind executeonly def
 
 % Check if transparency is specified in an ExtGState dict
 /extgstateusestransparency {	% <gstate dict> extgstateusestransparency <bool>
@@ -2813,7 +2830,7 @@
       pop exit
     } loop
   } ifelse
-} bind def
+} bind executeonly def
 
 % Check if transparency is used in a Pattern
 /patternusestransparency {	% <Pattern dict> patternusestransparency <bool>
@@ -2827,7 +2844,7 @@
     } loop
   }
   ifelse
-} bind def
+} bind executeonly def
 
 % Check the Resources of a page or Form. Check for loops in the resource chain.
 /resourceusestransparency {	% <dict> <dict> resourceusestransparency <bool>
@@ -2895,7 +2912,7 @@
     pop //false exit
   } loop
   exch pop
-} bind def
+} bind executeonly def
 
 % Check if the annotations on a page use transparency
 /annotsusetransparency {	% <page dict> annotsusetransparency <bool>
@@ -2932,7 +2949,7 @@
        } ifelse
      } forall			% For all annots on the page
    } if
-} bind def
+} bind executeonly def
 
 % Add a color name to our spot color list.  Ignore /All and /None
 /putspotcolor {			% <name> <spotcolordict> putspotcolor -
@@ -2939,7 +2956,7 @@
   % 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
-} bind def
+} bind executeonly def
 
 % Determine which spot colors are used within a color space  Note: This
 % dict will include all colors used in Separation or DeviceN color spaces.
@@ -2964,7 +2981,7 @@
     } ifelse
   } if
   pop pop
-} bind def
+} bind executeonly def
 
 % Check the Resources of a page, form, or annotation.  Determine which spot
 % colors are used within the resource  Note: The spot color dict will include
@@ -3039,7 +3056,7 @@
     } if
     exit
   } loop
-} bind def
+} bind executeonly def
 
 % Determine which spot colors are used within the annotations.  Note: This
 % dict will include all colors used in Separation or DeviceN color spaces.
@@ -3058,7 +3075,7 @@
       pop
     } ifelse
  } forall
-} bind def
+} bind executeonly def
 
 % Determine spot colors are used within a page.  We are creating a dict to
 % hold the spot color names as keys.  Using a dict avoids having to worry
@@ -3093,7 +3110,7 @@
   3 -1 roll
   /Annots knownoget { annotsspotcolors } if
   pop				% Discard reference loop dict
-} bind def
+} 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
@@ -3104,7 +3121,7 @@
   [ /Cyan /Magenta /Yellow /Black ]
   { 2 index exch known { 1 sub } if } forall
   exch pop			% Remove spot color dict
-} bind def
+} bind executeonly def
 
 % ------ ColorSpace substitution support ------ %
 
@@ -3134,7 +3151,7 @@
       } ifelse
     } if
   } if
-} bind def
+} bind executeonly def
 
 %% <loopdict> <Objectdict>  <calling obj_num> pdfform_detect_cspacesub <boolean>
 %%
@@ -3218,7 +3235,7 @@
   } loop
   %% remove and discard the loopdict
   exch pop
-} bind def
+} bind executeonly def
 
 %
 % <pagedict> pdfshowpage_detect_cspacesub <pagedict> <boolean>
@@ -3236,7 +3253,7 @@
   /HighLevelDevice /GetDeviceParam .special_op {
       exch pop not exch pop
   }if
-} bind def
+} bind executeonly def
 
 %
 %  <pagedict>   pdfshowpage_setcspacesub   <pagedict>
@@ -3309,7 +3326,7 @@
       pop
     } ifelse
   } if
-} bind def
+} bind executeonly def
 
 % Write OutputIntents to device if the device handles it
 /writeoutputintents {
@@ -3370,7 +3387,7 @@
         pop pop
     } if
   } if
-} bind def
+} bind executeonly def
 
 end			% pdfdict
 .setglobal
@@ -3393,6 +3410,7 @@
 /.setfillconstantalpha /.setalphaisshape /.currentalphaisshape
 /.settextspacing /.currenttextspacing /.settextleading /.currenttextleading /.settextrise /.currenttextrise
 /.setwordspacing /.currentwordspacing /.settexthscaling /.currenttexthscaling
+/.setdistillerparams
 
 % Used by our own test suite files
 %/.pushpdf14devicefilter    % transparency-example.ps

Modified: trunk/Master/tlpkg/tlgs/Resource/Init/pdf_ops.ps
===================================================================
--- trunk/Master/tlpkg/tlgs/Resource/Init/pdf_ops.ps	2018-09-04 21:40:52 UTC (rev 48581)
+++ trunk/Master/tlpkg/tlgs/Resource/Init/pdf_ops.ps	2018-09-04 22:33:58 UTC (rev 48582)
@@ -22,7 +22,7 @@
 % to think this interpreter is a distiller.
 % (If this interpreter really is a distiller, don't do this.)
 systemdict /pdfmark known not
- { userdict /pdfmark { cleartomark } bind put } if
+ { userdict /pdfmark { cleartomark } bind executeonly put } if
 
 userdict /GS_PDF_ProcSet 256 dict dup begin
 
@@ -71,10 +71,10 @@
   20 dict copy dup begin
   1 packedarray cvx executeonly /self exch def
   graphicsbeginpage textbeginpage
-} bdef
+} bind executeonly def
 /endpage {	% - endpage -
   showpage end
-} bdef
+} bind executeonly def
 
 /graphicsbeginpage {
   initgraphics
@@ -82,7 +82,7 @@
   currentdict /ClipRect knownoget { aload pop rectclip } if
   0 g  0 G //false op //false OP  0 OPM
   1 ca  1 CA //null SMask //false AIS  /Compatible BM //true TK
-} bdef
+} bind executeonly def
 
 % We must allow /Show to be set, otherwise a text operation can
 % end up in infinite recursion with showfirst calling Show, and
@@ -102,7 +102,7 @@
      exch currentdict //nodict eq { /self dup load end 5 dict begin def } if
      def
    } ifelse
- } bdef
+ } bind executeonly def
 currentdict /gput_always_allow .undef
 
 /q {
@@ -131,6 +131,9 @@
     %% original TextSaveMatrix behind allows the matching ET not to throw an error, as well as coping
     %% with the various other problems listed above. Its not pretty though.
     currentdict /TextSaveMatrix known {
+      (   **** Error: Encountered a 'q' inside a Text Object, this is illegal.\n)
+      pdfformaterror
+      (               Output may be incorrect..\n) pdfformaterror
       currentdict /TextSaveMatrix get matrix copy
       gsave //nodict begin
       /qTextSaveMatrix gput
@@ -139,7 +142,7 @@
     }ifelse
   } ifelse
   PDFusingtransparency { .pushextendedgstate } if
-} bdef
+} bind executeonly def
 
 % Some PDF files have excess Q operators!
 /Q {
@@ -193,12 +196,12 @@
       pdfformaterror
     } ifelse
   } if
-} bdef
+} bind executeonly def
 
 % Save PDF gstate
 /qstate {       % - qstate <qstate>
   gstate
-} bdef
+} bind executeonly def
 
 % Set PDF gstate
 /setqstate {    % <qstate> setqstate -
@@ -209,11 +212,11 @@
     exch setgstate matrix currentmatrix matrix setmatrix
     exch newpath uappend setmatrix
   } ifelse
-} bdef
+} bind executeonly def
 
 % ---------------- Color setting ---------------- %
 
-/nullpatternproc { pop } bdef
+/nullpatternproc { pop } bind executeonly def
 /nullpattern mark
    /PatternType 1 /PaintType 1 /TilingType 3 /BBox [0 0 1 1]
    /XStep 1 /YStep 1 /PaintProc //nullpatternproc
@@ -264,33 +267,33 @@
          DefaultQstate exch put
        } if
      } ifelse
-} bdef
+} bind executeonly def
 
 /CSdict mark
-  /DeviceGray { 0 } bind
-  /DeviceRGB { [0 0 0] cvx } bind
-  /DeviceCMYK { [0 0 0 1] cvx } bind
-  /CIEBasedA { 0 } bind
-  /CIEBasedABC { [0 0 0] cvx } bind
-  /CalGray { pop /DeviceGray 0 } bind
-  /CalRGB { pop /DeviceRGB [0 0 0] cvx } bind
-  /Lab {[0 0 0] cvx } bind
-  /ICCBased { [ 1 index 1 oget /N get { 0 } repeat ] cvx } bind
-  /Separation { 1 } bind
+  /DeviceGray { 0 } bind executeonly
+  /DeviceRGB { [0 0 0] cvx } bind executeonly
+  /DeviceCMYK { [0 0 0 1] cvx } bind executeonly
+  /CIEBasedA { 0 } bind executeonly
+  /CIEBasedABC { [0 0 0] cvx } bind executeonly
+  /CalGray { pop /DeviceGray 0 } bind executeonly
+  /CalRGB { pop /DeviceRGB [0 0 0] cvx } bind executeonly
+  /Lab {[0 0 0] cvx } bind executeonly
+  /ICCBased { [ 1 index 1 oget /N get { 0 } repeat ] cvx } bind executeonly
+  /Separation { 1 } bind executeonly
   /DeviceN {	% What is the correct value??
     [ 1 index 1 get length { 1 } repeat ] cvx
-  } bind
-  /Indexed { 0 } bind
-  /Pattern { //nullpattern matrix makepattern } bind
+  } bind executeonly
+  /Indexed { 0 } bind executeonly
+  /Pattern { //nullpattern matrix makepattern } bind executeonly
 .dicttomark readonly def
 
-/ri {//.renderingintentdict exch .knownget { .setrenderingintent } if } bdef
-/g  {/DeviceGray .setfillcolorspace .setfillcolor } bdef
-/G  {/DeviceGray .setstrokecolorspace .setstrokecolor} bdef
-/rg {/DeviceRGB .setfillcolorspace .setfillcolor} bdef
-/RG {/DeviceRGB .setstrokecolorspace .setstrokecolor} bdef
-/k  {/DeviceCMYK .setfillcolorspace .setfillcolor} bdef
-/K  {/DeviceCMYK .setstrokecolorspace .setstrokecolor} bdef
+/ri {//.renderingintentdict exch .knownget { .setrenderingintent } if } bind executeonly def
+/g  {/DeviceGray .setfillcolorspace .setfillcolor } bind executeonly def
+/G  {/DeviceGray .setstrokecolorspace .setstrokecolor} bind executeonly def
+/rg {/DeviceRGB .setfillcolorspace .setfillcolor} bind executeonly def
+/RG {/DeviceRGB .setstrokecolorspace .setstrokecolor} bind executeonly def
+/k  {/DeviceCMYK .setfillcolorspace .setfillcolor} bind executeonly def
+/K  {/DeviceCMYK .setstrokecolorspace .setstrokecolor} bind executeonly def
 /cs {dup dup type /nametype ne { 0 get } if
   dup /ICCBased eq {
     1 index 1 get /OrigN .knownget not {1 index 1 get /N get} if mark
@@ -325,7 +328,7 @@
   } {
     //CSdict exch get exec exch .setfillcolorspace exec .setfillcolor
   } ifelse
-} bdef
+} bind executeonly def
 /CS {dup dup type /nametype ne { 0 get } if
   dup /ICCBased eq {
     1 index 1 get /OrigN .knownget not {1 index 1 get /N get} if mark
@@ -359,11 +362,11 @@
   } {
     //CSdict exch get exec exch .setstrokecolorspace exec .setstrokecolor
   } ifelse
-} bdef
-/sc {.setfillcolor} bdef
-/SC {.setstrokecolor} bdef
-/sc* {.setfillcolor} bdef
-/SC* {.setstrokecolor} bdef
+} bind executeonly def
+/sc {.setfillcolor} bind executeonly def
+/SC {.setstrokecolor} bind executeonly def
+/sc* {.setfillcolor} bind executeonly def
+/SC* {.setstrokecolor} bind executeonly def
 /sc*_and_set {
   dup type /dicttype eq
   {
@@ -376,7 +379,7 @@
     } ifelse
   } if
   .setfillcolor
-} bdef
+} bind executeonly def
 /SC*_and_set {
   dup type /dicttype eq
   {
@@ -389,9 +392,9 @@
     } ifelse
   } if
   .setstrokecolor
-} bdef
-/sc1 {.setfillcolor} bdef
-/SC1 {.setstrokecolor} bdef
+} bind executeonly def
+/sc1 {.setfillcolor} bind executeonly def
+/SC1 {.setstrokecolor} bind executeonly def
 /sc1_and_set {
   dup type /dicttype eq
   {
@@ -404,7 +407,7 @@
     } ifelse
   } if
   .setfillcolor
-} bdef
+} bind executeonly def
 /SC1_and_set {
   dup type /dicttype eq
   {
@@ -417,9 +420,9 @@
     } ifelse
   } if
   .setstrokecolor
-} bdef
-/csput {dup dup type /nametype ne { 0 get } if //CSdict exch get exec exch 2 copy .setfillcolorspace exec .setfillcolor .setstrokecolorspace exec .setstrokecolor} bdef
-/csset {dup dup type /nametype ne { 0 get } if //CSdict exch get exec exch} bdef
+} bind executeonly def
+/csput {dup dup type /nametype ne { 0 get } if //CSdict exch get exec exch 2 copy .setfillcolorspace exec .setfillcolor .setstrokecolorspace exec .setstrokecolor} bind executeonly def
+/csset {dup dup type /nametype ne { 0 get } if //CSdict exch get exec exch} bind executeonly def
 
 % ---------------- Color setting ---------------- %
 
@@ -427,14 +430,14 @@
 % ---------------- Overprint/transparency setting ---------------- %
 
 /op { .setfilloverprint
-} bdef	% NB pdf_draw:gsparamdict handled /OP with no /op
+} bind executeonly def	% NB pdf_draw:gsparamdict handled /OP with no /op
 /OP { .setstrokeoverprint
-} bdef
+} bind executeonly def
 /OPM {
   /.setoverprintmode where { pop dup .setoverprintmode .swapcolors .setoverprintmode .swapcolors } { pop } ifelse
-} bdef
-/ca { .setfillconstantalpha } bdef
-/CA { .setstrokeconstantalpha } bdef
+} bind executeonly def
+/ca { .setfillconstantalpha } bind executeonly def
+/CA { .setstrokeconstantalpha } bind executeonly def
 /SMask {
   dup type /booleantype eq {
     .currentSMask type /dicttype eq {
@@ -451,8 +454,8 @@
   %% a gsave, so we haven't copied it to /self, if we don't do that here
   %% then transparent annotations cause an invalid access error.
   currentdict //nodict eq {/self dup load end 5 dict begin def} if
-} bdef
-/AIS { .setalphaisshape } bdef
+} bind executeonly def
+/AIS { .setalphaisshape } bind executeonly def
 /BM {
   /.setblendmode where {
     pop [ exch dup type /nametype ne { aload pop } if /Normal ] {
@@ -461,15 +464,15 @@
   } {
     pop
   } ifelse
-} bdef
+} bind executeonly def
 /TK {
   /.settextknockout where { pop .settextknockout } { pop } ifelse
-} bdef
+} bind executeonly def
 
 /UseBlackPtComp {
   %% Our implementation of black point compensation uses 0 or 1, not a boolean
   /.setblackptcomp where {pop false eq {0}{1}ifelse .setblackptcomp }{ pop } ifelse
-} bdef
+} bind executeonly def
 
 % ---------------- Color installation ---------------- %
 
@@ -488,7 +491,7 @@
   } {
     pop pop
   } ifelse
-} bdef
+} bind executeonly def
 /.settransparencymask {		% <paramdict> <masknum> .settransparencymask -
   exch dup type /dicttype ne {
     PDFusingtransparency {
@@ -507,24 +510,24 @@
       dup /Draw get exec
     } ifelse
   } ifelse
-} bdef
+} bind executeonly def
 % (Non-mask) images must execute setfillblend.
 /setfillblend {
   .currentfillconstantalpha
   .currentSMask .settransparencyparams
-} def
+} bind executeonly def
 /setfillstate {
   setfillblend
-} def
+} bind executeonly def
 /setstrokestate {
   .currentstrokeconstantalpha
   .currentSMask .settransparencyparams
-} def
+} bind executeonly def
 /Cdict 15 dict dup begin	% <color...> <colorspace> -proc- -
-  /DeviceGray { pop setgray } bdef
-  /DeviceRGB { pop setrgbcolor } bdef
-  /DeviceCMYK { pop setcmykcolor } bdef
-  /CIEBasedA { setgcolorspace setcolor } bdef
+  /DeviceGray { pop setgray } bind executeonly def
+  /DeviceRGB { pop setrgbcolor } bind executeonly def
+  /DeviceCMYK { pop setcmykcolor } bind executeonly def
+  /CIEBasedA { setgcolorspace setcolor } bind executeonly def
   /CIEBasedABC /CIEBasedA load def
   /CIEBasedDEF /CIEBasedA load def
   /CIEBasedDEFG /CIEBasedA load def
@@ -580,7 +583,7 @@
       cleartomark pop
     }
     ifelse
-  } bdef
+  } bind executeonly def
   /Separation /CIEBasedA load def
   /DeviceN /CIEBasedA load def
   /Indexed /CIEBasedA load def
@@ -632,7 +635,7 @@
        } if
      } ifelse
      setcolor
-   } bdef
+   } bind executeonly def
 end def
 /setgcolor	% (null | <color...>) <colorspace> setgcolor -
  { 1 index //null eq
@@ -639,23 +642,23 @@
     { pop pop }
     { dup 0 get //Cdict exch get exec }
    ifelse
- } bdef
+ } bind executeonly def
 % Compare the old and new color spaces in an attempt to avoid expensive
 % reloads of CIEBased color spaces.
 /PCSdict 15 dict dup begin	% <colorspace> -proc- <colorspace|pdfcspace>
-  /CIEBasedA { dup 1 get /PDFColorSpace .knownget { exch pop } if } bdef
+  /CIEBasedA { dup 1 get /PDFColorSpace .knownget { exch pop } if } bind executeonly def
   /CIEBasedABC /CIEBasedA load def
   /CIEBasedDEF /CIEBasedA load def
   /CIEBasedDEFG /CIEBasedA load def
   /Indexed {
     dup 1 get dup pdfcolorspace 2 copy ne { 3 1 roll } if pop pop
-  } bdef
+  } bind executeonly def
 end def
 /pdfcolorspace {	% <colorspace> pdfcolorspace <colorspace|pdfcspace>
   dup type /arraytype eq {
     //PCSdict 1 index 0 get .knownget { exec } if
   } if
-} bdef
+} bind executeonly def
 /setgcolorspace {	% <colorspace> setgcolorspace -
   dup pdfcolorspace currentcolorspace pdfcolorspace eq {
     pop
@@ -662,7 +665,7 @@
   } {
     setcolorspace
   } ifelse
-} bdef
+} bind executeonly def
 
 /OPsavedict 2 dict def		% for saveOP, saveBM
 
@@ -685,7 +688,7 @@
    } {
       pop //false
    } ifelse
-} bdef
+} bind executeonly def
 
 /fsexec		% <fillop|strokeop> fsexec -
 {
@@ -713,7 +716,7 @@
    } {
       cvx exec
    } ifelse
-} bdef
+} bind executeonly def
 
 % ---------------- Path painting and clipping ---------------- %
 
@@ -734,9 +737,9 @@
       currentdict /qTextSaveMatrix get setmatrix
     } if
   } ifelse
-} bind def
+} bind executeonly def
 
-/normal_m { { moveto }  stopped { count pdfemptycount sub 2 .min { pop } repeat 0 0 moveto } if } bdef
+/normal_m { { moveto }  stopped { count pdfemptycount sub 2 .min { pop } repeat 0 0 moveto } if } bind executeonly def
 /inside_text_m {
   {
     matrix currentmatrix 3 1 roll
@@ -745,9 +748,9 @@
     setmatrix
   }
   stopped { count pdfemptycount sub 2 .min { pop } repeat 0 0 moveto } if
-} bdef
+} bind executeonly def
 
-/normal_l { { lineto }  stopped { count pdfemptycount sub 2 .min { pop } repeat } if } bdef
+/normal_l { { lineto }  stopped { count pdfemptycount sub 2 .min { pop } repeat } if } bind executeonly def
 /inside_text_l {
   {
     matrix currentmatrix 3 1 roll
@@ -756,9 +759,9 @@
     setmatrix
   }
   stopped { count pdfemptycount sub 2 .min { pop } repeat } if
-} bdef
+} bind executeonly def
 
-/normal_c { { curveto } stopped { count pdfemptycount sub 6 .min { pop } repeat } if } bdef
+/normal_c { { curveto } stopped { count pdfemptycount sub 6 .min { pop } repeat } if } bind executeonly def
 /inside_text_c {
   {
     matrix currentmatrix 7 1 roll
@@ -767,7 +770,7 @@
     setmatrix
   }
   stopped { count pdfemptycount sub 6 .min { pop } repeat } if
-} bdef
+} bind executeonly def
 
 /normal_v { count pdfemptycount sub 4 ge {
          { currentpoint 6 2 roll curveto } stopped { count pdfemptycount sub 6 .min { pop } repeat  } if
@@ -774,7 +777,7 @@
        } {
          count pdfemptycount sub { pop } repeat
        } ifelse
-     } bdef
+     } bind executeonly def
 /inside_text_v { count pdfemptycount sub 4 ge {
          {
            matrix currentmatrix 5 1 roll
@@ -785,9 +788,9 @@
        } {
          count pdfemptycount sub { pop } repeat
        } ifelse
-     } bdef
+     } bind executeonly def
 
-/normal_y { { 2 copy curveto } stopped { count pdfemptycount sub 6 .min { pop } repeat } if } bdef
+/normal_y { { 2 copy curveto } stopped { count pdfemptycount sub 6 .min { pop } repeat } if } bind executeonly def
 /inside_text_y {
   {
     matrix currentmatrix 5 1 roll
@@ -796,12 +799,12 @@
     setmatrix
   }
   stopped { count pdfemptycount sub 6 .min { pop } repeat } if
-} bdef
+} bind executeonly def
 
 /normal_re {
    4 2 roll moveto  exch dup 0 rlineto  0 3 -1 roll rlineto  neg 0 rlineto
    closepath
-  } bdef
+  } bind executeonly def
 /inside_text_re {
    matrix currentmatrix 5 1 roll
    check_and_set_saved_matrix
@@ -808,7 +811,7 @@
    4 2 roll moveto  exch dup 0 rlineto  0 3 -1 roll rlineto  neg 0 rlineto
    closepath
    setmatrix
-  } bdef
+  } bind executeonly def
 
 /S {
   OFFlevels length 0 eq {
@@ -816,7 +819,7 @@
   } {
     newpath
   } ifelse
-} bdef
+} bind executeonly def
 
 /f {
   OFFlevels length 0 eq {
@@ -824,7 +827,7 @@
   } {
     newpath
   } ifelse
-} bdef
+} bind executeonly def
 
 /f* {
   OFFlevels length 0 eq {
@@ -832,11 +835,11 @@
   } {
     newpath
   } ifelse
-} bdef
+} bind executeonly def
 
-/n { newpath } bdef		% don't allow n to get bound in
+/n { newpath } bind executeonly def		% don't allow n to get bound in
 
-/s { closepath S } bdef
+/s { closepath S } bind executeonly def
 
 /B {
   OFFlevels length 0 eq {
@@ -860,9 +863,9 @@
   } {
     newpath
   } ifelse
-} bdef
+} bind executeonly def
 
-/b { closepath B } bdef
+/b { closepath B } bind executeonly def
 
 /B* {
   OFFlevels length 0 eq {
@@ -886,16 +889,16 @@
   } {
     newpath
   } ifelse
-} bdef
+} bind executeonly def
 
-/b* { closepath B* } bdef
+/b* { closepath B* } bind executeonly def
 
 % Clipping:
 
 /Wdict 8 dict dup begin
-/S { OFFlevels length 0 eq { gsave setstrokestate .swapcolors stroke .swapcolors grestore } if n } bdef
-/f { OFFlevels length 0 eq { gsave setfillstate fill grestore } if n } bdef
-/f* { OFFlevels length 0 eq { gsave setfillstate eofill grestore } if n } bdef
+/S { OFFlevels length 0 eq { gsave setstrokestate .swapcolors stroke .swapcolors grestore } if n } bind executeonly def
+/f { OFFlevels length 0 eq { gsave setfillstate fill grestore } if n } bind executeonly def
+/f* { OFFlevels length 0 eq { gsave setfillstate eofill grestore } if n } bind executeonly def
 /B {
   OFFlevels length 0 eq {
     PDFusingtransparency {
@@ -920,8 +923,8 @@
     } ifelse
   } if
   n
-} bdef
-/b { closepath B } bdef
+} bind executeonly def
+/b { closepath B } bind executeonly def
 /B* {
   OFFlevels length 0 eq {
     PDFusingtransparency {
@@ -943,16 +946,16 @@
     } ifelse
   } if
   n
-} bdef
-/b { closepath B* } bdef
-/n { end { currentpoint } stopped not { pop pop clip } if newpath } bdef
+} bind executeonly def
+/b { closepath B* } bind executeonly def
+/n { end { currentpoint } stopped not { pop pop clip } if newpath } bind executeonly def
 end readonly def
-/W { //Wdict begin } bdef
+/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 } bdef
+/n { end { currentpoint } stopped not { pop pop eoclip } if newpath } bind executeonly def
 end readonly def
-/W* { //W*dict begin } bdef
+/W* { //W*dict begin } bind executeonly def
 % ---------------- Text control ---------------- %
 
 /textbeginpage
@@ -961,7 +964,7 @@
    /FontMatrixNonHV //false def
    /Show { showfirst } def
    /TextFillStateNeeded //true def
- } bdef
+ } bind executeonly def
 
 /TestDegenerateCTM {
   matrix currentmatrix
@@ -977,7 +980,7 @@
   }{
     false
   } ifelse
-} bdef
+} bind executeonly def
 
 % Contrary to the statement in the PDF manual, BT and ET *can* be nested,
 % if the CharProc for a Type 3 font does a BT/ET itself.
@@ -1001,7 +1004,7 @@
   1 scale } if
   .currenttextrise 0 ne { 0 .currenttextrise
    translate } if
-} bdef
+} bind executeonly def
 
 /settextstate {
         % The text state can be set even outside BT/ET.
@@ -1021,7 +1024,23 @@
     6 array astore
     setmatrix settextmatrix
   } if
-} bdef
+  currentdict /qTextSaveMatrix known {
+    qTextSaveMatrix
+    aload pop
+    5 index 0 ne 3 index 0 ne and
+    5 index 0 ne 5 index 0 ne and or not {
+      (\n   **** Error: Invalid (0 scaling) text matrix for Tm ****\n)
+      pdfformaterror
+      (                 Output may be incorrect.\n) pdfformaterror
+      % handle invalid scale by using a really small value
+      2 -6 roll pop pop pop pop
+      0.00000001 0 0 0.00000001
+      6 -2 roll
+    }if
+    6 array astore
+    setmatrix settextmatrix
+  } if
+} bind executeonly def
 /settextposition {
                 % Update the TextMatrix translation.
   gsave TextSaveMatrix setmatrix
@@ -1046,8 +1065,14 @@
       (               Ignroing error, output may be incorrect.\n) pdfformaterror
     grestore
   } ifelse
-} bdef
+} bind executeonly def
 
+%% Do not make the procedures here executeonly. The /m procedure is
+%% tested in /.pdf_paintproc in pdf_draw.ps, we need to be able to
+%% read the name of the procedure from here in order to determine
+%% whether we are inside a text block. The procedures themselves
+%% are already executeonly anyway.
+
 /switch_to_text_marking_ops {
     pdfopdict /m {inside_text_m} bind .forceput
     pdfopdict /l {inside_text_l} bind .forceput
@@ -1055,7 +1080,7 @@
     pdfopdict /v {inside_text_v} bind .forceput
     pdfopdict /y {inside_text_y} bind .forceput
     pdfopdict /re {inside_text_re} bind .forceput
-} bdef
+} bind executeonly def
 
 /switch_to_normal_marking_ops {
     pdfopdict /m {normal_m} bind .forceput
@@ -1064,7 +1089,7 @@
     pdfopdict /v {normal_v} bind .forceput
     pdfopdict /y {normal_y} bind .forceput
     pdfopdict /re {normal_re} bind .forceput
-} bdef
+} bind executeonly def
 
 /BT {
   currentdict /TextSaveMatrix known {
@@ -1106,7 +1131,7 @@
     .begintransparencytextgroup
   } if
   
-} bdef
+} bind executeonly def
 
 /ET_NO_TXT_KO {
   currentdict /TextSaveMatrix known {
@@ -1131,7 +1156,7 @@
   currentdict /qTextSaveMatrix known not {
     switch_to_normal_marking_ops
   } if
-} bdef
+} bind executeonly def
 
 /ET {
   //ET_NO_TXT_KO exec
@@ -1139,13 +1164,13 @@
   PDFusingtransparency .currenttextknockout and {
     .endtransparencytextgroup
   } if 
-} bdef
+} bind executeonly def
 
-/Tc { .settextspacing { showfirst } /Show gput } bdef
-/TL { .settextleading } bdef
-/Tr { .settextrenderingmode { showfirst } /Show gput } bdef
-/Ts { .settextrise settextstate } bdef
-/Tw { .setwordspacing { showfirst } /Show gput } bdef
+/Tc { .settextspacing { showfirst } /Show gput } bind executeonly def
+/TL { .settextleading } bind executeonly def
+/Tr { .settextrenderingmode { showfirst } /Show gput } bind executeonly def
+/Ts { .settextrise settextstate } bind executeonly def
+/Tw { .setwordspacing { showfirst } /Show gput } bind executeonly def
 /Tz {
   dup 0 eq {
     (\n   **** Error: Invalid 0.0 horizontal text scaling given for Tz\n)
@@ -1155,7 +1180,7 @@
   }{
     100 div
   }ifelse .settexthscaling %/TextHScaling gput
-  settextstate} bdef
+  settextstate} bind executeonly def
 
 % ---------------- Font control ---------------- %
 
@@ -1175,7 +1200,7 @@
     } {
         //false
     } ifelse
-} bdef
+} bind executeonly def
     % Worker procedure for recursive checking of font matrices
 /?FontMatrixNonHV {		    % {self} ?horz <<font>> -- {self} ?horz ?nonhv
     2 copy //?FontMatrixNonHV exec {	    % check the font's own FontMatrix
@@ -1203,7 +1228,7 @@
         %stack: {testproc} ?nonhv {self} ?horz
         4 2 roll exch pop
     } ifelse
-} bdef
+} bind executeonly def
     % Main procedure
 /?FontMatrixNonHV {		% <<rootfont>> -- ?nonhv
     //?FontMatrixNonHV exch
@@ -1213,7 +1238,7 @@
     % call the worker procedure
     //?FontMatrixNonHV exec
     exch pop exch pop
-} bdef
+} bind executeonly def
 
 /Tf {		% <font> <scale> Tf -
   dup .setPDFfontsize
@@ -1233,7 +1258,7 @@
     pop
   } ifelse
   setfont
-} bdef
+} bind executeonly def
 
 % Copy a font, removing its FID.  If changed is true, also remove
 % the UniqueID and XUID, if any.  If the original dictionary doesn't have
@@ -1277,7 +1302,7 @@
    {dup 3 -1 roll /.OrigUniqueIDXUID exch put}
    ifelse
 
-} bdef
+} bind executeonly def
 
 % Insert a new Encoding or Metrics into a font if necessary.
 % Return a possibly updated font, and a flag to indicate whether
@@ -1289,7 +1314,7 @@
   } {
     pop //false
   } ifelse
-} bdef
+} bind executeonly def
 
 /.updatefontencoding {	% <font> <Encoding|null> .updatefontencoding
                         %   <font'> <copied>
@@ -1298,7 +1323,7 @@
   } {
     pop //false
   } ifelse
-} bdef
+} bind executeonly def
 
 % Duplicate keys in CharString dictionary according to GlyphMap: <</new_glyph /old_glyph>>
 % We have to do this because PDF fonts can associate multiple widths with the same glyph
@@ -1329,7 +1354,7 @@
   } {
     pop //false
   } ifelse
-} bdef
+} bind executeonly def
 
 /.updatefont {	      % <font> <Encoding|null> <Metrics|null> <GlyphMap|null>
                       %        .updatefont <font'> <copied>
@@ -1340,7 +1365,7 @@
   3 1 roll exch       % bool bool <font> <Metrics|null>
   .updatefontmetrics  % bool bool <font> bool
   4 2 roll or or      % <font> is_copied
-} bdef
+} bind executeonly def
 
 % ---------------- Text positioning ---------------- %
 
@@ -1370,9 +1395,9 @@
   matrix .currenttextlinematrix .settextmatrix
 
   settextstate
-} bdef
-/TD { dup neg .settextleading Td } bdef
-/T* { 0 .currenttextleading neg Td } bdef
+} bind executeonly def
+/TD { dup neg .settextleading Td } bind executeonly def
+/T* { 0 .currenttextleading neg Td } bind executeonly def
 /Tm {
   5 index 0 ne 3 index 0 ne and
   5 index 0 ne 5 index 0 ne and or not {
@@ -1387,27 +1412,27 @@
   matrix .currenttextlinematrix astore .settextlinematrix
   matrix .currenttextlinematrix .settextmatrix
   settextstate
-} bdef
+} bind executeonly def
 
 % ---------------- Text painting ---------------- %
 
 /Vexch {
   rootfont /WMode knownoget { 1 eq { exch } if } if
-} bind def
+} bind executeonly def
 
 /textrenderingprocs [		% (0 is handled specially)
         % Painting-only modes
-   { tf } { tS } { tB } { tn }
+   { tf } executeonly { tS } executeonly { tB } executeonly { tn }
         % Clipping modes
-   { gsave tf grestore tW }
-   { gsave tS grestore tW }
-   { gsave tB grestore tW }
-   { tW }
+   { gsave tf grestore tW } executeonly
+   { gsave tS grestore tW } executeonly
+   { gsave tB grestore tW } executeonly
+   { tW } executeonly
 ] readonly def
 
 /pdfwrite_textrenderingprocs [
         % Tr 0 - Fill
-        { setfillstate show } bind
+        { setfillstate show } bind executeonly
         % Tr 1 - Stroke
         { currentlinewidth exch setstrokestate
         % Need to set the stroke width to a value which gives the correct
@@ -1415,7 +1440,11 @@
         % CTM, so we need to calculate the stroke width which would result
         % if the CTM had been unity.
           currentlinewidth dup
-          matrix defaultmatrix idtransform TextSaveMatrix dtransform
+          currentdict /qTextSaveMatrix known {
+            matrix defaultmatrix idtransform qTextSaveMatrix dtransform
+          }{
+            matrix defaultmatrix idtransform TextSaveMatrix dtransform
+          } ifelse
           abs 2 copy exch abs eq {
             pop
           }{
@@ -1423,7 +1452,7 @@
             % we can ignore it. (wrong answer, but consistent)
             pop pop currentlinewidth
           }ifelse setlinewidth
-          show setlinewidth} bind
+          show setlinewidth} bind executeonly
         % Tr 2 - Fill then Stroke
         { currentlinewidth exch setstrokestate
         % Need to set the stroke width to a value which gives the correct
@@ -1431,7 +1460,11 @@
         % CTM, so we need to calculate the stroke width which would result
         % if the CTM had been unity.
           currentlinewidth dup
-          matrix defaultmatrix idtransform TextSaveMatrix dtransform
+          currentdict /qTextSaveMatrix known {
+            matrix defaultmatrix idtransform qTextSaveMatrix dtransform
+          }{
+            matrix defaultmatrix idtransform TextSaveMatrix dtransform
+          } ifelse
           abs 2 copy exch abs eq {
             pop
           }{
@@ -1439,9 +1472,9 @@
             % we can ignore it. (wrong answer, but consistent)
             pop pop currentlinewidth
           }ifelse setlinewidth
-          setfillstate show setlinewidth} bind
+          setfillstate show setlinewidth} bind executeonly
         % Tr 3 - Neither fill nor stroke
-        { setfillstate show } bind
+        { setfillstate show } bind executeonly
         %
         % pdfwrite emits all text inside a gsave/grestore pair. As
         % a result we can't preserve any of the 'clip' modes, as the
@@ -1450,7 +1483,7 @@
         %
         % Tr 4 - Fill, add to clip
         { gsave 0 .settextrenderingmode
-          setfillstate dup show grestore //true charpath } bind
+          setfillstate dup show grestore //true charpath } bind executeonly
         % Tr 5 - Stroke, add to clip
         { gsave 1 .settextrenderingmode
           currentlinewidth dup
@@ -1463,11 +1496,15 @@
             pop pop currentlinewidth
           }ifelse setlinewidth
           setstrokestate dup show grestore
-          //true charpath} bind
+          //true charpath} bind executeonly
         % Tr 6 - Fill, stroke, add to clip
         { gsave 2 .settextrenderingmode
           currentlinewidth dup
-          matrix defaultmatrix idtransform TextSaveMatrix dtransform
+          currentdict /qTextSaveMatrix known {
+            matrix defaultmatrix idtransform qTextSaveMatrix dtransform
+          }{
+            matrix defaultmatrix idtransform TextSaveMatrix dtransform
+          } ifelse
           abs 2 copy exch abs eq {
             pop
           }{
@@ -1476,9 +1513,9 @@
             pop pop currentlinewidth
           }ifelse setlinewidth
           setstrokestate setfillstate dup show grestore
-          //true charpath} bind
+          //true charpath} bind executeonly
         % Tr 7 - Add to clip
-        { //true charpath} bind
+        { //true charpath} bind executeonly
 ] readonly def
 
 /setstrokeforTrpreservation {
@@ -1509,12 +1546,12 @@
           setlinewidth
       } if
     } if
-} bind def
+} bind executeonly def
 
 % conditionally set fillstate to avoid multiple operations during text operators
 /settextfillstate {
   TextFillStateNeeded { setfillstate //false /TextFillStateNeeded gput } if
-} bind def
+} bind executeonly def
 
 % If current path is not known to be valid, use the clip path
 /TextTransSetup {	% showarg path_valid TextTransSetup false showarg
@@ -1537,7 +1574,7 @@
    } {
      pop	% discard path_valid boolean
    } ifelse
-} bind def
+} bind executeonly def
 
 /TextTransTeardown {	% stack: path_valid
    .currentblendmode /CompatibleOverprint eq {
@@ -1548,7 +1585,7 @@
    .currentSMask //null ne {
      .endtransparencygroup
    } if
-} bind def
+} bind executeonly def
 
 /setshowstate
  {
@@ -1744,8 +1781,8 @@
       ifelse
     }
    ifelse /Show gput
- } bdef
-/showfirst { setshowstate Show } def
+ } bind executeonly def
+/showfirst { setshowstate Show } executeonly def
 
 /Tj {
   {
@@ -1758,9 +1795,9 @@
     gsave nulldevice exec grestore
   } ifelse
   //true /TextFillStateNeeded gput
-} bdef
-/' { T* Tj } bdef
-/" { exch Tc exch Tw T* Tj } bdef
+} bind executeonly def
+/' { T* Tj } bind executeonly def
+/" { exch Tc exch Tw T* Tj } bind executeonly def
 /TJ {
   { 0 0 moveto {
       dup type /stringtype eq {
@@ -1778,7 +1815,7 @@
     gsave nulldevice exec grestore
   } ifelse
   //true /TextFillStateNeeded gput
-} bdef
+} bind executeonly def
 
 % NB: We don't need clippath when filling or stroking
 /tf {
@@ -1786,7 +1823,7 @@
       //true /TextFillStateNeeded gput
       settextfillstate //true TextTransSetup currentpoint fill TextTransTeardown moveto
   } if
-} bdef
+} bind executeonly def
 /tn { currentpoint newpath moveto } bdef % Obsolete, never used.
 % For stroking characters, temporarily restore the graphics CTM so that
 % the line width will be transformed properly.
@@ -1800,12 +1837,14 @@
    {
     .currentPDFfontsize 0 eq not {
        setstrokestate //true TextTransSetup
-       currentpoint //Tmatrix currentmatrix TextSaveMatrix setmatrix .swapcolors stroke TextTransTeardown .swapcolors
+       currentpoint //Tmatrix currentmatrix TextSaveMatrix setmatrix
+       currentdict /qTextSaveMatrix known {qTextSaveMatrix setmatrix} if
+       .swapcolors stroke TextTransTeardown .swapcolors
        setmatrix moveto
     } if
    } ifelse
    //true /TextFillStateNeeded gput
- } bdef
+ } bind executeonly def
 
 % Handle transparency the same as /B operator
 /tB {
@@ -1825,11 +1864,11 @@
           gsave tf grestore tS
         } ifelse
    //true /TextFillStateNeeded gput
-} bdef
+} bind executeonly def
 
 % This does the wrong thing if there have been multiple text operations
 % within a single BT/ET pair, but it's a start.
-/tW { } bdef
+/tW { } bind executeonly def
 
 %% split a string containing \r or \n into multiple strings)
 %% \r\n is also handled.
@@ -1869,7 +1908,7 @@
   } {
     pop pop pop
   } ifelse
-} bind def
+} bind executeonly def
 
 % Text formatting and painting for the AcroForm field without appearance streams.
 /Tform {                % <MaxLen> (V) <Ff> <Q> Tform -
@@ -1995,7 +2034,7 @@
       Show                      % -
     } ifelse
   } ifelse
-} bdef
+} bind executeonly def
 
 end readonly put		% GS_PDF_ProcSet
 

Modified: trunk/Master/tlpkg/tlgs/Resource/Init/pdf_rbld.ps
===================================================================
--- trunk/Master/tlpkg/tlgs/Resource/Init/pdf_rbld.ps	2018-09-04 21:40:52 UTC (rev 48581)
+++ trunk/Master/tlpkg/tlgs/Resource/Init/pdf_rbld.ps	2018-09-04 22:33:58 UTC (rev 48582)
@@ -87,7 +87,7 @@
         % Set error flag if we have equal object and generation numbers
     Generations 4 index get 1 index eq { /dup_obj_gen_num //true def } if
   } 8 -1 roll { ifelse } { pop if } ifelse  % Run 'else' only when rebuilding.
-} bind def
+} bind executeonly def
 
 % Print the contents of the xref array.  This actually consists of three
 % arrays (Objects, Generations, and ObjectStream).
@@ -102,7 +102,7 @@
     Objects exch get ===		% print object location
   } for
   flush
-} bind def
+} bind executeonly def
 
 % Get token from string and check its type
 %   <string> <type> typed_token <false>		% no token or not match
@@ -121,7 +121,7 @@
   } {
     pop //false			% no token - pop type, set exit status
   } ifelse			% check if we got token
-} bind def
+} bind executeonly def
 
 % Allocate space for post_eof_count to be bound into procedures below.
 /post_eof_count 0 def
@@ -153,7 +153,7 @@
   } {
     pop 0                 	% no xref, should not happen, report it upstrem
   } ifelse
-} bind def
+} bind executeonly def
 
 
 %% Searches backwards from a specified point looking for a 'trailer' keyword.
@@ -197,7 +197,7 @@
     }if
     pop                                         % renove the zero leaving the new start position
   } loop
-} bind def
+} bind executeonly def
 
 % We want the location of the trailer dictionary at the end of file.
 % We will read the last block of data and search for the final occurance
@@ -223,7 +223,7 @@
   } {
     pop pop 0
   } ifelse
-} bind def
+} bind executeonly def
 
 % We want to find the trailer dictionary.  There is a trailer dictionary
 % for each xref object list.  We only want the trailer dictionary associated
@@ -309,7 +309,7 @@
   /Trailer exch def
   pop
   } ifelse
-} bind def
+} bind executeonly def
 
 % This routine will determine if there is stuff after the %%EOF.  There is
 % supposed to be only a line termination.  However many real life files
@@ -343,7 +343,7 @@
     % Can't even find startxref, assume it's all objects
     pop 0
   } ifelse
-} bind def
+} bind executeonly def
 
 % This routine will scan a file searaching for object locations to build
 % an alternate version of the data in the xref tables.
@@ -422,7 +422,7 @@
     pdfformatwarning
   } if
   currentdict /Orig_Objects undef
-} bind def
+} bind executeonly def
 
 % Print warning message because we found a problem while reading the xref
 % tables
@@ -436,7 +436,7 @@
   (   **** Ghostscript will attempt to recover the data.\n)
   pdfformaterror
   (   **** However, the output may be incorrect.\n) pdfformaterror
-} bind def
+} bind executeonly def
 
 % Attempt to recover the XRef data.  This is called if we have a failure
 % while reading the normal XRef tables.  This routine usually works
@@ -445,4 +445,4 @@
 { print_xref_warning		% Print warning message
   count pdfemptycount sub { pop } repeat % remove anything left by readxref
   search_objects		% Search for objects
-} bind def
+} bind executeonly def

Modified: trunk/Master/tlpkg/tlgs/Resource/Init/pdf_sec.ps
===================================================================
--- trunk/Master/tlpkg/tlgs/Resource/Init/pdf_sec.ps	2018-09-04 21:40:52 UTC (rev 48581)
+++ trunk/Master/tlpkg/tlgs/Resource/Init/pdf_sec.ps	2018-09-04 22:33:58 UTC (rev 48582)
@@ -51,7 +51,7 @@
   1 dict begin
   /Key exch def
   currentdict end /ArcfourDecode filter
-} bind def
+} bind executeonly def
 
 % <ciphertext> <key> arc4decode <plaintext>
 /arc4decode {
@@ -60,7 +60,7 @@
   } {
     1 index length string 3 1 roll arc4decodefilter exch readstring pop
   } ifelse
-} bind def
+} bind executeonly def
 
 % take a stream and aes decrypt it.
 % <stream> <key> aesdecodefilter <stream>
@@ -69,7 +69,7 @@
   /Key exch def
   currentdict end
   /AESDecode filter
-} bind def
+} bind executeonly def
 
 % AES decrypt a string, returning a string.  The second argument can
 % be a dictionary of the form << /Key key /Padding false >>, which
@@ -92,24 +92,24 @@
 
     exch readstring pop
   } ifelse
-} bind def
+} bind executeonly def
 
 /md5 {
   16 string dup /MD5Encode filter dup 4 3 roll writestring closefile
-} bind def
+} bind executeonly def
 
 /md5_trunk {
   md5 0 pdf_key_length getinterval
-} bind def
+} bind executeonly def
 
 /sha256 {
   32 string dup /SHA256Encode filter dup 4 3 roll writestring closefile
-} bind def
+} bind executeonly def
 
 % <string> contains_non_ascii <bool>
 /contains_non_ascii {
   //false exch { 128 ge { pop //true exit } if } forall
-} bind def
+} bind executeonly def
 
 /pdf_padding_string
    <28bf4e5e4e758a41 64004e56fffa0108
@@ -122,7 +122,7 @@
   pdf_padding_string
   0 32 3 index length sub getinterval
   concatstrings
-} bind def
+} bind executeonly def
 
 /pdf_xorbytes {      % <iter-num> <key> pdf_xorbytes <xored-key>
   dup length dup string
@@ -133,7 +133,7 @@
     3 copy put pop pop
   } for
   3 1 roll pop pop
-} bind def
+} bind executeonly def
 
 % Get length of encryption key in bytes
 /pdf_key_length {    % pdf_key_length <key_length>
@@ -142,7 +142,7 @@
   { pop 5 }	% If V == 1 then always use 40 bits
   { /Length knownoget { -3 bitshift } { 5 } ifelse }
   ifelse
-} bind def
+} bind executeonly def
 
 % Algorithm 3.2
 /pdf_compute_encryption_key {  % <password> pdf_compute_encryption_key <key>
@@ -198,7 +198,7 @@
   } ifelse
 
   % Step 9 - Done in md5_trunk.
-} bind def
+} bind executeonly def
 
 % Algorithm 3.4
 /pdf_gen_user_password_R2 { % <filekey> pdf_gen_user_password_R2 <U>
@@ -205,7 +205,7 @@
 
   % Step 2.
   pdf_padding_string exch arc4decode
-} bind def
+} bind executeonly def
 
 % Algorithm 3.5
 /pdf_gen_user_password_R3 { % <filekey> pdf_gen_user_password_R3 <U>
@@ -230,7 +230,7 @@
   } for
   exch pop
 
-} bind def
+} bind executeonly def
 
 /pdf_gen_user_password { % <password> pdf_gen_user_password <filekey> <U>
   % common Step 1 of Algorithms 3.4 and 3.5.
@@ -253,7 +253,7 @@
       } ifelse
     } ifelse
   } ifelse
-} bind def
+} bind executeonly def
 
 % Algorithm 3.6
 % <password> pdf_check_pre_r5_user_password <filekey> true
@@ -268,7 +268,7 @@
   } {
     pop //false
   } ifelse
-} bind def
+} bind executeonly def
 
 % Compute an owner key, ie the result of step 4 of Algorithm 3.3
 /pdf_owner_key % <password> pdf_owner_key <owner-key>
@@ -285,7 +285,7 @@
   } if
 
   % Step 4 - Done in md5_trunk.
-} bind def
+} bind executeonly def
 
 % Algorithm 3.7
 % <password> pdf_check_pre_r5_owner_password <filekey> true
@@ -308,7 +308,7 @@
   % <result-of-step-3>
 
   pdf_check_pre_r5_user_password
-} bind def
+} bind executeonly def
 
 % Algorithm 3.2a
 % <password> pdf_check_r5_password <filekey> true
@@ -377,7 +377,7 @@
   } if
 
   end
-} bind def
+} bind executeonly def
 
 % <password> pdf_check_password <filekey> true
 % <password> pdf_check_password false
@@ -443,7 +443,7 @@
       } ifelse
     } ifelse
   } ifelse
-} bind def
+} bind executeonly def
 
 % Process the encryption information in the Trailer.
 /pdf_process_Encrypt {
@@ -511,7 +511,7 @@
 %      /pdf_process_Encrypt cvx /invalidfileaccess signalerror
 %    }
 %   if
-} bind def
+} bind executeonly def
 
 % Calculate the key used to decrypt an object (to pass to .decpdfrun or
 % put into a stream dictionary).
@@ -554,7 +554,7 @@
       } ifelse
     md5 0 FileKey length 5 add 2 index length .min getinterval
   } ifelse
-} bind def
+} bind executeonly def
 
 % As .pdfrun, but decrypt strings with key <key>.
 /PDFScanRules_true << /PDFScanRules //true >> def
@@ -653,7 +653,7 @@
    /PDFsource PDFsource
     { store { stop } if } aload pop .packtomark cvx
    /PDFsource 3 -1 roll store exec
- } bind def
+ } bind executeonly def
 currentdict /PDFScanRules_true undef
 currentdict /PDFScanRules_null undef
 
@@ -719,7 +719,7 @@
   } {					% Else file is not encrypted
     PDFfile resolveopdict .pdfrun
   } ifelse				% Ifelse encrypted
-} bind def
+} bind executeonly def
 
 % Prefix a decryption filter to a stream if needed.
 % Stack: readdata? dict parms file/string filternames
@@ -745,7 +745,7 @@
       ifelse
       exch
    } if
- } bind def
+ } bind executeonly def
 
 end			% pdfdict
 .setglobal

Modified: trunk/Master/tlpkg/tlgs/bin/gsdll32.dll
===================================================================
(Binary files differ)

Modified: trunk/Master/tlpkg/tlgs/bin/gsdll32.lib
===================================================================
(Binary files differ)

Modified: trunk/Master/tlpkg/tlgs/bin/gswin32.exe
===================================================================
(Binary files differ)

Modified: trunk/Master/tlpkg/tlgs/bin/gswin32c.exe
===================================================================
(Binary files differ)



More information about the tex-live-commits mailing list