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.

91 lines
3.0 KiB

1 month ago
  1. %!
  2. % This is a sample prefix file for creating a PDF/A document.
  3. % Users should modify entries marked with "Customize".
  4. % This assumes an ICC profile resides in the file (srgb.icc),
  5. % in the current directory unless the user modifies the corresponding line below.
  6. % Define entries in the document Info dictionary :
  7. [ /Title (Title) % Customise
  8. /DOCINFO pdfmark
  9. % Define an ICC profile :
  10. /ICCProfile (srgb.icc) % Customise
  11. def
  12. [/_objdef {icc_PDFA} /type /stream /OBJ pdfmark
  13. %% This code attempts to set the /N (number of components) key for the ICC colour space.
  14. %% To do this it checks the ColorConversionStrategy or the device ProcessColorModel if
  15. %% ColorConversionStrategy is not set.
  16. %% This is not 100% reliable. A better solution is for the user to edit this and replace
  17. %% the code between the ---8<--- lines with a simple declaration like:
  18. %% /N 3
  19. %% where the value of N is the number of components from the profile defined in /ICCProfile above.
  20. %%
  21. [{icc_PDFA}
  22. <<
  23. %% ----------8<--------------8<-------------8<--------------8<----------
  24. systemdict /ColorConversionStrategy known {
  25. systemdict /ColorConversionStrategy get cvn dup /Gray eq {
  26. pop /N 1 false
  27. }{
  28. dup /RGB eq {
  29. pop /N 3 false
  30. }{
  31. /CMYK eq {
  32. /N 4 false
  33. }{
  34. (\tColorConversionStrategy not a device space, falling back to ProcessColorModel, output may not be valid PDF/A.\n)=
  35. true
  36. } ifelse
  37. } ifelse
  38. } ifelse
  39. } {
  40. (\tColorConversionStrategy not set, falling back to ProcessColorModel, output may not be valid PDF/A.\n)=
  41. true
  42. } ifelse
  43. {
  44. currentpagedevice /ProcessColorModel get
  45. dup /DeviceGray eq {
  46. pop /N 1
  47. }{
  48. dup /DeviceRGB eq {
  49. pop /N 3
  50. }{
  51. dup /DeviceCMYK eq {
  52. pop /N 4
  53. } {
  54. (\tProcessColorModel not a device space.)=
  55. /ProcessColorModel cvx /rangecheck signalerror
  56. } ifelse
  57. } ifelse
  58. } ifelse
  59. } if
  60. %% ----------8<--------------8<-------------8<--------------8<----------
  61. >> /PUT pdfmark
  62. [
  63. {icc_PDFA}
  64. {ICCProfile (r) file} stopped
  65. {
  66. (\n\tFailed to open the supplied ICCProfile for reading. This may be due to\n) print
  67. (\t an incorrect filename or a failure to add --permit-file-read=<profile>\n) print
  68. (\t to the command line. This PostScript program needs to open the file\n) print
  69. (\t and you must explicitly grant it permission to do so.\n\n) print
  70. (\tPDF/A processing aborted, output may not be a PDF/A file.\n\n) print
  71. cleartomark
  72. }
  73. {
  74. /PUT pdfmark
  75. % Define the output intent dictionary :
  76. [/_objdef {OutputIntent_PDFA} /type /dict /OBJ pdfmark
  77. [{OutputIntent_PDFA} <<
  78. /Type /OutputIntent % Must be so (the standard requires).
  79. /S /GTS_PDFA1 % Must be so (the standard requires).
  80. /DestOutputProfile {icc_PDFA} % Must be so (see above).
  81. /OutputConditionIdentifier (sRGB) % Customize
  82. >> /PUT pdfmark
  83. [{Catalog} <</OutputIntents [ {OutputIntent_PDFA} ]>> /PUT pdfmark
  84. } ifelse