Ghostscript で PDF/X ファイルを作成する

Ghostscript で PDF/X ファイルを作成するには,-dPDFX オプションを付ければ良いようです.ただし,PDF/X には CMYK じゃないとダメ等の制限があるので,実際には以下のような設定が必要になります.

  • -sDEVICE=pdfwrite を指定する.あるいは,ps2pdf スクリプトを使用しても良い.
  • -dPDFX オプションを付ける.このオプションを付けると PDF バージョンは強制的に 1.3 になる模様.
  • -sProcessColorModel=DeviceGray か -sProcessColorModel=DeviceCMYK を設定する.RGB は不可.
  • バイスに依存しない PDF ファイル?を作成する場合は,-dUseCIEColor オプションを付ける.
  • PDF/X に変換するための定義ファイルを指定する.省略すると gs/lib/PDFX_def.ps が使用される模様.

尚,PDF/A ファイルに関してもほとんど同様の方法(-dPDFX を -dPDFA に変える)で生成する事ができます.

テスト

取りあえず,Ghostscript をインストールすると付いてくるサンプルファイルのうち,colorcir.ps でテストしてみました.

普通の PDF
$ gswin32c.exe -dBATCH -dNOPAUSE -dNOOUTERSAVE -sDEVICE=pdfwrite
-sOutputFile=colorcir.pdf colorcir.ps

生成結果 (PDF)

PDF/X
$ gswin32c.exe -dPDFX -dBATCH -dNOPAUSE -dNOOUTERSAVE -sDEVICE=pdfwrite
-sProcessColorModel=DeviceCMYK -sColorConversionStrategy=CMYK
-sOutputFile=colorcir.pdf colorcir.ps

生成結果 (PDF/X, -sColorConversionStrategy=CMYK オプション付き)

追記 どうやら RGB のファイルを CMYK に変換する場合,-sProcessColorModel=DeviceCMYK オプションだけでは不十分で,-sColorConversionStrategy=CMYK オプションも付ける必要があるようです(参考: linux - Converting PDF to CMYK (with identify recognizing CMYK) - Stack Overflow).

PDF/X (UseCIEColor オプション付)
$ gswin32c.exe -dPDFX -dBATCH -dNOPAUSE -dNOOUTERSAVE -sDEVICE=pdfwrite
-sProcessColorModel=DeviceCMYK -sColorConversionStrategy=CMYK -dUseCIEColor
-sOutputFile=colorcir.pdf colorcir.ps

生成結果 (PDF/X, UseCIEColor オプション付)

カスタマイズ

カスタマイズは,PDFX_def.ps 辺りをベースにこれを修正する事でできるようです(カスタマイズしたら,入力ファイルの直前にそのファイル名を指定する).カスタマイズ項目は,以下のように記述されていました.

As mentioned above, the PDF/X definition file provides special information, which the PDF/X-3 standard requires. You can find a sample file in gs/lib/PDFX_def.ps, and edit it according to your needs. The file follows Postscript syntax and uses the operator pdfmark to pass the special information. For your comfort we marked the lines likely to need editing in the sample file with the comment % Customize. They are explained below.

OutputCondition string
Defines an OutputCondition value for the output intent dictionary. OutputConditionIdentifier string Defines an OutputConditionIdentifier value for the output intent dictionary.
ICCProfile string
May be omited if OutputConditionIdentifier specifies a registed identifier of characterized printing condition see http://www.color.org/IPA_2003-11_PDFX.pdf). Defines a file name of an ICC profile file to be included into the output document. You may specify either an absolute file name, or a relative path from the working directory.
Title string
Defines the document title. Only useful if the source Postscript file doesnt define a title with DSC comments. therwise remove entire line from definition file.
Info string
Defines an Info value for the output intent dictionary.
ps2pdf: PostScript-to-PDF converter

ICC プロファイル辺りは使うかもしれません.