summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlgs/lib/PDFX_def.ps
diff options
context:
space:
mode:
authorReinhard Kotucha <reinhard.kotucha@web.de>2019-10-16 20:19:46 +0000
committerReinhard Kotucha <reinhard.kotucha@web.de>2019-10-16 20:19:46 +0000
commit5495dccfe2922c9db6a88df19c1ae41f9c3f363d (patch)
tree0ec95929b4ae75a0642253c266a77da5a9e3c0c5 /Master/tlpkg/tlgs/lib/PDFX_def.ps
parent147afe376edb627c38fd6f76cb1fcd6d1e444ee9 (diff)
Upgrade gs-9.27 -> gs-9.50
git-svn-id: svn://tug.org/texlive/trunk@52405 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlgs/lib/PDFX_def.ps')
-rw-r--r--Master/tlpkg/tlgs/lib/PDFX_def.ps84
1 files changed, 70 insertions, 14 deletions
diff --git a/Master/tlpkg/tlgs/lib/PDFX_def.ps b/Master/tlpkg/tlgs/lib/PDFX_def.ps
index 4c34d06de08..7dfadce2b06 100644
--- a/Master/tlpkg/tlgs/lib/PDFX_def.ps
+++ b/Master/tlpkg/tlgs/lib/PDFX_def.ps
@@ -1,33 +1,89 @@
%!
% This is a sample prefix file for creating a PDF/X-3 document.
-% Feel free to modify entries marked with "Customize".
+% Users should modify entries marked with "Customize".
+% This assumes an ICC profile resides in the file (ISO Coated sb.icc)
+% in the current directory unless the user modifies the corresponding line below.
-% This assumes an ICC profile to reside in the file (ISO Coated sb.icc),
-% unless the user modifies the corresponding line below.
-
-systemdict /ProcessColorModel known {
- systemdict /ProcessColorModel get dup /DeviceGray ne exch /DeviceCMYK ne and
+% First up, attempt to ensure the user has set ColorConversionStrategy correctly.
+% PDF/X-3 only permits Gray or CMYK in the output.
+%
+systemdict /ColorConversionStrategy known {
+ systemdict /ColorConversionStrategy get cvn dup /Gray ne exch /CMYK ne and
} {
+ (\nERROR: ColorConversionStrategy not set.)=
true
} ifelse
-{ (ERROR: ProcessColorModel must be /DeviceGray or DeviceCMYK.)=
- /ProcessColorModel cvx /rangecheck signalerror
+{ (ERROR: ColorConversionStrategy must be /DeviceGray or /DeviceCMYK.)=
+ /ColorConversionStrategy cvx /rangecheck signalerror
} if
-% Define entries to the document Info dictionary :
-
-/ICCProfile (ISO Coated sb.icc) def % Customize or remove.
+% Define entries in the document Info dictionary :
+%
[ /GTS_PDFXVersion (PDF/X-3:2002) % Must be so (the standard requires).
/Title (Title) % Customize.
/Trapped /False % Must be so (Ghostscript doesn't provide other).
- /DOCINFO pdfmark
+/DOCINFO pdfmark
+
-% Define an ICC profile :
+/ICCProfile (ISO Coated sb.icc) def % Customize or remove.
+% Define an ICC profile in the output, if the user specified one.
+%
currentdict /ICCProfile known {
[/_objdef {icc_PDFX} /type /stream /OBJ pdfmark
- [{icc_PDFX} <</N systemdict /ProcessColorModel get /DeviceGray eq {1} {4} ifelse >> /PUT pdfmark
+
+% This code attempts to set the /N (number of components) key for the ICC colour space.
+% To do this it checks the ColorConversionStrategy or the device ProcessColorModel if
+% ColorConversionStrategy is not set.
+% This is not 100% reliable. A better solution is for the user to edit this and replace
+% the code between the ---8<--- lines with a simple declaration like:
+% /N 3
+% where the value of N is the number of components from the profile defined in /ICCProfile above.
+% Note, if you don't set ColorConversionStrategy, the output will likely be invalid anyway.
+ [{icc_PDFX} <<
+% ----------8<--------------8<-------------8<--------------8<----------
+ systemdict /ColorConversionStrategy known {
+ systemdict /ColorConversionStrategy get cvn dup /Gray eq {
+ pop /N 1 false
+ }{
+ dup /RGB eq {
+ (RGB is not a valid ColorConversionStrategy for PDF/X output)=
+ /ColorConversionStrategycvx /rangecheck signalerror
+ }{
+ /CMYK eq {
+ /N 4 false
+ }{
+ (ColorConversionStrategy not a device space, falling back to ProcessColorModel, output may not be valid PDF/X.)=
+ true
+ } ifelse
+ } ifelse
+ } ifelse
+ } {
+ (ColorConversionStrategy not set, falling back to ProcessColorModel, output may not be valid PDF/X.)=
+ true
+ } ifelse
+
+ {
+ currentpagedevice /ProcessColorModel get
+ dup /DeviceGray eq {
+ pop /N 1
+ }{
+ dup /DeviceRGB eq {
+ (RGB is not a valid ProcessColorModel for PDF/X output)=
+ /ColorConversionStrategycvx /rangecheck signalerror
+ }{
+ dup /DeviceCMYK eq {
+ pop /N 4
+ } {
+ (ProcessColorModel not a device space.)=
+ /ProcessColorModel cvx /rangecheck signalerror
+ } ifelse
+ } ifelse
+ } ifelse
+ } if
+% ----------8<--------------8<-------------8<--------------8<----------
+ >> /PUT pdfmark
[{icc_PDFX} ICCProfile (r) file /PUT pdfmark
} if