summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2021-07-29 13:09:12 +0100
committerKen Sharp <ken.sharp@artifex.com>2021-07-29 14:07:27 +0100
commiteb2c532c4c0d5ae1d4a030c0ec5edcb4ed8d43ea (patch)
treee040da11df44ec9813e8fc9a3b01560d722c7631 /lib
parent1c8d8394dc22a2108cad7f89ec4f9509f793cde8 (diff)
downloadghostpdl-eb2c532c4c0d5ae1d4a030c0ec5edcb4ed8d43ea.tar.gz
pdfwrite - improve PDFA_def.ps for --permit-file-read
The PDFA_def.ps example program needs to read the ICC profile from disk, in order to embed it in the output PDF file. Since the change to security this means the ICC profile must be specified on the command line with an explicit --permit-file-read. This commit puts the file operation in a stopped context and if it fails puts up some text explaining the possible reasons, including the use of --permit-file-read.
Diffstat (limited to 'lib')
-rw-r--r--lib/PDFA_def.ps40
1 files changed, 26 insertions, 14 deletions
diff --git a/lib/PDFA_def.ps b/lib/PDFA_def.ps
index f77c90ef1..c5e2aa680 100644
--- a/lib/PDFA_def.ps
+++ b/lib/PDFA_def.ps
@@ -35,13 +35,13 @@ def
/CMYK eq {
/N 4 false
}{
- (ColorConversionStrategy not a device space, falling back to ProcessColorModel, output may not be valid PDF/A.)=
+ (\tColorConversionStrategy not a device space, falling back to ProcessColorModel, output may not be valid PDF/A.\n)=
true
} ifelse
} ifelse
} ifelse
} {
- (ColorConversionStrategy not set, falling back to ProcessColorModel, output may not be valid PDF/A.)=
+ (\tColorConversionStrategy not set, falling back to ProcessColorModel, output may not be valid PDF/A.\n)=
true
} ifelse
@@ -56,7 +56,7 @@ def
dup /DeviceCMYK eq {
pop /N 4
} {
- (ProcessColorModel not a device space.)=
+ (\tProcessColorModel not a device space.)=
/ProcessColorModel cvx /rangecheck signalerror
} ifelse
} ifelse
@@ -65,15 +65,27 @@ def
%% ----------8<--------------8<-------------8<--------------8<----------
>> /PUT pdfmark
-[{icc_PDFA} ICCProfile (r) file /PUT pdfmark
+[
+{icc_PDFA}
+{ICCProfile (r) file} stopped
+{
+ (\n\tFailed to open the supplied ICCProfile for reading. This may be due to\n) print
+ (\t an incorrect filename or a failure to add --permif-file-read=<profile>\n) print
+ (\t to the command line. This PostScript program needs to open the file\n) print
+ (\t and you must explicitly grant it permission to do so.\n\n) print
+ (\tPDF/A processing aborted, output may not be a PDF/A file.\n\n) print
+ cleartomark
+}
+{
+ /PUT pdfmark
+ % Define the output intent dictionary :
-% Define the output intent dictionary :
-
-[/_objdef {OutputIntent_PDFA} /type /dict /OBJ pdfmark
-[{OutputIntent_PDFA} <<
- /Type /OutputIntent % Must be so (the standard requires).
- /S /GTS_PDFA1 % Must be so (the standard requires).
- /DestOutputProfile {icc_PDFA} % Must be so (see above).
- /OutputConditionIdentifier (sRGB) % Customize
->> /PUT pdfmark
-[{Catalog} <</OutputIntents [ {OutputIntent_PDFA} ]>> /PUT pdfmark
+ [/_objdef {OutputIntent_PDFA} /type /dict /OBJ pdfmark
+ [{OutputIntent_PDFA} <<
+ /Type /OutputIntent % Must be so (the standard requires).
+ /S /GTS_PDFA1 % Must be so (the standard requires).
+ /DestOutputProfile {icc_PDFA} % Must be so (see above).
+ /OutputConditionIdentifier (sRGB) % Customize
+ >> /PUT pdfmark
+ [{Catalog} <</OutputIntents [ {OutputIntent_PDFA} ]>> /PUT pdfmark
+} ifelse