Bug 691448 - [Documentation] Sample command for PDF/A generation does not work
Summary: [Documentation] Sample command for PDF/A generation does not work
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Documentation (show other bugs)
Version: 8.71
Hardware: PC Windows XP
: P4 normal
Assignee: Default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-09 17:44 UTC by pipitas
Modified: 2010-07-13 08:26 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pipitas 2010-07-09 17:44:17 UTC
The documentation, file Ps2pdf.htm, gives "a sample command line to invoke Ghostscript for generating a PDF/A document" like this:

gswin32c.exe ^
    -dPDFA ^
    -dBATCH ^
    -dNOPAUSE ^
    -dNOOUTERSAVE ^
    -dUseCIEColor^
    -sDEVICE=pdfwrite ^
    -sOutputFile=tiger.pdf ^
    PDFA_def.ps ^
    c:\gs\examples\tiger.eps

This command does not work for me. I get this error message:

--------------------------------------------------------------------
GPL Ghostscript 8.71 (2010-02-10)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
ERROR: ProcessColorModel must be /DeviceGray or DeviceCMYK.
Error: /rangecheck in ProcessColorModel
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--  --nostringval--
   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--  
   false 1   %stopped_push   1878   1   3   %oparray_pop   1877   1   3   
   %oparray_pop   1861   1   3   %oparray_pop   1755   1   3   %oparray_pop  
   --nostringval--   %errorexec_pop   .runexec2   --nostringval--  
   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:1159/1684(ro)(G)--   --dict:0/20(G)--   --dict:70/200(L)--
Current allocation mode is local
Current file position is 563
GPL Ghostscript 8.71: Unrecoverable error, exit code 1
--------------------------------------------------------------------

OK, I change the ProcessColorModel according to the hint in the message and try this:

gswin32c.exe ^
    -dPDFA ^
    -dBATCH ^
    -dNOPAUSE ^
    -dNOOUTERSAVE ^
    -dProcessColorModel=/DeviceCMYK ^
    -sDEVICE=pdfwrite ^
    -sOutputFile=tiger.pdf ^
    c:\gs\examples\tiger.eps

But this also doesn't work. It gives this error:

--------------------------------------------------------------------
GPL Ghostscript 8.71 (2010-02-10)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Error: /undefinedfilename in --file--
Operand stack:
   --nostringval--   --nostringval--   (ISO Coated sb.icc)   (r)
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--  --nostringval--
   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   
   false 1   %stopped_push   1878   1   3   %oparray_pop   1877   1   3   
   %oparray_pop   1861   1   3   %oparray_pop   1755   1   3   %oparray_pop   
   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   
   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:1159/1684(ro)(G)--   --dict:0/20(G)--   --dict:71/200(L)--
Current allocation mode is local
Last OS error: No such file or directory
Current file position is 940
GPL Ghostscript 8.71: Unrecoverable error, exit code 1
--------------------------------------------------------------------

This time I do not see an obvious way to modify my command (I do not comprehend the error message, but I assume it is in the Operant stack, not the other two stacks....)

So my next attempt is this (skipping the "PDFA_def.ps" from the commandline):

gswin32c.exe ^
    -dPDFA ^
    -dBATCH ^
    -dNOPAUSE ^
    -dNOOUTERSAVE ^
    -dProcessColorModel=/DeviceCMYK ^
    -sDEVICE=pdfwrite ^
    -sOutputFile=tiger.pdf ^
    c:\gs\examples\tiger.eps

This one works. I want to see, if it makes a difference to give the absolute path to the "PDFA_def.ps". Therefor I try this:

gswin32c.exe ^
    -dPDFA ^
    -dBATCH ^
    -dNOPAUSE ^
    -dNOOUTERSAVE ^
    -dProcessColorModel=/DeviceCMYK ^
    -sDEVICE=pdfwrite ^
    -sOutputFile=tiger.pdf ^
    c:\gs\lib\PDFA_def.ps ^
    c:\gs\examples\tiger.eps

