diff --git a/cups.spec b/cups.spec index e171377..6b2b961 100644 --- a/cups.spec +++ b/cups.spec @@ -22,6 +22,8 @@ Source10: ncp.backend Source11: cups.conf Source12: cups.cron Source13: pdftops.conf +Source14: textonly.filter +Source15: textonly.ppd Patch1: cups-1.1.15-initscript.patch Patch2: cups-no-gzip-man.patch Patch3: cups-1.1.16-system-auth.patch @@ -206,6 +208,8 @@ install -c -m 644 %{SOURCE9} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/cups install -c -m 755 %{SOURCE10} $RPM_BUILD_ROOT%{cups_serverbin}/backend/ncp install -c -m 755 %{SOURCE12} $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/cups install -c -m 644 %{SOURCE13} $RPM_BUILD_ROOT%{_sysconfdir}/cups/pdftops.conf +install -c -m 755 %{SOURCE14} $RPM_BUILD_ROOT%{cups_serverbin}/filter/textonly +install -c -m 644 %{SOURCE15} $RPM_BUILD_ROOT%{_datadir}/cups/model/textonly.ppd ln -s ../doc/%{name}-%{version} $RPM_BUILD_ROOT%{_datadir}/%{name}/doc # Ship pstopdf for LSPP systems to deal with malicious postscript @@ -420,6 +424,9 @@ rm -rf $RPM_BUILD_ROOT %{cups_serverbin}/daemon/cups-lpd %changelog +* Tue Oct 31 2006 Tim Waugh +- Added filter and PPD for text-only printer (bug #213030). + * Mon Oct 30 2006 Tim Waugh 1:1.2.5-4 - Fixed support for /dev/ttyUSB devices (bug #212577, STR #2061). - Fixed parallel backend (bug #213021, STR #2056). diff --git a/textonly.filter b/textonly.filter new file mode 100755 index 0000000..098bb35 --- /dev/null +++ b/textonly.filter @@ -0,0 +1,50 @@ +#!/bin/bash +## Copyright (C) 2003-2006 Red Hat, Inc. +## Copyright (C) 2003-2006 Tim Waugh + +## 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. + +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +if [ $# == 0 ]; then + echo >&2 "ERROR: $0 job-id user title copies options [file]" + exit 1 +fi + +# Extract the papersize +SENDFF=`grep '^\*DefaultSendFF' "$PPD" | cut -d\ -f2` +COPIES=1 +if [ $# -ge 4 ]; then + COPIES="$4" +fi + +if [ "$COPIES" -gt 1 ] && [ $# -lt 6 ]; then + unset TMPFILE + trap -- 'rm -f "$TMPFILE"' EXIT + TMPFILE=$(mktemp ${TMPDIR:-/tmp}/textonly.XXXXXX) + cat > "$TMPFILE" +else + TMPFILE="$6" +fi + +while [ "$COPIES" -gt 0 ]; do + # Just translate LF->CRLF at the moment, until the PPD has options added. + sed -e 's/$/'`echo -ne '\r'`'/g' "$TMPFILE" + + if [ "$SENDFF" == "True" ] + then + echo -ne \\14 + fi + + COPIES=$(($COPIES - 1)) +done diff --git a/textonly.ppd b/textonly.ppd new file mode 100644 index 0000000..89060bc --- /dev/null +++ b/textonly.ppd @@ -0,0 +1,47 @@ +*PPD-Adobe: "4.3" +*% +*% Text-only printer definition +*% +*FormatVersion: "4.3" +*FileVersion: "1.1" +*LanguageVersion: English +*LanguageEncoding: ISOLatin1 +*PCFileName: "TEXTONLY.PPD" +*Manufacturer: "Generic" +*Product: "(Generic)" +*cupsVersion: 1.0 +*cupsManualCopies: True +*cupsModelNumber: 2 +*cupsFilter: "text/plain 0 textonly" +*ModelName: "Generic text-only printer" +*ShortNickName: "Generic text-only printer" +*NickName: "Generic text-only printer" +*PSVersion: "(2017.000) 0" +*LanguageLevel: "2" +*ColorDevice: False +*DefaultColorSpace: Gray +*FileSystem: False +*Throughput: "8" +*LandscapeOrientation: Plus90 +*VariablePaperSize: False +*TTRasterizer: Type42 +*DefaultImageableArea: Letter +*ImageableArea Letter/US Letter: "18 36 594 756" +*DefaultPaperDimension: Letter +*PaperDimension Letter/Letter: "612 792" +*OpenUI *PageSize/Media Size: PickOne +*OrderDependency: 10 AnySetup *PageSize +*DefaultPageSize: Letter +*PageSize Letter/Letter: "<>setpagedevice" +*CloseUI: *PageSize +*OpenUI *PageRegion: PickOne +*OrderDependency: 10 AnySetup *PageRegion +*DefaultPageRegion: Letter +*PageRegion Letter/Letter: "<>setpagedevice" +*CloseUI: *PageRegion + +*OpenUI *SendFF: Boolean +*DefaultSendFF: False +*SendFF True/True: "" +*SendFF False/False: "" +*CloseUI: *SendFF