Hej
Jeg har to printere tilsluttet via USB. Ubuntu kan se begge (Aculaser c900 og en brother 135C) og alt ser fint ud - bortset fra, at jeg ikke kan udskrive - hverken testside eller almindeligt. I printerkøen er der intet, men i completed jobs står der "completed" ud for alle forsøg.
HJÆLP!
/raketten
Printer vil ikke skrive
-
- Indlæg: 30
- Tilmeldt: 22. nov 2008, 16:10
- IRC nickname: raketten
Printer vil ikke skrive
Gigabyte GA-EG31M-S2
Intel Core 2 Duo E8400
2x2048 MB DDR II SDRAM PC2-6400
512MB GeF 9600GT TV-Out PCI-E/DVI + ASUS My Cinema P7131
Intel Core 2 Duo E8400
2x2048 MB DDR II SDRAM PC2-6400
512MB GeF 9600GT TV-Out PCI-E/DVI + ASUS My Cinema P7131
-
- Indlæg: 3105
- Tilmeldt: 16. jun 2007, 10:26
- Geografisk sted: Ikast-Herning
Re: Printer vil ikke skrive
raketten skrev:Hej
Jeg har to printere tilsluttet via USB. Ubuntu kan se begge (Aculaser c900 og en brother 135C) og alt ser fint ud - bortset fra, at jeg ikke kan udskrive - hverken testside eller almindeligt.
/raketten
Du manlger en driver til printerne.
for Brothers vedkommende kan du søge på
i synaptic og installere begge foreslåede pakker.brother 135C
Den anden printer kan du måske få igang ved at downloade denne driver
http://linux.softpedia.com/get/Printing ... -113.shtml
Stra
stra
Bruger Ubuntu 22.04 og 22.10 + lubuntu 22.10
Bruger Ubuntu 22.04 og 22.10 + lubuntu 22.10
-
- Indlæg: 30
- Tilmeldt: 22. nov 2008, 16:10
- IRC nickname: raketten
Re: Printer vil ikke skrive
Tak! Det lykkedes at få Brother'en igang
Jeg er ny til linux, så det lykkedes ikke med c900'eren.
Den skriver , at jeg skal installere alc900.cups.
Jeg har downloaded driverne i en mappe på skrivebordet - incl alc900.cups, men ved ikke hvordan jeg kører det/installerer det.
Jeg har prøvet at dobbeltklikke - og køre det som program og i terminalvindue.
alc900.cups ser sådan ud:
Jeg er ny til linux, så det lykkedes ikke med c900'eren.
Den skriver , at jeg skal installere alc900.cups.
Jeg har downloaded driverne i en mappe på skrivebordet - incl alc900.cups, men ved ikke hvordan jeg kører det/installerer det.
Jeg har prøvet at dobbeltklikke - og køre det som program og i terminalvindue.
alc900.cups ser sådan ud:
Kode: Vælg alt
#!/bin/bash
# Copyright (C) 2006 Ullrich Sigwanz
#
# 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., 59 Temple
# Place - Suite 330, Boston, MA 02111-1307, USA. */
# This program is part of the ACULASER-C900-CUPS-BACKEND
# more information on http://sourceforge.net/projects/alc900-cups
# cups call wrapper
# $Id: alc900.cups,v 1.40 2008/11/02 11:49:21 ullsig Exp $
#
##############################################################
# change this line to change the intermediate storage location
# for bundling
SPOOLDIR="/tmp"
##############################################################
export HOME="/var/spool/lpd"
source "/usr/share/alc900-cups/rc.alc900"
function helpmessage()
{
cat << END
usage: ${PROCESSNAME} [options]|[--help]
${PROCESSNAME} is the foomatic compatible print filter for the alc900-backend
The options of printing are defined in the PPD-file
Epson-AcuLaser_C900-alc900.ppd.
Please have a look at this PPD-file if you are interested in the details.
Here is a short enumeration of the possible options, which are passed
via Option:Value
OPTIONS
Driver, PaperSize, PrintQuality, PrintQuality.Automatic,
Duplex, Binding, PaperSource, TraySize, ZoomOption,ZoomOption.ZoomTo,
PaperType, Color, Bundling, BundleSize, SizeLimit, Arrange
--help show this help and quit
Errors and Comments to <ullsig@users.sourceforge.net>
END
}
declare currentcolor="anycolor" # indicates an invalid color
# --- global variables for bundling ---
declare tmpdir="" # directory to store temporary data to
declare psfile="" # postscript stream for bundling
declare bufferfile="" # file to store pages for size check
declare pageinfofile="" # small temp file
declare pages=0 # pages in the printout bundles
declare isduplex=0 # flag for duplex print in bundling
declare bundlesize=0
declare isbundling=0
declare -a aPaperSize=( "a4" "lt" "a5" "env10" "envc5" "envc6" "envdl" "exe" "hlt" )
declare PaperSize="${aPaperSize[0]}"
declare -a aPrintQualityAutomatic=( "fine" "fast" )
declare PrintQualityAutomatic="${aPrintQualityAutomatic[0]}"
declare -a aDuplex=("off" "left" "right" "top" )
declare Duplex="${aDuplex[0]}"
declare -a aPaperSource=( "autoselection" "lowercassette" "mptray" )
declare PaperSource="${aPaperSource[0]}"
declare -a aColor=( "color" "black" )
declare Color="${aColor[0]}"
declare -a aPaperType=( "normal" "thick" "coated" "transparency" "envelope" )
declare PaperType="${aPaperType[0]}"
declare -a aTraySize=( "document" "a4" "lt" "exe" )
declare TraySize="${aTraySize[0]}"
declare ZoomOptionZoomTo=100
declare ZoomOption="on"
declare gsRES=600
declare draftREDUCTION=0
declare isautocolor=0
declare issorted=0
declare isblackfirst=0
declare isbundled=0
declare Arrange="alt"
# some black pages printed in color last shorter
# than starting the hardware printing sequence twice again
declare blackpagethresh=3
declare -a alc900BLACK=()
declare -a alc900COLOR=()
declare -a pstopsPARAMS=()
declare PAGEPELS=0
declare -a gsCOLOR=()
declare -a gsBLACK=()
declare SizeLimit=0
# wait until the currently pending pipe has started
declare prevpid=""
declare itismyturn=0
declare pstopsZOOM="1:0"
declare pstopsDUPLEX="1:0"
# default for driver selection
declare useC1100=0
declare use01b1=1
declare filterpath="${ALC900FILTERPATH}"
declare namefilter="$(basename ${filterpath})"
declare LASTDUMPEDPAGE=0
declare result=0
function Message()
{
echo "${@}" >&2
}
declare CHECKPARAM
function CheckParam()
{
local check="${1}"
CHECKPARAM="${2}"
shift
while [ -n "${1}" -a "${check}" != "${1}" ] ; do
shift
done
if [ "${check}" == "${1}" ] ; then
return 0
else
Message "WARNING: CheckParam: ${check} is invalid -> defaulting to ${CHECKPARAM}"
return 1
fi
}
# result of GetPaperSizes
declare gsWIDTH=595
declare gsHEIGHT=841
declare alc900WIDTH=4960
declare alc900HEIGHT=7015
declare duplexLeft="1:0"
declare duplexRight="1:0"
declare duplexTop="1:0"
declare duplexOff="1:0"
declare whichpstops="$(which pstops)"
function TestPsToPs()
{
if [ -x "${whichpstops}" ] && \
! { namei "${whichpstops}" | grep -q "cups" || namei "${whichpstops}" | grep -q "filter"; } >/dev/null 2>&1 && \
! { ${whichpstops} --help | grep -q "job-id"; } >/dev/null 2>&1 ; then
return
fi
local ps2ps
local i
for i in $(echo ${PATH} | sed "s/:/ /g") ; do
ps2ps="${i}/pstops"
if [ -x "${ps2ps}" ] && \
! { namei "${ps2ps}" | grep -q "cups" || namei "${ps2ps}" | grep -q "filter"; } >/dev/null 2>&1 && \
! { ${ps2ps} --help | grep -q "job-id"; } >/dev/null 2>&1 ; then
Message "WARNING: changing executable pstops from \"${whichpstops}\" to \"${ps2ps}\""
whichpstops="${ps2ps}"
return
fi
done
whichpstops="/usr/bin/pstops"
Message "WARNING: guessing executable pstops: \"${whichpstops}\""
}
function GetPaperSizes()
{
duplexLeft="1:0"
duplexRight="1:0"
duplexTop="1:0"
duplexOff="1:0"
local hasduplex=0
local rotate=0
case "${1}" in
a5) gsWIDTH=419
gsHEIGHT=595
alc900WIDTH=3496
alc900HEIGHT=4960
;;
env10) gsWIDTH=297
gsHEIGHT=684
alc900WIDTH=2475
alc900HEIGHT=5700
;;
envc5) gsWIDTH=459
gsHEIGHT=649
alc900WIDTH=3826
alc900HEIGHT=5409
;;
envc6) gsWIDTH=323
gsHEIGHT=459
alc900WIDTH=2692
alc900HEIGHT=3826
rotate=1
;;
envdl) gsWIDTH=311
gsHEIGHT=623
alc900WIDTH=2598
alc900HEIGHT=5196
rotate=1
;;
exe) gsWIDTH=522
gsHEIGHT=756
alc900WIDTH=4350
alc900HEIGHT=6300
;;
hlt) gsWIDTH=396
gsHEIGHT=612
alc900WIDTH=3300
alc900HEIGHT=5100
;;
mon) gsWIDTH=279
gsHEIGHT=540
alc900WIDTH=2325
alc900HEIGHT=4500
rotate=1
;;
lt) gsWIDTH=612
gsHEIGHT=792
alc900WIDTH=5100
alc900HEIGHT=6600
if [ "${Arrange}" != alt ] ; then
duplexLeft="2:0@0.95098(30,19),1@0.95098(0,19)" # 0.95098 => 582x753
duplexRight="2:0@0.95098(0,19),1@0.95098(30,19)" # 0.95098 => 582x753
duplexTop="2:0@0.962121(11,0),1U@0.962121(600,761)" # 0.962121 => 589x762
else
duplexLeft="2:1U@0.95098(612,773),0@0.95098(30,19)"
duplexRight="2:1U@0.95098(583,773),0@0.95098(0,19)"
duplexTop="2:1@0.962121(11,0),0@0.962121(11,0)"
fi
hasduplex=1
;;
a4|*)
gsWIDTH=595
gsHEIGHT=841
alc900WIDTH=4960
alc900HEIGHT=7015
if [ "${Arrange}" != alt ] ; then
duplexLeft="2:0@0.94958(29,21),1@0.94958(0,21)" # 0.94958 => 565x799
duplexRight="2:0@0.94958(0,21),1@0.94958(29,21)" # 0.94958 => 565x799
duplexTop="2:0@0.964328(10,0),1U@0.964328(581,810)" # 0.964328 => 574x811
else
duplexLeft="2:1U@0.94958(595,820),0@0.94958(29,21)"
duplexRight="2:1U@1.0(566,820),0@0.94958(0,21)"
duplexTop="2:1@0.964328(11,0),0@0.964328(11,0)"
fi
hasduplex=1
;;
esac
rotate=0
if [ ${rotate} -ne 0 ] ; then
local swap="${gsHEIGHT}"
gsHEIGHT="${gsWIDTH}"
gsWIDTH="${swap}"
swap="${alc900HEIGHT}"
alc900HEIGHT="${alc900WIDTH}"
alc900WIDTH="${swap}"
duplexOff="1:R0(0,${gsHEIGHT})"
duplexLeft="${duplexOff}"
duplexRight="${duplexOff}"
duplexTop="${duplexOff}"
# changes if the C1100 driver is used
elif [ "${useC1100}" -ne 0 -a "${hasduplex}" -ne 0 ] ; then
duplexLeft="2:1U(${gsWIDTH},${gsHEIGHT}),0"
duplexRight="${duplexLeft}"
duplexTop="2:1,0"
fi
}
function ChangedTraySize()
{
case "${1}" in
lt) duplexOff="1:0@1.0($(((612-${gsWIDTH}+1)/2)),$((792-${gsHEIGHT})))"
gsWIDTH=612
gsHEIGHT=792
alc900WIDTH=5100
alc900HEIGHT=6600
;;
a4) duplexOff="1:0@1.0($(((595-${gsWIDTH}+1)/2)),$((841-${gsHEIGHT})))"
gsWIDTH=595
gsHEIGHT=841
alc900WIDTH=4960
alc900HEIGHT=7015
;;
exe) duplexOff="1:0@1.0($(((522-${gsWIDTH}+1)/2)),$((756-${gsHEIGHT})))"
gsWIDTH=522
gsHEIGHT=756
alc900WIDTH=4350
alc900HEIGHT=6300
;;
*) return 1 ;;
esac
Message "DEBUG: Using TraySize \"${1}\""
return 0
}
function SetZoomFactor()
{
local shiftx=""
local shifty=""
local zoomfrac=""
local zoomtrunc=""
local factor="$((${1}))"
if [ ${factor} -ge 10 -a ${factor} -le 300 ] ; then
shiftx="$((((100-${factor})*${gsWIDTH})/200))"
shifty="$((((100-${factor})*${gsHEIGHT})/200))"
if [ ${useC1100} -ne 0 ] ; then
shiftx=$((${shiftx}-7))
shifty=$((${shifty}+9))
else
shiftx=$((${shiftx}+4))
shifty=$((${shifty}+0))
fi
zoomtrunc="$((${factor}/100))"
zoomfrac="$((${factor}+100))" # make sure, that the number has 3 digits
zoomfrac="${zoomfrac:1}" # and remove just the first one
pstopsZOOM="1:0@${zoomtrunc}.${zoomfrac}(${shiftx},${shifty})"
Message "DEBUG: scaling by: pstops ${pstopsZOOM}"
fi
}
function ExtractParams()
{
local i
local binding="left"
local duplex="off"
local quality="fine"
local bundle=0
local bundling="off"
local limiting="on"
local color="color"
local driver="c900"
# parse through the parameters from the procedure's command line
for i; do
case "${i}" in
--help) helpmessage
exit 0
;;
Driver:*) driver="${i##Driver:}" ;;
PaperSize:*) PaperSize="${i##PaperSize:}" ;;
PrintQuality:*) : ;;
PrintQuality.Automatic:*) quality="${i##PrintQuality.Automatic:}" ;;
Duplex:*) duplex="${i##Duplex:}" ;;
Binding:*) binding="${i##Binding:}" ;;
PaperSource:*) PaperSource="${i##PaperSource:}" ;;
TraySize:*) TraySize="${i##TraySize:}" ;;
ZoomOption:*) : ;;
ZoomOption.ZoomTo:*) ZoomOptionZoomTo="${i##ZoomOption.ZoomTo:}" ;;
PaperType:*) PaperType="${i##PaperType:}" ;;
Color:*) color="${i##Color:}" ;;
Bundling:*) bundling="${i##Bundling:}" ;;
BundleSize:*) bundle="${i##BundleSize:}" ;;
SizeLimit:*) SizeLimit="${i##SizeLimit:}" ;;
Arrange:*) Arrange="${i##Arrange:}" ;;
Hold:*) [ "${i}" == "Hold:no" ] && Message "DEBUG: network interfaces would be released immediately!" ;;
*) Message "WARNING: ignoring parameter [${i}]" ;;
esac
done
if [ "${driver}" == "c1100" ] ; then
if newfilterpath="$(which alc1100 2>/dev/null)" ; then
filterpath="${newfilterpath}"
namefilter="$(basename ${filterpath})"
useC1100=1
Message "DEBUG: switching to driver \"${namefilter}\""
else
Message "\
WARNING: driver \"alc1100\" not found in ${PATH}
WARNING: falling back to \"${namefilter}\""
useC1100=0
fi
newfilter=""
fi
if [ ${useC1100} -eq 0 ] ; then
if grep "PrintQuality.Automatic" >/dev/null 2>&1 "${filterpath}" 2>&1 ; then
Message "DEBUG: found deprecated option \"PrintQuality.Automatic\" in \"${namefilter}\""
use01b1=1
else
use01b1=0
fi
fi
# check max jobsize
if [ "$((${SizeLimit}+0))" -le 0 -o "$((${SizeLimit}+0))" -ge 150 ] ; then
SizeLimit=0
Message "DEBUG: not checking for job limit"
else
Message "DEBUG: jobs shall not exeed ${SizeLimit}MB"
fi
# draft must be translated into fast and tonersave
if [ "${quality}" == "draft" ] ; then
draftREDUCTION=50
PrintQualityAutomatic="fast"
else
draftREDUCTION=0
PrintQualityAutomatic="${quality}"
fi
# Color:auto must be translated
if [ "${color#auto}" != "${color}" ] ; then
isautocolor=1
Color="color"
# separate the string "auto" from a trailing digit (if any)
blackpagethresh="$((${color#auto}+1))"
if [ "${blackpagethresh}" -le 0 ] ; then
Message "WARNING: adjusting black pages threshold \"${blackpagethresh}\" to 1"
blackpagethresh=1
else
Message "DEBUG: black pages threshold: ${blackpagethresh}"
fi
elif [ "${color#sorted}" != "${color}" ] ; then
issorted=1
Color="color"
if [ "${color//black/}" != "${color}" ] ; then
isblackfirst=1
elif [ "${color//color/}" == "${color}" ] ; then
Message "WARNING: sorting \"${color}\" not valid -> using sortedblack"
isblackfirst=1
fi
else
Color="${color}"
fi
# check for parameters having the correct values
CheckParam "${PaperSize}" "${aPaperSize[@]}" || PaperSize="${CHECKPARAM}"
# only a4 and lt support duplex
if [ "${duplex}" != off ] ; then
if [ "${PaperSize}" != a4 -a "${PaperSize}" != lt ] ; then
duplex="off"
Message "WARNING: switching off Duplex due to PaperSize:${PaperSize}"
elif [ "${PaperType}" != normal ] ; then
duplex="off"
Message "WARNING: switching off Duplex due to PaperType:${PaperType}"
fi
fi
if [ "${duplex}" != "off" -a "${TraySize}" != "${aTraySize[0]}" ] ; then
Message "WARNING: switching off tray mapping \"${TraySize}\" due to Duplex"
TraySize="${aTraySize[0]}"
fi
# look which binding should be taken
case "${duplex}" in
top) Duplex="top" ;;
binding) Duplex="${binding}" ;;
*) Duplex="off" ;;
esac
# check for parameters having the correct values
CheckParam "${PrintQualityAutomatic}" "${aPrintQualityAutomatic[@]}" || PrintQualityAutomatic="${CHECKPARAM}"
CheckParam "${Color}" "${aColor[@]}" || Color="${CHECKPARAM}"
CheckParam "${PaperType}" "${aPaperType[@]}" || PaperType="${CHECKPARAM}"
CheckParam "${PaperSource}" "${aPaperSource[@]}" || PaperSource="${CHECKPARAM}"
CheckParam "${Duplex}" "${aDuplex[@]}" || Duplex="${CHECKPARAM}"
CheckParam "${TraySize}" "${aTraySize[@]}" || TraySize="${CHECKPARAM}"
# set flag for duplex
if [ "${Duplex}" != "off" ] ; then
isduplex=1
if [ "${issorted}" -ne 0 ] ; then
isblackfirst=0
issorted=0
Message "WARNING: switching off Sorting due to Duplex:${Duplex}"
fi
else
isduplex=0
fi
# set flag for bundling
if [ "${bundling}" != "off" -a -n "${bundle}" -a ${bundle} -gt 0 ] ; then
isbundling=1
bundlesize="${bundle}"
else
isbundling=0
bundlesize=0
fi
GetPaperSizes "${PaperSize}"
SetZoomFactor "${ZoomOptionZoomTo}"
if ChangedTraySize "${TraySize}" ; then
PaperSize="${TraySize}"
fi
# get the correct paper dimensions and duplex shrink factors and offsets
case "${Duplex}" in
left) pstopsDUPLEX="${duplexLeft}" ;;
right) pstopsDUPLEX="${duplexRight}" ;;
top) pstopsDUPLEX="${duplexTop}" ;;
*) pstopsDUPLEX="${duplexOff}" ;;
esac
# set the correct no. of pixels for the resolution
if [ "${PrintQualityAutomatic}" != "fine" ] ; then
gsRES="$((${gsRES}/2))"
alc900WIDTH="$((${alc900WIDTH}/2))"
alc900HEIGHT="$((${alc900HEIGHT}/2))"
fi
if [ "${useC1100}" -ne 0 -o "${use01b1}" -eq 0 ] ; then
alc900COLOR=( "-o" "PaperSize:${PaperSize}" \
"-o" "PaperSource:${PaperSource}" \
"-o" "PaperType:${PaperType}" \
"-o" "QualityAuto:${PrintQualityAutomatic}" \
"-o" "TonerSave:false" \
"-o" "Duplex:${Duplex}" \
"-o" "Width:${alc900WIDTH}" \
"-o" "Height:${alc900HEIGHT}" )
else
alc900COLOR=( "-o" "PaperSize:${PaperSize}" \
"-o" "PaperSource:${PaperSource}" \
"-o" "PaperType:${PaperType}" \
"-o" "PrintQuality.Automatic:${PrintQualityAutomatic}" \
"-o" "ZoomOption:on" \
"-o" "Duplex:${Duplex}" \
"-o" "Width:${alc900WIDTH}" \
"-o" "Height:${alc900HEIGHT}" )
fi
alc900BLACK=( "${alc900COLOR[@]}" "-o" "Color:black" )
Message "\
DEBUG: PaperSize:${PaperSize}
DEBUG: PrintQuality.Automatic:${PrintQualityAutomatic}
DEBUG: Color:${Color}
DEBUG: PaperType:${PaperType}
DEBUG: PaperSource:${PaperSource}
DEBUG: Duplex:${Duplex}"
# assign the parameter strings to just use them in one statement
gsCOLOR=( "-q" "-dBATCH" "-dNOPAUSE" "-sDEVICE=bitrgb" "-dRedValues=256" "-r${gsRES}" "-g${alc900WIDTH}x${alc900HEIGHT}" "-sOutputFile=-" "-" )
gsBLACK=( "-q" "-dBATCH" "-dNOPAUSE" "-sDEVICE=bit" "-dGrayValues=256" "-r${gsRES}" "-g${alc900WIDTH}x${alc900HEIGHT}" "-sOutputFile=-" "-" )
pstopsPARAMS=( "-q" "-w${gsWIDTH}" "-h${gsHEIGHT}" "${pstopsDUPLEX}" )
PAGEPELS="$((${alc900WIDTH}*${alc900HEIGHT}))"
}
# streaming a postscript file to std out
function TranslateTo()
{
local result=0
local -a gsparams=()
local -a alc900params=()
local sourcefile="-"
local pagepels="${PAGEPELS}"
local log=""
local -a logfile=()
local trdir=""
local gstmp=""
if [ -z "${tmpdir}" ] ; then
if ! trdir="$(mktemp -d "${SPOOLDIR}/alc900.cups.${PROCESSID}.XXXXXXXX" 2>&1)" ; then
trdir="${SPOOLDIR}/alc900.cups.${PROCESSID}.translat"
mkdir -p "${trdir}"
fi
trap "rm -rf ${trdir}; rm -f ${ALC900FILTERLOCK}; killall -KILL $(basename ${filterpath}); exit 1" 1 2 3 9 15
log="${trdir}/trlog-"
gstmp="${trdir}"
else
log="${tmpdir}/trlog-"
gstmp="${tmpdir}"
fi
if [ -n "${1}" ] ; then
sourcefile="${1}"
fi
if [ "${Color}" == "color" ] ; then
gsparams=( "${gsCOLOR[@]}" )
alc900params=( "${alc900COLOR[@]}" )
pagepels="$((${pagepels}*3))"
else
gsparams=( "${gsBLACK[@]}" )
alc900params=( "${alc900BLACK[@]}" )
fi
Message "\
DEBUG: source: ${sourcefile}
DEBUG: zoom : ${pstopsZOOM}
DEBUG: pstops: ${pstopsPARAMS[@]}
DEBUG: gs : ${gsparams[@]}
DEBUG: draft : --reduction=${draftREDUCTION} --pels=${pagepels}
DEBUG: filter: ${alc900params[@]}"
logfile=( "${log}0" "${log}1" "${log}2" "${log}3" "${log}4" "${log}5" )
touch "${logfile[@]}"
export TEMP=${gstmp}
gs -q -sDEVICE=pswrite "-sOutputFile=-" -dNOPAUSE -dBATCH "${sourcefile}" 2>"${logfile[0]}" | \
${whichpstops} -q "${pstopsZOOM}" 2>"${logfile[1]}" | \
${whichpstops} -q "${pstopsPARAMS[@]}" 2>"${logfile[2]}" | \
gs "${gsparams[@]}" 2>"${logfile[3]}" | \
${ALC900DRAFT} "--reduction=${draftREDUCTION}" "--pels=${pagepels}" 2>"${logfile[4]}" | \
${filterpath} "${alc900params[@]}" 2>"${logfile[5]}"
result=$?
cat "${logfile[@]}" | sed -e "/^PAGE:\ .*$/d" -e "s/^WARNING: //g" -e "s/^/WARNING: /g" >&2
if [ -n "${trdir}" ] ; then
rm -rf "${trdir}"
trap "rm -f ${ALC900FILTERLOCK}" 1 2 3 9 15
else
rm -f "${logfile[@]}"
fi
if [ "${result}" -eq 134 ] ; then
Message "\
WARNING: ============================
WARNING: render-return-code ${result}
WARNING: this is a known error of \"${filterpath}\"
WARNING: and not critical, continuing ..."
result=0
elif [ "${result}" -ne 0 ] ; then
Message "\
ERROR: ============================
ERROR: *** FATAL error: \"gs | ${whichpstops} | ${whichpstops} | gs | ${filterpath}\" terminated with error-code ${result} ***"
fi
return ${result}
}
# loops trough the psfile from page ${1} to page ${2} and returns 0 (ok)
# when at least one page contains color information
function IsColor()
{
# 1: startpage
# 2: endpage
if [ "${gsWIDTH}" != 0 -a "${gsHEIGHT}" != 0 ] ; then
local i
[ -n "${tmpdir}" ] && export TEMP="${tmpdir}" # lucky us, IsColor is only called with Color=Autoselect and then tmpdir exists
for i in $(seq ${1} ${2}) ; do
if psselect -q -p${i} "${psfile}" 2>/dev/null | \
gs -q -dBATCH -dSAFER -dNOPAUSE "-g${gsWIDTH}x${gsHEIGHT}" -r72x72 -sDEVICE=bitcmyk -sOutputFile=- - 2>/dev/null | \
${ALC900ISBLACK} >/dev/null 2>&1; then
:
else
return 0
fi
done
fi
return 1
}
# set the system color
function SetAutoColor()
{
if [ "${currentcolor}" != "${1}" ] && [ "${1}" == "color" -o "${1}" == "black" ] ; then
Message "\
INFO: -> (Auto)Color:${1}
DEBUG: -> (Auto)Color:${1}"
Color="${1}"
currentcolor="${1}"
fi
}
# print a bundle of pages, regardless of its contents
function DumpPages()
{
# 1: startpage
# 2: endpage
# start page number must be less equal number for pages at all
local result
local pageinfo
local dpages="$((${2}-${1}+1))"
Message "DEBUG: processing ${Color} page:${1}-${2}"
psselect -q "-p${1}-${2}" "${psfile}" 2>/dev/null | \
TranslateTo "-" | ${ALC900SIZE} --duplex="${isduplex}" --silent --buffer_file="${bufferfile}" --size_mb=${SizeLimit} 2>"${pageinfofile}"
result=$?
pageinfo="$(<${pageinfofile})" 2>/dev/null
rm -f "${pageinfofile}" "${bufferfile}"
result="$((${result}+0))"
pageinfo="$((${pageinfo}+0))"
# pageinfo had been assigned a value
if [ ${result} -eq 0 -o ${result} -eq 255 ] ; then
if [ ${result} -eq 0 ] ; then
if [ $((${2}-${1}+1)) -gt ${pageinfo} ] ; then
Message "WARNING: *** Conversion of Esc/P (${dpages} pages) resulted in wrong printout (${pageinfo} pages), continuing ..."
pageinfo="${dpages}"
fi
elif [ ${result} -eq 255 ] ; then
if [ "${pageinfo}" -eq 0 ] ; then
Message "WARNING: *** skipped page/sheet ${1}, sheet bigger than ${SizeLimit}MB"
# even if number of printed sheets was 0, assume it was 1 sheet, the one which is too big
pageinfo="$((${isduplex}+1))"
elif [ "${pageinfo}" -lt 0 ] ; then
Message "WARNING: *** cannot calculate size of page(s), assuming error"
# assume success
pageinfo="${dpages}"
fi
fi
# remove pages from the beginning of the string by removing one number and one succeeding comma
LASTDUMPEDPAGE="$((${1}+${pageinfo}-1))"
if [ "${LASTDUMPEDPAGE}" -lt "${2}" ] ; then
Message "DEBUG: break after ${pageinfo} page(s) at page ${LASTDUMPEDPAGE}, ${SizeLimit}MB exeeded"
fi
return 0
else
Message "ERROR: Conversion to Esc/P and/or page size estimation caused fatal error: ${result}"
LASTDUMPEDPAGE="${2}"
return "${result}"
fi
}
function SplitAutoColorBundle()
{
# 1 : startpage
# 2 : endpage
local printcolor="anycolor"
local prevcolor="anycolor"
# loop variables
local startpage="$((${1}+0))"
local firstpage="${startpage}"
local lastpage=0
# counters for black pages
local printfirstblackpage=${firstpage}
local printlastblackpage=0
local sequentialblackpages=0
# counters for color pages
local printfirstcolorpage=${firstpage}
local printlastcolorpage=0
local blackhead=0
Message "DEBUG: analyzing page ${firstpage}-${2}"
while [ ${firstpage} -le $((${2}+0)) -a ${firstpage} -gt 0 ] ; do
# last page of the pages to check in one chunk (1 or 2)
lastpage=$((${firstpage}+${isduplex}))
# do not exeed the number of all available pages
if [ ${lastpage} -gt $((${2}+0)) ] ; then
lastpage=$((${2}+0))
fi
# check the page(s) for one of them being colored
if IsColor "${firstpage}" "${lastpage}" ; then
# we interrupted the sequence of blackpages
if [ "${sequentialblackpages}" -ne 0 ] ; then
Message "DEBUG: end of black block at page: $((${firstpage}-1))"
sequentialblackpages=0
fi
# a black sequence was detected before, so print the black sequence
if [ "${prevcolor}" == "black" ] ; then
printcolor="black"
printfirstcolorpage="${firstpage}"
printlastcolorpage="${firstpage}"
printlastblackpage="$((${firstpage}-1))"
elif [ "${prevcolor}" == "anycolor" ] ; then
if [ "${blackhead}" == 1 ] ; then
printfirstcolorpage="${printfirstblackpage}"
Message "DEBUG: restart looking for tentative black pages"
else
printfirstcolorpage="${firstpage}"
fi
printlastcolorpage=${lastpage}
else
printlastcolorpage=${lastpage}
fi
prevcolor="color"
blackhead=0
else
# starting all over with the first black page, if printfirstblackpage is not set
if [ ${sequentialblackpages} == 0 ] ; then
printfirstblackpage="${firstpage}"
if [ "${firstpage}" -eq "${startpage}" ] ; then
blackhead=1
fi
fi
# another black page in sequence
sequentialblackpages=$((${sequentialblackpages}+${lastpage}-${firstpage}+1))
# if exeeding the number of allowed black pages in sequence, trigger printing, when color was active before
# otherwise count up the last black page to print
if [ "${sequentialblackpages}" -ge "${blackpagethresh}" ] ; then
# color pages were detected, before the treshold for black pages was exeeded
if [ "${prevcolor}" == "color" ] ; then
Message "DEBUG: print color up to page: $((${printfirstblackpage}-1))"
printcolor="color"
# stop color printing just before the first black page was detected
# printlastcolorpage is wrong in this case
printlastcolorpage="$((${printfirstblackpage}-1))"
fi
prevcolor="black"
blackhead=0
else
# whatever will be printed in color,
#it will be printed until here, if no black-page-sequence is detected
Message "DEBUG: ${sequentialblackpages}.tentative black page: ${lastpage}"
printlastcolorpage=${lastpage}
fi
fi
if [ "${printcolor}" != "anycolor" ] ; then
if [ "${printcolor}" == "black" ] ; then
SetAutoColor "black"
DumpPages "${printfirstblackpage}" "${printlastblackpage}"
if [ "${LASTDUMPEDPAGE}" -lt "${printlastblackpage}" ] ; then
Message "DEBUG: exit SplitAutoColorBundle() at page: ${LASTDUMPEDPAGE}"
return 0
fi
printfirstcolorpage="$((${printlastblackpage}+1))"
printfirstblackpage="${printfirstcolorpage}"
else
SetAutoColor "color"
DumpPages "${printfirstcolorpage}" "${printlastcolorpage}"
if [ "${LASTDUMPEDPAGE}" -lt "${printlastcolorpage}" ] ; then
Message "DEBUG: exit SplitAutoColorBundle() at page: ${LASTDUMPEDPAGE}"
return 0
fi
printfirstcolorpage="$((${printlastcolorpage}+1))"
printfirstblackpage="${printfirstcolorpage}"
fi
if [ "$((${lastpage}+1))" -le "$((${2}+0))" ] ; then
Message "DEBUG: exit SplitAutoColorBundle() at page: ${LASTDUMPEDPAGE}"
return 0
fi
# reinitialize the start and end pages for printing
printcolor="anycolor"
fi
firstpage=$((${lastpage}+1))
done
# on a separate bundle, jugde, whether to print all in black or all in color
# sequentialblackpages was not reset to 0 in this case
if [ ${sequentialblackpages} -ne 0 -a ${printfirstblackpage} -le ${printfirstcolorpage} ] ; then
# last black page depends on seuqntial black pages
printlastblackpage="$((${printfirstblackpage}+${sequentialblackpages}-1))"
Message "DEBUG: last pages ${printfirstblackpage}-${printlastblackpage} are solely black pages"
SetAutoColor "black"
DumpPages "${printfirstblackpage}" "${printlastblackpage}"
# whatever is in the pipe, print it in color, because the threshold was not exeeded before
elif [ ${printfirstcolorpage} -le ${printlastcolorpage} ] ; then
Message "DEBUG: last pages ${printfirstcolorpage}-${printlastcolorpage} include color pages"
SetAutoColor "color"
DumpPages "${printfirstcolorpage}" "${printlastcolorpage}"
fi
}
function SplitPostscript()
{
local page=1
local lastpage=0
# start page number must be less equal number for pages at all
while [ "${page}" -le "${pages}" ] ; do
# last page must not exeed number of all pages
if [ "${isbundling}" -ne 0 ] ; then
lastpage=$((${page}+${bundlesize}-1))
if [ "${lastpage}" -gt "${pages}" ] ; then
lastpage="${pages}"
fi
else
lastpage=${pages}
fi
if [ "${isautocolor}" -ne 0 ] ; then
SplitAutoColorBundle "${page}" "${lastpage}"
else
DumpPages ${page} ${lastpage}
fi
lastpage="${LASTDUMPEDPAGE}"
page=$((${lastpage}+1))
done
}
function DumpSortedPages()
{
# 1: set of pages starting with a ,
# start page number must be less equal number for pages at all
local setpages="${1}" # iterator
local pageinfo # page info
local i # loop variable
local result # result of conversion procedure
# iterate trough the pages string "a,b,c," until it is empty
while [ -n "${setpages}" ] ; do
pageinfo=""
Message "DEBUG: processing ${Color} page(s):${setpages%,}"
psselect -q "-p${setpages%,}" "${psfile}" 2>/dev/null | \
TranslateTo "-" | ${ALC900SIZE} --duplex="${isduplex}" --silent --buffer_file="${bufferfile}" --size_mb=${SizeLimit} 2>"${pageinfofile}"
result=$?
pageinfo="$(<${pageinfofile})" 2>/dev/null
Message "DEBUG: read value \"${pageinfo}\" from \"${pageinfofile}\"; result=${result}"
rm -f "${pageinfofile}" "${bufferfile}"
result="$((${result}+0))"
pageinfo="$((${pageinfo}+0))"
# pageinfo had been assigned a value
if [ ${result} -eq 0 -o ${result} -eq 255 ] ; then
if [ ${result} -eq 0 ] ; then
if [ $((${2}-${1}+1)) -gt ${pageinfo} ] ; then
Message "WARNING: *** Conversion of Esc/P (${dpages} pages) resulted in wrong printout (${pageinfo} pages), continuing ..."
pageinfo="${dpages}"
fi
elif [ ${result} -eq 255 ] ; then
if [ "${pageinfo}" -eq 0 ] ; then
Message "WARNING: *** skipped page/sheet ${1}, sheet bigger than ${SizeLimit}MB"
# even if number of printed sheets was 0, assume it was 1 sheet, the one which is too big
pageinfo="$((${isduplex}+1))"
elif [ "${pageinfo}" -lt 0 ] ; then
Message "WARNING: *** cannot calculate size of page(s), assuming error"
pageinfo=0
for i in ${setpages//,/ } ; do
pageinfo="$((${pageinfo}+1))"
done
fi
fi
for i in $(seq 1 "${pageinfo}") ; do
setpages="${setpages#*,}"
done
if [ -n "${setpages}" ] ; then
Message "DEBUG: restart after ${pageinfo} page(s), ${SizeLimit}MB exeeded or job empty"
fi
else
Message "ERROR: Conversion to Esc/P and/or page size estimation caused fatal error: ${result}"
return "${result}"
fi
done
return 0
}
function SortPostscript()
{
local page # loop variable
local blacknow
local toner
local -a setofpages=()
local blocks
local block
local -a setofblackpages=()
local blackpages=0
local blackblocks=0
local -a setofcolorpages=()
local colorpages=0
local colorblocks=0
page=1
if [ "${isbundling}" -ne 0 -a "${bundlesize}" -gt 0 ] ; then
while [ "${page}" -le "${pages}" ] ; do
if IsColor ${page} ${page} ; then
# build a string with "a,b,c,...x," where abcx are numbers
setofcolorpages[${colorblocks}]="${setofcolorpages[${colorblocks}]}${page},"
colorpages="$((${colorpages}+1))"
if [ "${colorpages}" -ge "${bundlesize}" ] ; then
# print bundle as soon as possible
if [ "${isblackfirst}" -ne 1 ] ; then
SetAutoColor "color"
DumpSortedPages "${setofcolorpages[0]}"
setofcolorpages=()
else
colorblocks="$((${colorblocks}+1))"
fi
colorpages=0
fi
else
# build a string with "a,b,c,...x," where abcx are numbers
setofblackpages[${blackblocks}]="${setofblackpages[${blackblocks}]}${page},"
blackpages="$((${blackpages}+1))"
if [ "${blackpages}" -ge "${bundlesize}" ] ; then
# print bundle as soon as possible
if [ "${isblackfirst}" -eq 1 ] ; then
SetAutoColor "black"
DumpSortedPages "${setofblackpages[0]}"
setofblackpages=()
else
blackblocks="$((${blackblocks}+1))"
fi
blackpages=0
fi
fi
page=$((${page}+1))
done
else
while [ "${page}" -le "${pages}" ] ; do
if IsColor ${page} ${page} ; then
setofcolorpages[0]="${setofcolorpages[0]}${page},"
else
setofblackpages[0]="${setofblackpages[0]}${page},"
fi
page=$((${page}+1))
done
fi
toner=1
blacknow="${isblackfirst}"
while [ "${toner}" -le 2 ] ; do
if [ "${blacknow}" -eq 1 ] ; then
setofpages=( "${setofblackpages[@]}" )
blocks="${blackblocks}"
SetAutoColor "black"
blacknow=0
else
setofpages=( "${setofcolorpages[@]}" )
blocks="${colorblocks}"
SetAutoColor "color"
blacknow=1
fi
if [ ${#setofpages[@]} -gt 0 ] ; then
block=0
while [ "${block}" -le "${blocks}" ] ; do
DumpSortedPages "${setofpages[${block}]}"
block="$((${block}+1))"
done
fi
toner="$((${toner}+1))"
done
}
# wait until no more semaphore lockfile
${ALC900LOCKFILE} "--lockfile=${ALC900FILTERLOCK}" "--procname=${PROCESSNAME}" "--procid=${PROCESSID}"
result=$?
if [ "${result}" -ne 0 ] ; then
Message "ERROR: fatal: generation of \"${ALC900FILTERLOCK}\" returned status: ${result}"
exit 1
fi
trap "rm -f ${ALC900FILTERLOCK}; exit 1" 1 2 3 9 15
ClearTmpFiles
TestPsToPs
ExtractParams "${@}"
# check if need bundling of page and pausing in between
if [ "${isbundling}" -ne 0 -o "${isautocolor}" -ne 0 -o "${issorted}" -ne 0 ] ; then
# try to generate temporary deirectory
if tmpdir=$(mktemp -d "${SPOOLDIR}/alc900.cups.${PROCESSID}.XXXXXXXX" 2>&1) ; then
psfile="${tmpdir}/ps-stream.dump"
bufferfile="${tmpdir}/buffer"
pageinfofile="${tmpdir}/pageifnfo"
touch "${psfile}" "${bufferfile}" "${pageinfofile}"
trap "rm -rf ${tmpdir}; rm -f ${ALC900FILTERLOCK}; killall -KILL $(basename ${filterpath}); exit 1" 1 2 3 9 15
Message "DEBUG: analizing input stream"
# copy the input stream to file and get the number of pages
psselect "-p1-" >"${psfile}" 2>"${pageinfofile}"
pages="$(< ${pageinfofile})" # get number of pages protocol
rm -f "${pageinfofile}" # remove the file with the page information
# remove the disturbing stuff around the brakets of the last page
if [ "${pages//'['/}" != "${pages}" -a "${pages//']'/}" != "${pages}" ] ; then
# get the contents in the last bracketed number
pages="${pages##*'['}"
pages="${pages%%']'*}"
# clean the expression
pages="$((${pages}))" 2>/dev/null
else
pages=0
fi
# do some debug output
Message "DEBUG: found ${pages} page(s) in stdin"
if [ "${isbundling}" -ne 0 -a ${pages} -le ${bundlesize} ] ; then
isbundling=0
bundlesize=0
if [ ${pages} -le 0 ] ; then
Message "WARNING: bundling cannot be processed, because of missing page info"
else
Message "WARNING: no bundling needed; too less pages"
fi
fi
if [ "${isautocolor}" -ne 0 -a ${pages} -le 0 ] ; then
Message "WARNING: AutoColor cannot be processed, because of missing page info"
isautocolor=0
fi
if [ "${issorted}" -ne 0 -a ${pages} -le 0 ] ; then
Message "WARNING: Sorting cannot be processed, because of missing page info"
isautocolor=0
fi
if [ "${isbundling}" -ne 0 -o "${isautocolor}" -ne 0 -o "${issorted}" -ne 0 ] ; then
# here we can do anything at all, because we have page information
# take duplex into account
if [ "${isbundling}" -ne 0 ] ; then
# short status about the bundling
Message "DEBUG: BundleSize:${bundlesize}"
duplexbundlesize=$(((1+${isduplex})*((${bundlesize}+${isduplex})/(1+${isduplex}))))
# split only, when the number of pages is big enough
if [ "${pages}" -gt "${duplexbundlesize}" ] 2>/dev/null ; then
if [ ${bundlesize} != ${duplexbundlesize} ] ; then
bundlesize="${duplexbundlesize}"
Message "DEBUG: adjust BundleSize=${bundlesize}, due to Duplex"
fi
else
Message "WARNING: no bundling needed; too less pages because of Duplex"
isbundling=0
bundlesize=0
fi
fi
if [ "${isbundling}" -ne 0 -o "${isautocolor}" -ne 0 -o "${issorted}" -ne 0 ] ; then
isbundled=1
if [ "${issorted}" -ne 0 ] ; then
SortPostscript
result=$?
else
SplitPostscript
result=$?
fi
# do some debug output about the status
Message "DEBUG: bundling/sorting (alc900.cups) exited with status ${result}"
rm -rf "${tmpdir}"
rm -f "${ALC900FILTERLOCK}"
trap 1 2 3 9 15
exit "${result}"
fi
fi
# no bundling has taken place
if [ "${isbundled}" -eq 0 ] ; then
Message "\
DEBUG: simply streaming postscript-file \"${psfile}\"
DEBUG: calling ${namefilter}"
TranslateTo "${psfile}"
result=$?
# clean up
rm -rf "${tmpdir}"
rm -f "${ALC900FILTERLOCK}"
trap 1 2 3 9 15
if [ ${result} == 0 ] ; then
Message "DEBUG: ${namefilter} DONE!"
else
Message "ERROR: *** ${namefilter} FAILED!"
fi
exit ${result}
fi
else
if [ "${isautocolor}" -ne 0 ] ; then
isautocolor=0
Message "\
WARNING: *** failed to create temporary PostScript-file
WARNING: AutoColor cannot be processed, because of missing page info
WARNING: Defaulting to \"color\""
fi
if [ "${issorted}" -ne 0 ] ; then
issorted=0
Message "\
WARNING: *** failed to create temporary PostScript-file
WARNING: Sorting cannot be processed, because of missing page info
WARNING: Defaulting to \"color\""
fi
SetAutoColor "color"
fi
fi
# either bundling failed, or just normal course
if [ "${SizeLimit}" -gt 0 ] ; then
Message "\
WARNING: *** must use Bundling=On or
WARNING: *** Color=Sorted|Autoselect|AutoselectRelaxed for Limiting"
fi
Message "DEBUG: calling ${namefilter} directly"
TranslateTo "-"
result=$?
# do final cleanups, just in case we did not get something
[ -n "${tmpdir}" -a -d "${tmpdir}" ] && rm -rf "${tmpdir}"
rm -f "${ALC900FILTERLOCK}"
trap 1 2 3 9 15
if [ "${result}" -eq 0 ] ; then
Message "DEBUG: ${namefilter} DONE!"
else
Message "ERROR: *** ${namefilter} FAILED!"
fi
exit ${result}
Gigabyte GA-EG31M-S2
Intel Core 2 Duo E8400
2x2048 MB DDR II SDRAM PC2-6400
512MB GeF 9600GT TV-Out PCI-E/DVI + ASUS My Cinema P7131
Intel Core 2 Duo E8400
2x2048 MB DDR II SDRAM PC2-6400
512MB GeF 9600GT TV-Out PCI-E/DVI + ASUS My Cinema P7131
-
- Indlæg: 3105
- Tilmeldt: 16. jun 2007, 10:26
- Geografisk sted: Ikast-Herning
Re: Printer vil ikke skrive
Okay.
Du højreklikker på den downloadede tar.gz. Vælg "udpak med arkivhåndtering"
Den åner sig i et vindue og tryk på ikonet "udpak" og vælge, at den skal gemmes på skrivebordet. (ikke nogen ny mappe, det laver den selv)
Så åbnes en terminal fra programmer/tilbehør/terminal og tastes/kopieres
og derefter
Og så skulle resten gå af sig selv.
taget fra install i mappen "alc900-cups-0.20.i386"
Stra
Du højreklikker på den downloadede tar.gz. Vælg "udpak med arkivhåndtering"
Den åner sig i et vindue og tryk på ikonet "udpak" og vælge, at den skal gemmes på skrivebordet. (ikke nogen ny mappe, det laver den selv)
Så åbnes en terminal fra programmer/tilbehør/terminal og tastes/kopieres
Kode: Vælg alt
cd ~/Skrivebord/alc900-cups-0.20.i386
Kode: Vælg alt
./install.sh
Og så skulle resten gå af sig selv.
taget fra install i mappen "alc900-cups-0.20.i386"
To Install the driver,
- unpack the archive
- log in as "root"
- change to the installation directory "alc900-cups-0.20.i386"
- and type
./install.sh
(mind the dot-slash in front!)
The rest should be obvious.
./install.sh --pkg-build
will build an rpm or deb package for your system (also as non-root).
./install.sh --help
will tell you the details.
Stra
stra
Bruger Ubuntu 22.04 og 22.10 + lubuntu 22.10
Bruger Ubuntu 22.04 og 22.10 + lubuntu 22.10
-
- Indlæg: 30
- Tilmeldt: 22. nov 2008, 16:10
- IRC nickname: raketten
Re: Printer vil ikke skrive
Tak!
Det lykkedes!
/raketten
Det lykkedes!
/raketten
Gigabyte GA-EG31M-S2
Intel Core 2 Duo E8400
2x2048 MB DDR II SDRAM PC2-6400
512MB GeF 9600GT TV-Out PCI-E/DVI + ASUS My Cinema P7131
Intel Core 2 Duo E8400
2x2048 MB DDR II SDRAM PC2-6400
512MB GeF 9600GT TV-Out PCI-E/DVI + ASUS My Cinema P7131