Same problem as above ("Error: /undefinedfilename in --file--"). So maybe it does not like the "/ICCProfile (ISO Coated sb.icc) def" part in PDFA_def.ps.

I replace it with "/ICCProfile (default_cmyk.icc) def", since such an .icc file indeed is available in the "iccprofiles" subdirectory (I couldn't find one called "ISO Coated sb.icc"). Still no success...

Only after putting an absolute, full path into the definition I really get an PDF created: "/ICCProfile (C:\\gs\\iccprofiles\\default_cmyk.icc) def"

[I did not check if the result passes PDF/A verification by tools such as the one from Callas Software. But I will check as soon as I have access to such a tool.]
Comment 1 Ken Sharp 2010-07-09 18:16:04 UTC
(In reply to comment #0)

> OK, I change the ProcessColorModel according to the hint in the message and try
> this:
> 
> gswin32c.exe ^
>     -dPDFA ^
>     -dBATCH ^
>     -dNOPAUSE ^
>     -dNOOUTERSAVE ^
>     -dProcessColorModel=/DeviceCMYK ^
>     -sDEVICE=pdfwrite ^
>     -sOutputFile=tiger.pdf ^
>     c:\gs\examples\tiger.eps
> 
> But this also doesn't work. It gives this error:
> 
> --------------------------------------------------------------------
> GPL Ghostscript 8.71 (2010-02-10)
> Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
> This software comes with NO WARRANTY: see the file PUBLIC for details.
> Error: /undefinedfilename in --file--
> Operand stack:
>    --nostringval--   --nostringval--   (ISO Coated sb.icc)   (r)

You *must* modify the PDFA_def file, it is not 'complete' as it stand, and cannot be made so. In particular you must specify the ICC profile to be used as the OutputIntent in the destination PDF/A file. The example PDFA_def.ps file includes (ISO Coated sb.icc) but this is just a place holder. You need to put a fully qualified path to your chosen ICC profile in here.

The undefinedfilename error is telling you that it can't find the file (ISO Coated sb.icc)

You should also review the other options in the file and alter them as appropriate.


> So my next attempt is this (skipping the "PDFA_def.ps" from the commandline):

That will produce a PDF file marked as PDF/A, but missing required information, so it won't be a valid PDF/A file.

> I replace it with "/ICCProfile (default_cmyk.icc) def", since such an .icc file
> indeed is available in the "iccprofiles" subdirectory (I couldn't find one
> called "ISO Coated sb.icc"). Still no success...
> 
> Only after putting an absolute, full path into the definition I really get an
> PDF created: "/ICCProfile (C:\\gs\\iccprofiles\\default_cmyk.icc) def"
> 
> [I did not check if the result passes PDF/A verification by tools such as the
> one from Callas Software. But I will check as soon as I have access to such a
> tool.]

It should be OK. We do have customers using this facility, so I believe it works.
Comment 2 pipitas 2010-07-10 12:26:51 UTC
Thank you for providing the clues. This should be expressed in the documentation ("Ps2pdf.htm") just as forcefully is it is in comment #1. 

Especially the "need to put a fully qualified path to your chosen ICC profile in here" part is missing from the docu right now.
Comment 3 Ken Sharp 2010-07-13 08:26:53 UTC
(In reply to comment #2)

> Thank you for providing the clues. This should be expressed in the
> documentation ("Ps2pdf.htm") just as forcefully is it is in comment #1. 

Much of it is, though it is contained in the PDF/X-3 documentation and referred back to from the PDF/A docs.
 

> Especially the "need to put a fully qualified path to your chosen ICC profile
> in here" part is missing from the docu right now.

This was probably less confusing previously, as we didn't ship with an iccprofiles directory.

I've modified the PDF/A documentation, and some of the PDF/X documentation to make this clearer, including emphasising the need for a ProcessColorModel even when using -dUseCIEColor, as this has come up before.

Changes made in r11506, patch here:
http://ghostscript.com/pipermail/gs-cvs/2010-July/011390.html