Blob Blame History Raw
From db24f253409d5d085c2760c814c3e1d3fa2dac59 Mon Sep 17 00:00:00 2001
From: Ray Johnston <ray.johnston@artifex.com>
Date: Tue, 19 Mar 2019 09:25:48 -0700
Subject: 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.

diff --git a/lib/pdf2dsc.ps b/lib/pdf2dsc.ps
index 4547849c2..d836bf320 100644
--- a/lib/pdf2dsc.ps
+++ b/lib/pdf2dsc.ps
@@ -52,10 +52,7 @@ systemdict /.setsafe known { .setsafe } if
 /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 } if
    (%%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 } if
        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