diff options
author | Heinrich Wendel <lanius@gentoo.org> | 2005-06-07 09:59:59 +0000 |
---|---|---|
committer | Heinrich Wendel <lanius@gentoo.org> | 2005-06-07 09:59:59 +0000 |
commit | cfbee7ca91a6d4ba392aa337bec77f41c2160629 (patch) | |
tree | 0d2d2243730e2232e3a0caeb023e2a3da1c5f4fb /net-print | |
parent | version bump (diff) | |
download | gentoo-2-cfbee7ca91a6d4ba392aa337bec77f41c2160629.tar.gz gentoo-2-cfbee7ca91a6d4ba392aa337bec77f41c2160629.tar.bz2 gentoo-2-cfbee7ca91a6d4ba392aa337bec77f41c2160629.zip |
add pdftops to files, bug #93871
(Portage version: 2.0.51.19)
Diffstat (limited to 'net-print')
-rw-r--r-- | net-print/cups/ChangeLog | 6 | ||||
-rw-r--r-- | net-print/cups/cups-1.1.23-r4.ebuild | 7 | ||||
-rw-r--r-- | net-print/cups/files/pdftops.pl | 162 |
3 files changed, 170 insertions, 5 deletions
diff --git a/net-print/cups/ChangeLog b/net-print/cups/ChangeLog index ff3fb17b998c..071f51963462 100644 --- a/net-print/cups/ChangeLog +++ b/net-print/cups/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for net-print/cups # Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-print/cups/ChangeLog,v 1.133 2005/06/06 21:05:22 lanius Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-print/cups/ChangeLog,v 1.134 2005/06/07 09:59:59 lanius Exp $ + + 07 Jun 2005; Heinrich Wendel <lanius@gentoo.org> +files/pdftops.pl, + cups-1.1.23-r4.ebuild: + add pdftops to files, bug #93871 *cups-1.1.23-r4 (06 Jun 2005) diff --git a/net-print/cups/cups-1.1.23-r4.ebuild b/net-print/cups/cups-1.1.23-r4.ebuild index 7327f07b95c1..49db9e7ad1a0 100644 --- a/net-print/cups/cups-1.1.23-r4.ebuild +++ b/net-print/cups/cups-1.1.23-r4.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-print/cups/cups-1.1.23-r4.ebuild,v 1.1 2005/06/06 21:05:22 lanius Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-print/cups/cups-1.1.23-r4.ebuild,v 1.2 2005/06/07 09:59:59 lanius Exp $ inherit eutils flag-o-matic pam @@ -10,8 +10,7 @@ DESCRIPTION="The Common Unix Printing System" HOMEPAGE="http://www.cups.org/" SRC_URI="ftp://ftp2.easysw.com/pub/cups/test/${MY_P}-source.tar.bz2 ftp://ftp.easysw.com/pub/cups/test/${MY_P}-source.tar.bz2 -ftp://ftp.funet.fi/pub/mirrors/ftp.easysw.com/pub/cups/test/${MY_P}-source.tar.bz2 -http://www.srz.de/Members/bla/cups/filter/pdftops/pdftops.pl" +ftp://ftp.funet.fi/pub/mirrors/ftp.easysw.com/pub/cups/test/${MY_P}-source.tar.bz2" LICENSE="GPL-2" SLOT="0" @@ -130,7 +129,7 @@ src_install() { # install pdftops filter exeinto /usr/lib/cups/filter/ - newexe ${DISTDIR}/pdftops.pl pdftops + newexe ${FILESDIR}/pdftops.pl pdftops dosed "s:/usr/local:/usr:" /usr/lib/cups/filter/pdftops } diff --git a/net-print/cups/files/pdftops.pl b/net-print/cups/files/pdftops.pl new file mode 100644 index 000000000000..8c6637f8df17 --- /dev/null +++ b/net-print/cups/files/pdftops.pl @@ -0,0 +1,162 @@ +#!/usr/bin/perl -w +# pdftops.pl - wrapper script for xpdf's pdftops utility to act as a CUPS filter +# ============================================================================== +# 1.00 - 2004-10-05/Bl +# Initial implementation +# +# Copyright: Helge Blischke / SRZ Berlin 2004 +# This program is free seoftware and governed by the GNU Public License Version 2. +# +# Description: +# ------------ +# This program wraps the pdftops utility from the xpdf 3.00 (and higher) suite +# to behave as a CUPS filter as a replacement for the original pdftops filter. +# +# The main purpose of this approach is to keep the properties of a PDF to be +# printed as undesturbed as possible, especially with respect to page size, +# scaling, and positioning. +# +# The pdftops utility reads a configuration file 'pdftops.conf' in the +# CUPS_SERVERROOT directory, which must exist but may be empty. The sample +# configuration file accompanying this program sets the defaults which +# seem plausible to me with respect to high end production printers. +# +# To give the user highest possible flexibility, this program accepts and +# evaluates a set of job attributes special to this filter, which are +# described below: +# +# pdf-pages=<f>,<l> +# expands to the -f and -l options of pdftops +# to select a page range to process. This is independent +# of the page-ranges attribute and may significantly +# increase throughput when printing page ranges. +# Either of these numbers may be omitted. +# +# pdf-paper=<name> +# pdf-paper=<width>x<height> +# <name> may be one of letter, legal , A4, A3, or match; +# <width> and <height> are the paper width and height +# in printers points (1/72 inch). This expands to +# either the -paper or the -paperh and -paperw options +# of pdftops +# +# pdf-opw=<password> +# pdf-upw=<password> +# expand to the -opw and -upw options of pdftops, +# respectively and permit printing of password +# protected PDFs. +# +# pdf-<option> where <option> is one of +# level1, level1sep, level2, level2sep, level3, level3sep, +# opi, nocrop, expand, noshrink, nocenter. +# See the pdftops manpage for a detailed description of +# the respective options. +# +# All other pdftops commandline options are refused. +# +# When printing from STDIN, the program copies the input to a temporary file +# in TMPDIR, which is deleted on exit. +# +# The return code of the pdftops utility, if nonzero, is used as the exit code +# of this program; error messages of the pdftops utility are only visible +# if 'debug' is specified as LogLevel in cupsd.conf. + +# +# Site specific parameters - modify as needed +# ------------------------------------------------------------------------------ +$pdftops_path = "/usr/local/bin/pdftops"; # path to the xpdf utility +# ------------------------------------------------------------------------------ + +use File::Copy; + +# +# Check the arguments +# +die ("ERROR: wrong number of arguments\n") if (scalar @ARGV < 5); + +$jobid = $username = $title = $copies = 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 +$pdffile = shift; # Pathname of PDF file to process + +# If we are reading from STDIN, we must copy the input to a temporary file +# as the PDF consumer needs a seekable input. + +if (! defined $pdffile) +{ + my $tmpfile = $ENV{TMPDIR} . "pdfin.$$.tmp"; + open (TEMP, ">$tmpfile") || die ("ERROR: pdftops wrapper: $tmpfile: $!\n"); + if (! copy (STDIN, TEMP)) + { + close (TEMP); + unlink $tmpfile; + die ("ERROR: pdftops wrapper: $tmpfile: $!\n"); + } + close (TEMP); + $pdffile = $tmpfile; + $delete_input = 1; # for deleting the temp file after converting +} + +# +# Check the options string for options to modify the bahaviour of the pdftops utility: +# +@optarr = split (/\s+/, $options); +$cmdopt = "-cfg " . $ENV{CUPS_SERVERROOT} . "/pdftops.conf"; # This cannot be changed +# The following are the (parameterless) command line options that may be used to change the +# defaults defiend by pdftops.conf +$simple = 'level1|level1sep|level2|level2sep|level3|level3sep|opi|nocrop|expand|noshrink|nocenter'; +foreach my $option (@optarr) +{ + if ($option =~ /^pdf-(.+)$/) + { # We assume this is an option to evaluate + my $optkey = $1; # possible pdftops option + if ($optkey =~ /^pages=(\d*),(\d*)$/) + { + # We do this hack here to avoid clashes with the page-ranges atrribute + # which is handled by the pstops filter. And we allow one of the numbers + # to be omitted. + my $first = $1; + my $lastp = $2; + $cmdopt .= " -f $1" if ($1); # first page + $cmdopt .= " -l $2" if ($2); # last page + } + elsif ($optkey =~ /^paper=(letter|legal|A4|A3|match)$/) + { + $cmdopt .= " -paper $1"; # paper name + } + elsif ($optkey =~ /^paper=(\d+)x(\d+)$/) + { + $cmdopt .= " -paperw $1 -paperh $2"; # paper dimensions + } + elsif ($optkey =~ /^(o|u)pw=(\S+)$/) + { + $cmdopt .= " $1" . 'pw ' . $2; # owner/user password + } + elsif ($optkey =~ /^($simple)$/) + { + $cmdopt .= ' -' . $1; # allowed simple options + } + else + { + warn ("ERROR: pdftops wrapper: illegal attribute \"pdf-$optkey\"\n"); + } + } + # All other attributes are processed elsewhere +} +# +# Complete the command +# +warn ("ERROR: pdftops-options: $cmdopt\n"); +$rc = system ("$pdftops_path $cmdopt $pdffile -"); +if ($rc) +{ + $ir = $rc & 127; + $rc >>= 8; + warn ("ERROR: pdftops_path exited with ", ($ir) ? "signal $ir, " : " exit code $rc", "\n"); + exit $rc; +} +unlink ($pdffile) if (defined $delete_input); # Delete the temp file if any +exit 0; |