[Pkg-cups-devel] r834 - in cupsys/trunk/debian: . filters local
Till Kamppeter
till-guest at alioth.debian.org
Wed Aug 20 19:45:21 UTC 2008
Author: till-guest
Date: Wed Aug 20 19:45:21 2008
New Revision: 834
Log:
Handle DRMed PostScript files from Adobe Reader inside the pstopdf filter.
Removed:
cupsys/trunk/debian/local/adobereader.convs
cupsys/trunk/debian/local/adobereader.types
Modified:
cupsys/trunk/debian/changelog
cupsys/trunk/debian/filters/pstopdf
cupsys/trunk/debian/rules
Modified: cupsys/trunk/debian/changelog
==============================================================================
--- cupsys/trunk/debian/changelog (original)
+++ cupsys/trunk/debian/changelog Wed Aug 20 19:45:21 2008
@@ -24,15 +24,14 @@
debian/local/filters/pdf-filters/removefromcups,
debian/local/filters/pdf-filters/README,
debian/control, debian/rules: Added pdftoijs filter.
- * debian/local/adobereader.types, debian/local/adobereader.convs,
- debian/rules:
- Added rules to handle PostScript files which Adobe Reader
- generates from encrypted PDF files. These PostScript files contain
- PostScript code which stops Ghostscript with an error when one
- tries to convert them back to
- (now unencrypted) PDF. As a temporary workaround (until we get a
- better solution from Adobe) we run these files to the old
- PostScript workflow (pstops filter) now.
+
+ [ Johan Kiviniemi ]
+
+ * debian/filters/pstopdf:
+ - Adobe Reader generates DRM-infested PostScript from encrypted PDF files.
+ This PostScript contains code which stops Ghostscript with an error when
+ one tries to convert it to (now unencrypted) PDF. Change the filter to
+ normalize such PostScript using ps2ps before conversion.
-- Till Kamppeter <tkamppeter at gmail.com> Mon, 18 Aug 2008 13:11:36 +0200
Modified: cupsys/trunk/debian/filters/pstopdf
==============================================================================
--- cupsys/trunk/debian/filters/pstopdf (original)
+++ cupsys/trunk/debian/filters/pstopdf Wed Aug 20 19:45:21 2008
@@ -13,8 +13,11 @@
set -e
+PSTOPS=/usr/bin/ps2ps
PSTOPDF=/usr/bin/ps2pdf13
-OPTIONS="-dAutoRotatePages=/None -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dNOPLATFONTS"
+PSTOPS_OPTIONS="-dAutoRotatePages=/None -dAutoFilterColorImages=false
+ -dNOPLATFONTS -dPARANOIDSAFER -sstdout=%stderr"
+PSTOPDF_OPTIONS="$PSTOPS_OPTIONS -dColorImageFilter=/FlateEncode"
echo "INFO: pstopdf argv[$#] = $@" >&2
@@ -25,13 +28,31 @@
fi
-jobid="$1"
-outfile=$(mktemp "${TMPDIR:-/tmp}/$jobid.pstopdf.out.XXXXXX")
-trap 'rm -f "$outfile"' 0 1 2 13 15
+# Read from given file.
+if [ -n "$6" ]; then
+ exec <"$6"
+fi
+
+tempfiles=
+trap 'rm -f $tempfiles' 0 1 2 13 15
+
+infile=$(mktemp -t pstopdf.XXXXXX)
+tempfiles="$tempfiles $infile"
+
+cat >"$infile"
-infile="${6:--}"
+DRM_MATCH='^%.*Removing the following.*lines is illegal.*Digital Copyright Act'
+if egrep -q "$DRM_MATCH" "$infile"; then
+ # This PS is DRM-infested. Normalize it with ps2ps first.
+ echo "INFO: Normalizing Adobe Reader PostScript with ps2ps" >&2
-$PSTOPDF $OPTIONS "$infile" "$outfile" >&2
+ orig_infile="$infile"
+
+ infile=$(mktemp -t pstopdf.XXXXXX)
+ tempfiles="$tempfiles $infile"
+
+ $PSTOPS $PSTOPS_OPTIONS "$orig_infile" "$infile"
+fi
-cat "$outfile"
+$PSTOPDF $PSTOPDF_OPTIONS -sOUTPUTFILE=%stdout "$infile"
Modified: cupsys/trunk/debian/rules
==============================================================================
--- cupsys/trunk/debian/rules (original)
+++ cupsys/trunk/debian/rules Wed Aug 20 19:45:21 2008
@@ -88,7 +88,7 @@
# Move file detection and conversion rules to /usr/share/cups/mime/ so
# that the package manager does not consider them conffiles
install -d $(DEB_DESTDIR)/../cups/usr/share/cups/mime
- ( cd $(DEB_DESTDIR)/../cups/etc/cups; mv cpdftocps.* imagetopdf.* pdftopdf.* pdftoraster.* pdf.* texttopdf.* adobereader.* $(DEB_DESTDIR)/../cups/usr/share/cups/mime/ )
+ ( cd $(DEB_DESTDIR)/../cups/etc/cups; mv cpdftocps.* imagetopdf.* pdftopdf.* pdftoraster.* pdf.* texttopdf.* $(DEB_DESTDIR)/../cups/usr/share/cups/mime/ )
# Simple Ghostscript-based PostScript-to-PDF filter
install -m 0755 debian/filters/pstopdf $(DEB_DESTDIR)/../cups/usr/lib/cups/filter
More information about the Pkg-cups-devel
mailing list