You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
3.8 KiB

1 month ago
  1. %!
  2. % This is a sample prefix file for creating a PDF/X-3 document.
  3. % Users should modify entries marked with "Customize".
  4. % This assumes an ICC profile resides in the file (ISO Coated sb.icc)
  5. % in the current directory unless the user modifies the corresponding line below.
  6. % First up, attempt to ensure the user has set ColorConversionStrategy correctly.
  7. % PDF/X-3 only permits Gray or CMYK in the output.
  8. %
  9. systemdict /ColorConversionStrategy known {
  10. systemdict /ColorConversionStrategy get cvn dup /Gray ne exch /CMYK ne and
  11. } {
  12. (\nERROR: ColorConversionStrategy not set.)=
  13. true
  14. } ifelse
  15. { (ERROR: ColorConversionStrategy must be /DeviceGray or /DeviceCMYK.)=
  16. /ColorConversionStrategy cvx /rangecheck signalerror
  17. } if
  18. % Define entries in the document Info dictionary :
  19. %
  20. [ /GTS_PDFXVersion (PDF/X-3:2002) % Must be so (the standard requires).
  21. /Title (Title) % Customize.
  22. /Trapped /False % Must be so (Ghostscript doesn't provide other).
  23. /DOCINFO pdfmark
  24. /ICCProfile (ISO Coated sb.icc) def % Customize or remove.
  25. % Define an ICC profile in the output, if the user specified one.
  26. %
  27. currentdict /ICCProfile known {
  28. [/_objdef {icc_PDFX} /type /stream /OBJ pdfmark
  29. % This code attempts to set the /N (number of components) key for the ICC colour space.
  30. % To do this it checks the ColorConversionStrategy or the device ProcessColorModel if
  31. % ColorConversionStrategy is not set.
  32. % This is not 100% reliable. A better solution is for the user to edit this and replace
  33. % the code between the ---8<--- lines with a simple declaration like:
  34. % /N 3
  35. % where the value of N is the number of components from the profile defined in /ICCProfile above.
  36. % Note, if you don't set ColorConversionStrategy, the output will likely be invalid anyway.
  37. [{icc_PDFX} <<
  38. % ----------8<--------------8<-------------8<--------------8<----------
  39. systemdict /ColorConversionStrategy known {
  40. systemdict /ColorConversionStrategy get cvn dup /Gray eq {
  41. pop /N 1 false
  42. }{
  43. dup /RGB eq {
  44. (RGB is not a valid ColorConversionStrategy for PDF/X output)=
  45. /ColorConversionStrategycvx /rangecheck signalerror
  46. }{
  47. /CMYK eq {
  48. /N 4 false
  49. }{
  50. (ColorConversionStrategy not a device space, falling back to ProcessColorModel, output may not be valid PDF/X.)=
  51. true
  52. } ifelse
  53. } ifelse
  54. } ifelse
  55. } {
  56. (ColorConversionStrategy not set, falling back to ProcessColorModel, output may not be valid PDF/X.)=
  57. true
  58. } ifelse
  59. {
  60. currentpagedevice /ProcessColorModel get
  61. dup /DeviceGray eq {
  62. pop /N 1
  63. }{
  64. dup /DeviceRGB eq {
  65. (RGB is not a valid ProcessColorModel for PDF/X output)=
  66. /ColorConversionStrategycvx /rangecheck signalerror
  67. }{
  68. dup /DeviceCMYK eq {
  69. pop /N 4
  70. } {
  71. (ProcessColorModel not a device space.)=
  72. /ProcessColorModel cvx /rangecheck signalerror
  73. } ifelse
  74. } ifelse
  75. } ifelse
  76. } if
  77. % ----------8<--------------8<-------------8<--------------8<----------
  78. >> /PUT pdfmark
  79. [{icc_PDFX} ICCProfile (r) file /PUT pdfmark
  80. } if
  81. % Define the output intent dictionary :
  82. [/_objdef {OutputIntent_PDFX} /type /dict /OBJ pdfmark
  83. [{OutputIntent_PDFX} <<
  84. /Type /OutputIntent % Must be so (the standard requires).
  85. /S /GTS_PDFX % Must be so (the standard requires).
  86. /OutputCondition (Commercial and specialty printing) % Customize
  87. /Info (none) % Customize
  88. /OutputConditionIdentifier (CGATS TR001) % Customize
  89. /RegistryName (http://www.color.org) % Must be so (the standard requires).
  90. currentdict /ICCProfile known {
  91. /DestOutputProfile {icc_PDFX} % Must be so (see above).
  92. } if
  93. >> /PUT pdfmark
  94. [{Catalog} <</OutputIntents [ {OutputIntent_PDFX} ]>> /PUT pdfmark