diff options
author | Ken Sharp <ken.sharp@artifex.com> | 2022-05-19 14:17:01 +0100 |
---|---|---|
committer | Ken Sharp <ken.sharp@artifex.com> | 2022-05-19 14:23:55 +0100 |
commit | e819bcede71f40b6116934e99df76564cef39228 (patch) | |
tree | 670046f734e1b7ed7e08cd570bb348e3ccd4bd09 /Resource | |
parent | 7ab96e83d85165801894e887816db6042ea2f9be (diff) | |
download | ghostpdl-e819bcede71f40b6116934e99df76564cef39228.tar.gz |
GS + GhostPDF - close the PDF file when complete
The old code relied upon runpdf closing the file supplied to the /run
(redefined PS operator) function instead of closing the file itself.
For compatibility this now does the same with the new PDF interpreter
code. Note that unless PDFSTOPONERROR is true we will execute the PDF
file in a stopped context, so as to allow us to close the file even in
the event of an error.
Diffstat (limited to 'Resource')
-rw-r--r-- | Resource/Init/pdf_main.ps | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/Resource/Init/pdf_main.ps b/Resource/Init/pdf_main.ps index 85ced9ad0..0aa940d29 100644 --- a/Resource/Init/pdf_main.ps +++ b/Resource/Init/pdf_main.ps @@ -1608,7 +1608,26 @@ currentdict /EnablePageHandlerDevice undef /runpdf { % <file> runpdf - /NEWPDF where {/NEWPDF get} {//true} ifelse - {newpdf_runpdf} + { + dup type /filetype eq + { + dup + PDFSTOPONERROR + { + newpdf_runpdf + } + { + {newpdf_runpdf} stopped + { + ( **** Error: PDF interpreter encountered an error processing the file.\n) pdfformaterror + } if + }ifelse + closefile + } + { + ( **** Error: Attempt to process something other than a file object in runpdf.\n) pdfformaterror + } ifelse + } { %% Get the PDF filename (it *must* be a file even if it came from stdin it gets %% copied to a temporary file) and store it in pdfdict. We will use this for |