Can Ghostscript currently convert a PDF to PDF/X?

2020-03-27 10:54发布

问题:

The print house requires my dissertation's PDF to be compliant with PDF/X1a:2001. The content file was compiled using XeTeX LaTeX and the second PDF is the cover design done with Inkscape 0.48.

The nearest answer I found in this post: https://stackoverflow.com/a/3483801/1288722, and if I rightly understood, this can be done at least to convert the PDF to PDF/X using Ghostscript.

As stated in the answer above, conversion to PDF/X requires a valid ICC profile. I contacted the printing house and they provided a file of their preferred one which is: ISOcoated_v2_300_eci.icc. I added the .icc file to same folder of the target pdf files (thanks to VadimR for this remark).

Ghostscript
I used this script from command line but it didn't work:

gswin32c -dPDFX -dBATCH -dNOPAUSE -dNOOUTERSAVE -sProcessColorModel=DeviceCMYK -sDEVICE=pdfwrite -sOutputFile=outputfile.pdf PDFX_def.ps doctorate.pdf  

I took some time to do 220 pages but it was awful, undesirable effect.

Contents of the PDFX_def.ps:

%!
% This is a sample prefix file for creating a PDF/X-3 document.
% Feel free to modify entries marked with "Customize".

% 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
} {
  true
} ifelse
{ (ERROR: ProcessColorModel must be /DeviceGray or DeviceCMYK.)=
  /ProcessColorModel cvx /rangecheck signalerror
} if

% Define entries to the document Info dictionary :

/ICCProfile (ISOcoated_v2_300_eci.icc) def  % Customize or remove.
%/ICCProfile (ISO Coated sb.icc) def  % Customize or remove.

[ /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

% Define an ICC profile :

currentdict /ICCProfile known {
  [/_objdef {icc_PDFX} /type /stream /OBJ pdfmark
  [{icc_PDFX} <</N systemdict /ProcessColorModel get /DeviceGray eq {1} {4} ifelse >> /PUT pdfmark
  [{icc_PDFX} ICCProfile (r) file /PUT pdfmark
} if

% Define the output intent dictionary :

[/_objdef {OutputIntent_PDFX} /type /dict /OBJ pdfmark
[{OutputIntent_PDFX} <<
  /Type /OutputIntent              % Must be so (the standard requires).
  /S /GTS_PDFX                     % Must be so (the standard requires).
  /OutputCondition (Commercial and specialty printing) % Customize
  /Info (none)                     % Customize
  /OutputConditionIdentifier (CGATS TR001)      % Customize
  /RegistryName (http://www.color.org)   % Must be so (the standard requires).
  currentdict /ICCProfile known {
    /DestOutputProfile {icc_PDFX}  % Must be so (see above).
  } if
>> /PUT pdfmark
[{Catalog} <</OutputIntents [ {OutputIntent_PDFX} ]>> /PUT pdfmark

So what am I missing?

Notes

  • Windows 7 32bit
  • No commercial programs are desired

回答1:

You can produce PDF/X files, but not PDF/X1 As I recall PDF/X-1 requires all colours to be specified in CMYK or Gray and older versions of pdfwrite couldn't do that, the current version can, but needs some other work to make it compatible with PDF/X-1, I'm not certain its worth the effort.

See this bug report