title: Can Ghostscript currently convert a PDF to PDF/X?
body: <p>The print house requires my dissertation's PDF to be compliant with PDF/X1a:2001. The content file was compiled using <code>XeTeX LaTeX</code> and the second PDF is the cover design done with <code>Inkscape 0.48</code>.  </p>
  
  <p>The nearest answer I found in this post: <a href="https://stackoverflow.com/a/3483801/1288722">https://stackoverflow.com/a/3483801/1288722</a>, and if I rightly understood, this can be done at least to convert the PDF to PDF/X using <a href="http://svn.ghostscript.com/ghostscript/trunk/gs/doc/Ps2pdf.htm#PDFX" rel="nofollow noreferrer">Ghostscript</a>.</p>
  
  <p>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: <code>ISOcoated_v2_300_eci.icc</code>. I added the <code>.icc</code> file to same folder of the target pdf files (thanks to VadimR for this remark).  </p>
  
  <p><strong>Ghostscript</strong><br>
  I used this script from command line but it didn't work:  </p>
  
  <pre><code>gswin32c -dPDFX -dBATCH -dNOPAUSE -dNOOUTERSAVE -sProcessColorModel=DeviceCMYK -sDEVICE=pdfwrite -sOutputFile=outputfile.pdf PDFX_def.ps doctorate.pdf  
  </code></pre>
  
  <p>I took some time to do 220 pages but it was awful, undesirable effect.  </p>
  
  <p><strong>Contents of the <code>PDFX_def.ps</code>:</strong>    </p>
  
  <pre><code>%!
  % 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} &lt;&lt;/N systemdict /ProcessColorModel get /DeviceGray eq {1} {4} ifelse &gt;&gt; /PUT pdfmark
    [{icc_PDFX} ICCProfile (r) file /PUT pdfmark
  } if
  
  % Define the output intent dictionary :
  
  [/_objdef {OutputIntent_PDFX} /type /dict /OBJ pdfmark
  [{OutputIntent_PDFX} &lt;&lt;
    /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
  &gt;&gt; /PUT pdfmark
  [{Catalog} &lt;&lt;/OutputIntents [ {OutputIntent_PDFX} ]&gt;&gt; /PUT pdfmark
  </code></pre>
  
  <p>So what am I missing?</p>
  
  <p><strong>Notes</strong>  </p>
  
  <ul>
  <li>Windows 7 32bit</li>
  <li>No commercial programs are desired</li>
  </ul>