[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#657817: ghostscript: Provide ps2pdfa



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

Dear Maintainer,

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.

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 don't think it creates 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 or your referral to a 
better forum to present this feature request.

Thank you,
Liam Morland

-- 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
#!/bin/sh
# $Id$
# Convert PostScript to PDF/A.
ps2pdfwr="`dirname \"$0\"`/ps2pdfwr"
if test ! -x "$ps2pdfwr"; then
	ps2pdfwr="ps2pdfwr"
fi

# Command line switch to select grey output
if [ $# -gt 0 ] && [ `expr $1 : -grey` -eq 5 ]; then
	color="Grey"
	shift
else
	color="CMYK"
fi

exec "$ps2pdfwr" -dPDFA -dNOOUTERSAVE -sProcessColorModel=Device$color -in=PDFA_def-$color.ps "$@"
# @todo: Title should be set in the PDFA_def file.
diff -u a/ps2pdfwr b/ps2pdfwr
--- a/ps2pdfwr	2012-01-28 22:43:23.000000000 -0500
+++ b/ps2pdfwr	2012-01-28 22:46:54.000000000 -0500
@@ -12,9 +12,11 @@
 GS_EXECUTABLE="$gs"
 
 OPTIONS="-P- -dSAFER"
+pre_infile=""
 while true
 do
 	case "$1" in
+	-in=*) pre_infile="$pre_infile `expr substr "$1" 5 9999`";;
 	-?*) OPTIONS="$OPTIONS $1" ;;
 	*)  break ;;
 	esac
@@ -42,4 +44,4 @@
 
 # We have to include the options twice because -I only takes effect if it
 # appears before other options.
-exec "$GS_EXECUTABLE" $OPTIONS -q -P- -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sstdout=%stderr "-sOutputFile=$outfile" $OPTIONS -c .setpdfwrite -f "$infile"
+exec "$GS_EXECUTABLE" $OPTIONS -q -P- -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sstdout=%stderr "-sOutputFile=$outfile" $OPTIONS -c .setpdfwrite -f "$pre_infile" "$infile"

Attachment: PDFA_def-CMYK.ps
Description: PostScript document

Attachment: PDFA_def-Grey.ps
Description: PostScript document


Reply to: