diff options
author | Ken Sharp <ken.sharp@artifex.com> | 2022-05-12 12:10:10 +0100 |
---|---|---|
committer | Ken Sharp <ken.sharp@artifex.com> | 2022-05-12 12:11:35 +0100 |
commit | dbdc191b257bc6e8cc6e3f4133eae543e397e5aa (patch) | |
tree | 8ee569726688ba3c49fae12016ad84177d97a0aa /Resource | |
parent | 13b8d48aeeea2e8eb99e43af6d26e888f72a1e1d (diff) | |
download | ghostpdl-dbdc191b257bc6e8cc6e3f4133eae543e397e5aa.tar.gz |
Fix GhostPDF integration with GS - Use of /Page#
We added /Page# to the dictionary returned from pdfgetpage in order to
get pdf2dsc.ps to work (it relies upon that key being present) and
potentially other PostScript programs as well. The key was added to
the dictionary in pdfdopages.
However, after adding it, we then proceeded to assume it would always be
present, even if we called pdfpage and friends directly, rather than
using pdfdopages.
Fix that assumption here by adding the key to the dictionary in
pdfgetpage instead of pdfdopages. There's no way (using the old
PostScript code) to use any of the other functions without using
pdfgetpage first.
Diffstat (limited to 'Resource')
-rw-r--r-- | Resource/Init/pdf_main.ps | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Resource/Init/pdf_main.ps b/Resource/Init/pdf_main.ps index c12fc3693..bb62bcc37 100644 --- a/Resource/Init/pdf_main.ps +++ b/Resource/Init/pdf_main.ps @@ -1026,13 +1026,17 @@ currentdict /PDFSwitches undef /newpdf_pdfgetpage { - PDFFile exch 1 sub {.PDFPageInfo} stopped + dup 1 sub + PDFFile exch {.PDFPageInfo} stopped { pop pop ( **** Error: Couldn't get page info.\n) newpdf_pdfformaterror ( Output may be incorrect.\n) newpdf_pdfformaterror //null - } if + }{ + dup 3 -1 roll + /Page# exch put + } ifelse } bind def /newpdf_process_trailer_attrs @@ -1135,10 +1139,8 @@ currentdict /PDFSwitches undef {//true} ifelse { - dup pdfgetpage + pdfgetpage dup //null ne { - exch 1 index - /Page# 3 -1 roll put pdfshowpage } { PDFSTOPONERROR { |