[Pkg-cups-devel] r483 - cupsys/branches/cups-1.2-ubuntu/debian

Martin Pitt mpitt at alioth.debian.org
Mon Jun 4 17:04:33 UTC 2007


Author: mpitt
Date: Mon Jun  4 17:04:32 2007
New Revision: 483

Log:
* debian/oopstops*, debian/rules: Added Helge Bliscke's
  oopstops filter to work around the bugs in the PostScript output of
  OpenOffice.org (from http://www.srz.de/Members/bla/cups/filter/oopstops).

Added:
   cupsys/branches/cups-1.2-ubuntu/debian/oopstops.convs
   cupsys/branches/cups-1.2-ubuntu/debian/oopstops.pl
   cupsys/branches/cups-1.2-ubuntu/debian/oopstops.types
Modified:
   cupsys/branches/cups-1.2-ubuntu/debian/changelog
   cupsys/branches/cups-1.2-ubuntu/debian/rules

Modified: cupsys/branches/cups-1.2-ubuntu/debian/changelog
==============================================================================
--- cupsys/branches/cups-1.2-ubuntu/debian/changelog	(original)
+++ cupsys/branches/cups-1.2-ubuntu/debian/changelog	Mon Jun  4 17:04:32 2007
@@ -1,3 +1,11 @@
+cupsys (1.2.11-2ubuntu2) gutsy; urgency=low
+
+  * debian/oopstops*, debian/rules: Added Helge Bliscke's
+    oopstops filter to work around the bugs in the PostScript output of
+    OpenOffice.org (from http://www.srz.de/Members/bla/cups/filter/oopstops).
+
+ -- Till Kamppeter <till.kamppeter at gmail.com>  Mon,  4 Jun 2007 11:22:06 +0100
+
 cupsys (1.2.11-2ubuntu1) gutsy; urgency=low
 
   * Merge ipp fix from Debian unstable.

Added: cupsys/branches/cups-1.2-ubuntu/debian/oopstops.convs
==============================================================================
--- (empty file)
+++ cupsys/branches/cups-1.2-ubuntu/debian/oopstops.convs	Mon Jun  4 17:04:32 2007
@@ -0,0 +1 @@
+application/openofficeps application/postscript 33 oopstops

Added: cupsys/branches/cups-1.2-ubuntu/debian/oopstops.pl
==============================================================================
--- (empty file)
+++ cupsys/branches/cups-1.2-ubuntu/debian/oopstops.pl	Mon Jun  4 17:04:32 2007
@@ -0,0 +1,184 @@
+#!/usr/bin/perl -w
+# ===============================================================================
+# oopstops	prefilter to sanitize PostScript jobs generated by OpenOffice 2.x
+# -------------------------------------------------------------------------------
+# 1.00 - 2007-03-17/Bl
+#	First implementation
+#
+#  This program is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU General Public License as published by the
+#  Free Software Foundation; either version 2 of the License, or (at your
+#  option) any later version.
+#
+#  This program is distributed in the hope that it will be useful, but
+#  WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+#  Public License for more details.
+#
+# Description:
+# ------------
+#	OpenOffice as of version 2.x has built-in CUPS support, parses
+#	the user selectable options in the printer's PPD and inserts the respecitve
+#	PostScript code into the PostScript job. However, it does not insert all 
+#	defined defaults nor the JCL settings, but it does honour the JobPatchFile
+#	keyword. In addition, if a default setting in the PPD does not correspond
+#	to one of the choices listed in the respective UI block, OpenOffice silently 
+#	selects the first choice (NOTE: this cannot be corrected by this filter).
+#	Moreover, the page related features are inserted into the page setup section
+#	of the first page. This violates the page independence and prohibits successful
+#	working of job attivutes like number-up or same-up.
+#
+#	We therefore modify the PostScript job as follows:
+#	- any JobPatchFile features are discaarded, as they are re-inserted by the 
+#	  pstops filter.
+#	- the first page's page setup is moved to the end of the general setup section
+#	  (in fact, the respective comments are moved instead).
+
+
+
+use IO::Handle;
+
+#
+# Check the arguments
+#
+die ("ERROR: wrong number of arguments\n") if (scalar @ARGV < 5);
+
+$jobid = $username = $title = $copies = $options = undef;
+$jobid = shift;				# Job ID
+$username = shift;			# Job requesting user name
+$title = shift;				# Job title
+$copies = shift;			# Number of requested copies
+$options = shift;			# Textual representation of job attributes
+$psfile = shift;			# read from file ?
+
+
+#
+# Normalize options string
+#
+$options =~ s/^\s+//;
+$options =~ s/\s+$//;
+$options = ' ' . $options . ' ';
+
+#
+# Check from where to read
+#
+if (defined $psfile)
+{
+	open (FILI, "<$psfile") || die ("ERROR: $psfile: $!\n");
+}
+else
+{
+	open (FILI, "<&STDIN") || die ("ERROR: STDIN: $!\n");
+}
+
+# STDOUT->autoflush (1);
+
+#
+# Parse the input until and including the page setup of the first page
+# and relocate the setup features to the end of the setup section.
+#
+ at feature = ();
+$within_feature = 0;
+$feature_name = '';
+$saw_page = 0;
+ at pagehead = ();
+
+while (<FILI>)
+{
+	if (/^\[\{/)
+	{
+		push (@feature, $_);
+		$_ = <FILI>;
+		if (/^%%BeginFeature:\s+\*(\S+)\s+/)
+		{
+			$feature_name = $1;
+			push (@feature, $_);
+			$within_feature = 1;
+			next;
+		}
+		else
+		{
+			print STDOUT shift @feature;
+			print STDOUT;
+		}
+		next;
+	}
+	if (/^%%EndFeature/)
+	{
+		if ($within_feature)
+		{
+			push (@feature, $_);
+			$_ = <FILI>;
+			if (/^\}\s+stopped\s+cleartomark/)
+			{
+				push (@feature, $_);
+			}
+			else
+			{
+				$next_line = $_;
+			}
+			if ($feature_name eq 'JobPatchFile')
+			{
+				@feature = ();		# discard the job patch file(s)
+			}
+			$within_feature = 0;
+			print STDOUT $next_line if (defined $next_line && $next_line);
+		}
+		else
+		{
+			print STDOUT;
+		}
+		next;
+	}
+	next if (/^%%EndSetup/);
+	if (/^%%Page:/)
+	{
+		$saw_page = 1;
+		push (@pagehead, $_);
+		next;
+	}
+	if (/^%%EndPageSetup/)
+	{
+		push (@pagehead, $_);
+		if (scalar @feature > 0)
+		{
+			while (my $line = shift @feature)
+			{
+				print STDOUT $line;
+			}
+			$feature_name = '';
+		}
+		print STDOUT "%%EndSetup\n";
+		while (my $line = shift @pagehead)
+		{
+			print STDOUT $line;
+		}
+		$saw_page = 0;
+		last;
+	}
+	next if (/^<< \/NumCopies null /);		# skip the copies hack because of Ghostscript quirks
+	if ($within_feature)
+	{
+		push (@feature, $_);
+	}
+	elsif ($saw_page)
+	{
+		push (@pagehead, $_);
+	}
+	else
+	{
+		print STDOUT;
+	}
+}
+
+#
+# Now copy the rest without further interpretation
+#
+while (<FILI>)
+{
+	print STDOUT;
+}
+
+close (FILI) if (defined $psfile);
+
+

Added: cupsys/branches/cups-1.2-ubuntu/debian/oopstops.types
==============================================================================
--- (empty file)
+++ cupsys/branches/cups-1.2-ubuntu/debian/oopstops.types	Mon Jun  4 17:04:32 2007
@@ -0,0 +1 @@
+application/openofficeps string(0,%!) + contains(0,1024,"%%Creator: OpenOffice.org 2.")

Modified: cupsys/branches/cups-1.2-ubuntu/debian/rules
==============================================================================
--- cupsys/branches/cups-1.2-ubuntu/debian/rules	(original)
+++ cupsys/branches/cups-1.2-ubuntu/debian/rules	Mon Jun  4 17:04:32 2007
@@ -40,6 +40,15 @@
 	(cd $(DEB_DESTDIR)/../cupsys/usr/share/doc/cupsys && ln -sf ../../cups/doc-root online-docs)
 	#(cd $(DEB_DESTDIR)/../cupsys/usr/share/man && mv man1/backend.1 man1/cups-backend.1 && mv man1/filter.1 man1/cups-filter.1)
 	(install -m 755 -o root -g root $(DEB_DESTDIR)/../pdftops $(DEB_DESTDIR)/../cupsys/usr/lib/cups/filter/)
+
+	# Helge Blischke's oopstops filter to work around bugs in
+	# OpenOffice.org's PostScript output from
+	# http://www.srz.de/Members/bla/cups/filter/oopstops
+	(install -m 755 -o root -g root $(DEB_DESTDIR)/../oopstops.pl $(DEB_DESTDIR)/../cupsys/usr/lib/cups/filter/oopstops)
+	install -d $(DEB_DESTDIR)/../cupsys/usr/share/cups/mime/
+	(install -m 644 -o root -g root $(DEB_DESTDIR)/../oopstops.types $(DEB_DESTDIR)/../cupsys/usr/share/cups/mime/)
+	(install -m 644 -o root -g root $(DEB_DESTDIR)/../oopstops.convs $(DEB_DESTDIR)/../cupsys/usr/share/cups/mime/)
+
 	install -o root -g root -m 644 debian/cupsys.default debian/cupsys/etc/default/cupsys
 	install -m 755 debian/local/browsing_status debian/local/enable_browsing debian/local/sharing_status debian/local/enable_sharing $(DEB_DESTDIR)/../cupsys/usr/share/cups
 



More information about the Pkg-cups-devel mailing list