Bug 692822 - Provide ps2pdfa
Summary: Provide ps2pdfa
Status: RESOLVED WONTFIX
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: General (show other bugs)
Version: 9.04
Hardware: PC Linux
: P4 enhancement
Assignee: Default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-29 14:16 UTC by Liam Morland
Modified: 2012-01-31 07:57 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments
ps2pdfa script (432 bytes, application/octet-stream)
2012-01-29 14:16 UTC, Liam Morland
Details
ps2pdfwr patch (809 bytes, patch)
2012-01-29 14:17 UTC, Liam Morland
Details | Diff
PDFA_def file for grey (1.39 KB, application/postscript)
2012-01-29 14:18 UTC, Liam Morland
Details
PDFA_def file for CMYK (1.39 KB, application/postscript)
2012-01-29 14:18 UTC, Liam Morland
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Liam Morland 2012-01-29 14:16:20 UTC
Created attachment 8309 [details]
ps2pdfa script

Along with the other ps2pdf* scripts, it would be very helpful to have a script to create PDF/A. Attached is an attempt at creating such a script following the instructions in:
/usr/share/doc/ghostscript/Ps2pdf.htm#PDFA

Attachments:

1. ps2pdfa script, modelled on the others.

2. A patch file that makes minor changes to ps2pdfwr to allow ps2pdfa to provide an additional input file. It needs this in order to provide a PDFA_def file.

3. Two PDFA_def files: one for each of DeviceGrey and DeviceCMYK, based on /usr/share/ghostscript/9.04/lib/PDFA_def.ps. The only difference is that the /ICCProfile is set to one of /usr/share/ghostscript/9.04/iccprofiles/default_(grey|cmyk).icc

I have not done much sh programming, so there may be improvements that can be made.

It works, except for an error message which seems to be related to file permissions, but I can't figure out what is wrong. It works if I comment out the line in the PDFA_def file:

[{icc_PDFA} ICCProfile (r) file /PUT pdfmark

But with that line gone, I presume that it doesn't create a valid PDF/A document.

Besides fixing this issue, there is one other todo. The title is supposed to be set in the PDFA_def file. I think doing this is beyond what I am comfortable doing in sh. Should I generate a tmpfile containing a customized PDFA_def with the title?

I would appreciate your assistance with this.

Thank you,
Liam Morland

Debian bug report:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=657817

Package: ghostscript
Version: 9.04~dfsg-3
Severity: wishlist
Tags: patch

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 3.1.0-1-686-pae (SMP w/1 CPU core)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_CA.UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages ghostscript depends on:
ii  debconf [debconf-2.0]  1.5.41
ii  debianutils            4.1
ii  gsfonts                1:8.11+urwcyr1.0.7~pre44-4.2
ii  libc6                  2.13-24
ii  libgs9                 9.04~dfsg-3

ghostscript recommends no packages.

Versions of packages ghostscript suggests:
pn  ghostscript-cups  9.04~dfsg-3
pn  ghostscript-x     9.04~dfsg-3
pn  hpijs             <none>

-- no debconf information
Comment 1 Liam Morland 2012-01-29 14:17:34 UTC
Created attachment 8310 [details]
ps2pdfwr patch
Comment 2 Liam Morland 2012-01-29 14:18:08 UTC
Created attachment 8311 [details]
PDFA_def file for grey
Comment 3 Liam Morland 2012-01-29 14:18:29 UTC
Created attachment 8312 [details]
PDFA_def file for CMYK
Comment 4 Ken Sharp 2012-01-29 15:34:24 UTC
I think that the required input for PDF/A output is really too complex t make into a script that we will support.

The scripts are intended to allow *simple* tasks to be performed without recourse to the Ghostscript command line, this is not a simple task as evidenced by the fact that your modified shell script requires an additional input file.

A more minor point; ps2pdfwr doesn't exist on non-Unix platforms, and shell scripts don't work on those platforms either.

You are correct that removing the /PUT pdfmark means that the file won't be a valid PDF/A file. The default device space profiles supplied with Ghostscript are definitely *not* acceptable ICC profiles to use as the output profile in a PDF/A file. You haven't quoted the error message, so its difficult to be certain of the problem you are experiencing, but I would imagine that its more likely to be file existence than file permissions. The line you wuote:

[{icc_PDFA} ICCProfile (r) file /PUT pdfmark

doesn't have a fully qualified path to the ICC profile 'icc_pdfa'.
Comment 5 Liam Morland 2012-01-30 01:03:27 UTC
Thanks for the explanation.

Would be willing to just apply the patch to ps2pdfwr? The would permit me and others much more flexibility in creating our own scripts.
Comment 6 Ken Sharp 2012-01-30 08:00:10 UTC
(In reply to comment #5)

> Would be willing to just apply the patch to ps2pdfwr? The would permit me and
> others much more flexibility in creating our own scripts.

I'll put it up to the other developers on Tuesday but personally I'm not in favour. It complicates the script without adding anything significant in the way of functionality.

You are obviously comfortable writing shell scripts, why not just stick with writing your own instead of using our own limited ones ?
Comment 7 Liam Morland 2012-01-31 01:56:09 UTC
Thanks. I was hoping for something simple and to have to write as little as possible. I had wanted to use PDF/A for a long time, but I didn't know how. I expect there are many others not familiar with shell scripting who would use a simple PDF/A converter if it existed.
Comment 8 Ken Sharp 2012-01-31 07:57:58 UTC
(In reply to comment #7)
> Thanks. I was hoping for something simple and to have to write as little as
> possible. I had wanted to use PDF/A for a long time, but I didn't know how. I
> expect there are many others not familiar with shell scripting who would use a
> simple PDF/A converter if it existed.

The problem is that it isn't possible to write a simple PDF/A conversion because there are many decisions that need to be taken. 

Naturally you don't need a shell script, you can do it all from teh Ghostscript command line, the procedure is documented in :

/ghostpdl/gs/doc/Ps2pdf.htm#PDFA

which also includes an example command line.