Blob Blame History Raw
From: Ray Johnston <ray.johnston@artifex.com>
Date: Tue, 19 Mar 2019 16:25:48 +0000 (-0700)
Subject: Fix lib/pdf2dsc.ps to use documented Ghostscript pdf procedures.

Fix lib/pdf2dsc.ps to use documented Ghostscript pdf procedures.

We eliminated GS_PDF_ProcSet and pdfdict, but runpdfbegin, dopdfpages,
and runpdfend are still available.

https://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=db24f253409d5d085c2760c814c3e1d3fa2dac59
---

diff -up ghostscript-9.07/lib/pdf2dsc.ps.pdf2dsc-fix ghostscript-9.07/lib/pdf2dsc.ps
--- ghostscript-9.07/lib/pdf2dsc.ps.pdf2dsc-fix	2013-02-14 08:58:16.000000000 +0100
+++ ghostscript-9.07/lib/pdf2dsc.ps	2019-03-21 15:57:27.006345954 +0100
@@ -52,10 +52,7 @@ systemdict /.setsafe known { .setsafe }
 /DSCstring 255 string def
 /MediaTypes 10 dict def
 
-   GS_PDF_ProcSet begin
-   pdfdict begin
-   PDFfile
-   pdfopen begin
+   PDFfile runpdfbegin
    /FirstPage where { pop } { /FirstPage 1 def } ifelse
    /LastPage where { pop } { /LastPage pdfpagecount def } ifelse
 
@@ -108,13 +105,12 @@ systemdict /.setsafe known { .setsafe }
    (%%BeginProlog\n) puts
    (/Page null def\n/Page# 0 def\n/PDFSave null def\n) puts
    (/DSCPageCount 0 def\n) puts
-   (/DoPDFPage {dup /Page# exch store pdfgetpage pdfshowpage } def\n) puts
-   (GS_PDF_ProcSet begin\npdfdict begin\n) puts
+   (/DoPDFPage {dup /Page# exch store dup dopdfpages } def\n) puts
    (%%EndProlog\n) puts
    (%%BeginSetup\n) puts
    DSCfile PDFname write==only
    ( \(r\) file { DELAYSAFER { .setsafe } if } stopped pop\n) puts
-   ( pdfopen begin\n) puts
+   ( runpdfbegin\n) puts
    ( process_trailer_attrs\n) puts
    (%%EndSetup\n) puts
 
@@ -239,13 +235,10 @@ systemdict /.setsafe known { .setsafe }
        DSCfile exch DSCstring cvs writestring
        ( DoPDFPage\n) puts
     } for
-   currentdict pdfclose
-   end
-   end
-   end
+    runpdfend
 % write trailer
 (%%Trailer\n) puts
-(currentdict pdfclose\nend\nend\nend\n) puts
+(runpdfend\n) puts
 (%%EOF\n) puts
 % close output file and exit
 DSCfile closefile