diff options
-rw-r--r-- | Resource/Init/pdf_main.ps | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/Resource/Init/pdf_main.ps b/Resource/Init/pdf_main.ps index 6c1990d4b..5a5007391 100644 --- a/Resource/Init/pdf_main.ps +++ b/Resource/Init/pdf_main.ps @@ -278,6 +278,16 @@ systemdict begin } bind odef currentdict /runpdfstring .undef +/DisablePageHandlerDevice +{ + systemdict /FirstPage known + systemdict /LastPage known or + systemdict /Pagelist known or + { + <</DisablePageHandler //true>> setpagedevice + } if +} bind def + /runpdfbegin { % <file> runpdfbegin - userdict begin % It turns out that the PDF interpreter uses memory more @@ -300,6 +310,8 @@ currentdict /runpdfstring .undef %% resources and needs this definition in place. <</MaxOpStack -1>> setuserparams + //DisablePageHandlerDevice exec + 0 setobjectformat /Page# //null def /Page //null def @@ -311,8 +323,9 @@ currentdict /runpdfstring .undef /CumulativePageCount currentpagedevice /PageCount get def } bind executeonly def +currentdict /DisablePageHandlerDevice undef + /runpdfpagerange { % - runpdfpagerange <firstpage#> <lastpage#> - <</DisablePageHandler //true>> setpagedevice /PortfolioPage where { pop PortfolioPage cvi dup pdfpagecount add % a b+1 @@ -321,8 +334,8 @@ currentdict /runpdfstring .undef dup 3 index exch cvs pop % a b+1 /P (b+1) store 1 sub % a b - /FirstPage where { pop FirstPage <</DisablePageHandler //true>> setpagedevice} { 1 } ifelse - /LastPage where { pop LastPage <</DisablePageHandler //true>> setpagedevice} {2000000000} ifelse % a b fp lp + /FirstPage where { pop FirstPage} { 1 } ifelse + /LastPage where { pop LastPage} {2000000000} ifelse % a b fp lp 2 index 2 index lt { % b < fp 1e10 } { @@ -395,7 +408,6 @@ currentdict /runpdfstring .undef pop } forall - <</DisablePageHandler //true>> setpagedevice /PDFPageList pdfpagecount 1 add array def { (,) search { @@ -477,7 +489,6 @@ currentdict /runpdfstring .undef 1 pdfpagecount }{ /FirstPage where { - <</DisablePageHandler //true>> setpagedevice pop FirstPage dup pdfpagecount gt { (\nRequested FirstPage is greater than the number of pages in the file: ) print pdfpagecount = flush @@ -485,7 +496,7 @@ currentdict /runpdfstring .undef } { 1 } ifelse - /LastPage where {<</DisablePageHandler //true>> setpagedevice pop LastPage pdfpagecount .min } { pdfpagecount } ifelse + /LastPage where {pop LastPage pdfpagecount .min } { pdfpagecount } ifelse 1 index 1 index gt { ( No pages will be processed \(FirstPage > LastPage\).) = flush } { @@ -496,7 +507,6 @@ currentdict /runpdfstring .undef } ifelse } ifelse }ifelse - <</DisablePageHandler //false>> setpagedevice } bind executeonly def /dopdfpages { % firstpage# lastpage# dopdfpages - @@ -544,6 +554,7 @@ currentdict /runpdfstring .undef PDFTopSave restore end % userdict 2 vmreclaim % couldn't hurt + <</DisablePageHandler //false>> setpagedevice } bind executeonly def % Copy stream to an external temporary file and |