<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>BenV&#039;s notes &#187; cups</title>
	<atom:link href="http://notes.benv.junerules.com/tag/cups/feed/" rel="self" type="application/rss+xml" />
	<link>http://notes.benv.junerules.com</link>
	<description>Rants and notes</description>
	<lastBuildDate>Wed, 28 Jul 2010 13:36:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Linux and a Xerox Phaser 6125N</title>
		<link>http://notes.benv.junerules.com/all/software/linux-and-a-xerox-phaser-6125n/</link>
		<comments>http://notes.benv.junerules.com/all/software/linux-and-a-xerox-phaser-6125n/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 00:35:07 +0000</pubDate>
		<dc:creator>BenV</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[cups]]></category>
		<category><![CDATA[pokemon os]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[xerox]]></category>

		<guid isPermaLink="false">http://notes.benv.junerules.com/?p=579</guid>
		<description><![CDATA[A while ago a friend hinted me of this printer. We were both looking for a somewhat affordable network laser printer, color preferred. However, I was wondering if this thing would work properly under linux. Openprinter claims the device is excellent as a paperweight, so that made me doubtful. So today I took my pokemon [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago a friend hinted me of <a href="http://www.office.xerox.com/product-resources/6125/N/enus.html">this printer</a>. We were both looking for a somewhat affordable network laser printer, color preferred. However, I was wondering if this thing would work properly under linux. <span id="more-579"></span>Openprinter claims the device is excellent as a <a href="http://www.openprinting.org/show_printer.cgi?recnum=Xerox-Phaser_6125">paperweight</a>, so that made me doubtful.<br />
So today I took my pokemon laptop over to his place, and while enjoying a nice glass of excellent 18 year old Glenlivet, we shook cups up and down. And glasses.</p>
<p>The <a href="http://www.linuxquestions.org/questions/linux-hardware-18/xerox-phaser-6125-n-688361/">instructions for ubuntu</a> were a good starting point. I&#8217;ll summarize:</p>
<ol>
<li>Download <a href="http://www.fujixerox.com.au/support/downloaddriver?productId=307&#038;operatingSystemCode=Linux">these drivers for the FX DocuPrint C525A</a>.</li>
<li>Unzip and use <span style="color:#FF00FF">alien</a> to convert the package to a .deb, and install it.
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">benv<span style="color: #000000; font-weight: bold;">@</span>error:<span style="color: #000000; font-weight: bold;">/</span>tmp$ <span style="color: #c20cb9; font-weight: bold;">unzip</span> dpc525a_linux_.0.0.tar.zip; alien Fuji_Xerox-DocuPrint_C525_A_AP-<span style="color: #000000;">1.0</span>-<span style="color: #000000;">1</span>.i386.rpm; <span style="color: #c20cb9; font-weight: bold;">dpkg</span> <span style="color: #660033;">-i</span> fuji-xerox-docuprint-c525-a-ap_1.0-<span style="color: #000000;">2</span>_i386.deb</div></div>
</li>
<li>Go to http://localhost:631/admin and add a new network printer.</li>
<li>Select a protocol (either Jetdirect or LPD) and enter the IP address of the printer</li>
<li>Select the PPD file you installed from the .deb archive (<span style="color:#FFFF00">/usr/share/cups/model/FujiXerox/en/FX_DocuPrint_C525_A_AP.ppd</span>) or select the driver through the menu system</li>
<li>In cups go set the default printer options and make sure to set the optional tray module to <span style="color:#00FFFF">250 Sheet Feeder</span>.</li>
</ol>
<h3>Issues I ran into</h3>
<p>That&#8217;s all pretty default as the linked installation guide says. However, in my first attempt I used the JetDirect protocol on port 9100 (using an IP address, not a hostname). While this worked, everything was dirt slow. Going to the options page of a print dialog took almost a minute!<br />
After some messing around I decided to try other protocols. The other protocol that worked was LPD/LPR. But not only did it work, but it&#8217;s fast! Click *BAF* Bluescreen1!!&#8230; uhh, I mean, print dialog <img src='http://notes.benv.junerules.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
Anyway, instead of using an URI like <em>socket://192.168.1.123:9100</em> simply use <code class="codecolorer bash vibrant"><span class="bash">lpd:<span style="color: #000000; font-weight: bold;">//</span>192.168.1.123:<span style="color: #000000;">515</span></span></code>. Let me repeat this so that people who skip over this post also read it: <span style="color:#FF0000">Use lpd://192.168.1.123:515 instead of socket://blabla, this works a lot faster!</span>.</p>
<p>Once I got the printer in CUPS I also ran into the issue that the printer would respond but give an error on the printer itself. This was because I forgot to properly select the Tray Module, make sure it&#8217;s set to the 250 Feeder like in this picture:<br />
<div id="attachment_586" class="wp-caption alignnone" style="width: 310px"><a href="http://notes.benv.junerules.com/wp-content/uploads/2009/11/xerox-6125-tray-module.png"><img src="http://notes.benv.junerules.com/wp-content/uploads/2009/11/xerox-6125-tray-module-300x181.png" alt="Xerox 6125N tray module selection" title="Xerox 6125N tray module selection" width="300" height="181" class="size-medium wp-image-586" /></a><p class="wp-caption-text">Xerox 6125N tray module selection</p></div></p>
<p>Another issue, cups doesn&#8217;t seem to give all options for this printer in their default options dialog. This is bad, because you need to change the default paper source. Default it&#8217;s set to the bypass tray, which means you have to manually insert the paper when printing. Very annoying. However, using other tools give you more options. Using <span style="color:#FFFF00">system-config-printer</span> for instance gives the chance to change it. Make sure you put it to auto or tray 1 like this:<br />
<div id="attachment_591" class="wp-caption alignnone" style="width: 310px"><a href="http://notes.benv.junerules.com/wp-content/uploads/2009/11/xerox-6125n-paper-source.png"><img src="http://notes.benv.junerules.com/wp-content/uploads/2009/11/xerox-6125n-paper-source-300x155.png" alt="Xerox 6125N Paper source selection" title="Xerox 6125N Paper source selection" width="300" height="155" class="size-medium wp-image-591" /></a><p class="wp-caption-text">Xerox 6125N Paper source selection</p></div></p>
<p>When you finally manage to get those options set, the printer works perfectly under linux.<br />
Have fun printing!</p>
<p>Oh yeah, here&#8217;s a slackware package in case you don&#8217;t want to mess with aliens and pokemon os <img src='http://notes.benv.junerules.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
<a href="http://notes.benv.junerules.com/wp-content/plugins/download-monitor/download.php?id=Fuji_Xerox-DocuPrint_C525_A_AP-1.0-1.i386.tgz" title="Downloaded 24 times">Slackware package for Xerox Phaser 6125N cups driver</a> - Version 1.0 - SHA: 5f8b6478f93a6484d4834990448b152fb10d9cdd</p>
<p>And now, back to my Glenlivet&#8230; mmmmmmm<br />
<div id="attachment_597" class="wp-caption alignnone" style="width: 102px"><a href="http://notes.benv.junerules.com/wp-content/uploads/2009/11/glenlivet-18yo.png"><img src="http://notes.benv.junerules.com/wp-content/uploads/2009/11/glenlivet-18yo.png" alt="Glenlivet 18 year old" title="Glenlivet 18 year old" width="92" height="347" class="size-full wp-image-597" /></a><p class="wp-caption-text">Glenlivet 18 year old</p></div></p>
]]></content:encoded>
			<wfw:commentRss>http://notes.benv.junerules.com/all/software/linux-and-a-xerox-phaser-6125n/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PDF printing and Cups (The Cups Drama &#8482; Part 2!)</title>
		<link>http://notes.benv.junerules.com/all/software/pdf-printing-and-cups-the-cups-drama-tm-part-2/</link>
		<comments>http://notes.benv.junerules.com/all/software/pdf-printing-and-cups-the-cups-drama-tm-part-2/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 14:01:54 +0000</pubDate>
		<dc:creator>BenV</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[cups]]></category>
		<category><![CDATA[printing]]></category>
		<category><![CDATA[slackware]]></category>
		<category><![CDATA[xpdf]]></category>

		<guid isPermaLink="false">http://notes.benv.junerules.com/?p=243</guid>
		<description><![CDATA[Here we are today, trying to do a very simple thing. Print a stupid little PDF document so our customers can pay their bills. Easy huh? Especially after the previous cups drama? So we fire up xpdf on the document, hit the print icon, lpr, GO! *time passes* Mhm, what is it now? *check http://localhost:631* [...]]]></description>
			<content:encoded><![CDATA[<p>Here we are today, trying to do a very simple thing. Print a stupid little PDF document so our customers can pay their bills.<br />
Easy huh? Especially after the <a href="http://notes.benv.junerules.com/software/printing-and-cups/" title="Printing and Cups">previous cups drama</a>?</p>
<p>So we fire up xpdf on the document, hit the print icon, lpr, GO!<br />
*time passes*<br />
Mhm, what is it now?<br />
*check <span style="color:#F00F00">http://localhost:631</span>*<br />
Nope, no document there, seems like it was handled by the printer.<br />
*check cups <span style="color:#F000F0">error_log</span>*<br />
Heaps of garbage there. </p>
<p>Remember that we had this issue left in our previous cups story? Something about PDF printing causing issues?<span id="more-243"></span><br />
Well, since then cups got upgraded to version 1.3.11 and some other stuff too, like ghostscript.<br />
This time the error log showed something like this (only the relevant part here):</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">D <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Aug<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2009</span>:<span style="color: #000000;">14</span>:<span style="color: #000000;">19</span>:<span style="color: #000000;">49</span> +0200<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>Job <span style="color: #000000;">652</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> backendRunLoop<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">print_fd</span>=<span style="color: #000000;">0</span>, <span style="color: #007800;">device_fd</span>=<span style="color: #000000;">5</span>, <span style="color: #007800;">use_bc</span>=<span style="color: #000000;">0</span>, <span style="color: #007800;">side_cb</span>=0x804a23f<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
D <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Aug<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2009</span>:<span style="color: #000000;">14</span>:<span style="color: #000000;">19</span>:<span style="color: #000000;">49</span> +0200<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>Job <span style="color: #000000;">652</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> Wrote <span style="color: #000000;">1</span> pages...<br />
D <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Aug<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2009</span>:<span style="color: #000000;">14</span>:<span style="color: #000000;">19</span>:<span style="color: #000000;">49</span> +0200<span style="color: #7a0874; font-weight: bold;">&#93;</span> PID <span style="color: #000000;">26288</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>cups<span style="color: #000000; font-weight: bold;">/</span>filter<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">pstops</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> exited with no errors.<br />
D <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Aug<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2009</span>:<span style="color: #000000;">14</span>:<span style="color: #000000;">19</span>:<span style="color: #000000;">50</span> +0200<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>Job <span style="color: #000000;">652</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> Error: error occurred at print phase <span style="color: #000000; font-weight: bold;">!!</span><br />
E <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Aug<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2009</span>:<span style="color: #000000;">14</span>:<span style="color: #000000;">19</span>:<span style="color: #000000;">50</span> +0200<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>Job <span style="color: #000000;">652</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> No pages found<span style="color: #000000; font-weight: bold;">!</span><br />
D <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Aug<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2009</span>:<span style="color: #000000;">14</span>:<span style="color: #000000;">19</span>:<span style="color: #000000;">50</span> +0200<span style="color: #7a0874; font-weight: bold;">&#93;</span> Discarding unused printer-state-changed event...<br />
D <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Aug<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2009</span>:<span style="color: #000000;">14</span>:<span style="color: #000000;">19</span>:<span style="color: #000000;">50</span> +0200<span style="color: #7a0874; font-weight: bold;">&#93;</span> Discarding unused job-progress event...<br />
D <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Aug<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2009</span>:<span style="color: #000000;">14</span>:<span style="color: #000000;">19</span>:<span style="color: #000000;">50</span> +0200<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>Job <span style="color: #000000;">652</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> GPL Ghostscript <span style="color: #000000;">8.70</span>: Unrecoverable error, <span style="color: #7a0874; font-weight: bold;">exit</span> code <span style="color: #000000;">1</span><br />
D <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Aug<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2009</span>:<span style="color: #000000;">14</span>:<span style="color: #000000;">19</span>:<span style="color: #000000;">50</span> +0200<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>Job <span style="color: #000000;">652</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #c20cb9; font-weight: bold;">cat</span>: <span style="color: #c20cb9; font-weight: bold;">write</span> error: Broken pipe<br />
D <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Aug<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2009</span>:<span style="color: #000000;">14</span>:<span style="color: #000000;">19</span>:<span style="color: #000000;">50</span> +0200<span style="color: #7a0874; font-weight: bold;">&#93;</span> PID <span style="color: #000000;">26289</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>cups<span style="color: #000000; font-weight: bold;">/</span>filter<span style="color: #000000; font-weight: bold;">/</span>brlpdwrapperdcp135c<span style="color: #7a0874; font-weight: bold;">&#41;</span> exited with no errors.<br />
D <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Aug<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2009</span>:<span style="color: #000000;">14</span>:<span style="color: #000000;">19</span>:<span style="color: #000000;">50</span> +0200<span style="color: #7a0874; font-weight: bold;">&#93;</span> PID <span style="color: #000000;">26299</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>cups<span style="color: #000000; font-weight: bold;">/</span>backend<span style="color: #000000; font-weight: bold;">/</span>usb<span style="color: #7a0874; font-weight: bold;">&#41;</span> exited with no errors.<br />
D <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Aug<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2009</span>:<span style="color: #000000;">14</span>:<span style="color: #000000;">19</span>:<span style="color: #000000;">50</span> +0200<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>Job <span style="color: #000000;">652</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> File <span style="color: #000000;">0</span> is complete.<br />
I <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Aug<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2009</span>:<span style="color: #000000;">14</span>:<span style="color: #000000;">19</span>:<span style="color: #000000;">50</span> +0200<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>Job <span style="color: #000000;">652</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> Completed successfully.</div></div>
<p>Some weird definition of &#8216;successfully&#8217; you have there, cups.<br />
After a few hours of debugging through that error_log, fucking with filters in /usr/share/cups/filters (cursing at Brother for their half baked wrapper scripts), turning on and off debug and log options<br />
I was getting more and more annoyed with it. Considering on how to pick up the Brother DCP-135C and smashing it through the 2nd story window onto the pavement, but then not being<br />
sure if it really was the brother&#8217;s fault at all, I decided to make sure once and for all which one I had to throw through the window.</p>
<p>Time for a manual debug session with the filters again. If you are having trouble with stuff like this, I can commend it to you. The steps I took (after the usual turning on debug and log options etc):</p>
<ol>
<li>Grab your input file, in my case some PDF document which I ran through xpdf.</li>
<li>Instead of sending it to the printer, print using the &#8220;save to file&#8221; option so we have the source that cups has to deal with to work with.</li>
<li>Manually run this file through the filters as cups does. I curse on cups for not being more specific &#8212; EVEN WITH THE <code class="codecolorer bash vibrant"><span class="bash">LogLevel debug2</span></code> OPTION TURNED ON (it just becomes MORE unreadable, but without more information) &#8212; about how it runs these filters, but there are some shell scripts floating around that you can use. What I did was just use
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">strace</span> <span style="color: #660033;">-qfve</span> execve <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">pidof</span> cupsd<span style="color: #000000; font-weight: bold;">`</span> <span style="color: #660033;">-s</span> <span style="color: #000000;">250</span></div></div>
<p>to figure out how my filters were called, but be ready to read tons of output on that one <img src='http://notes.benv.junerules.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
Anyhow, to save you some trouble, the call syntax seems to be</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">filterprogram PRINTER JobNum User title copies documentoptions <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #c20cb9; font-weight: bold;">file</span><span style="color: #7a0874; font-weight: bold;">&#93;</span></div></div>
<p>or a real example from my test case:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>cups<span style="color: #000000; font-weight: bold;">/</span>filter<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">pstops</span> <span style="color: #ff0000;">&quot;DCP135C&quot;</span> <span style="color: #000000;">666</span> benv jemoeder <span style="color: #000000;">1</span> <span style="color: #ff0000;">&quot;document-name=4a93e8d852a17 number-up=1 job-uuid=urn:uuid:873e2907-cf50-35e2-5626-741377b394be&quot;</span> <span style="color: #ff0000;">&quot;/var/spool/cups/d00666-001&quot;</span></div></div>
</li>
<li>Find out which part fails. The pstops had some output that looked fine by me, as far as I can read postscript as it scrolls through my terminal.</li>
</ol>
<p>Funny thing is&#8230;. it seemed to me like pstops worked fine, as did the brother cups wrapper&#8230;.<br />
However, there was still this soab left:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">D <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Aug<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2009</span>:<span style="color: #000000;">15</span>:<span style="color: #000000;">48</span>:<span style="color: #000000;">21</span> +0200<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>Job <span style="color: #000000;">667</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> GPL Ghostscript <span style="color: #000000;">8.70</span>: Unrecoverable error, <span style="color: #7a0874; font-weight: bold;">exit</span> code <span style="color: #000000;">1</span></div></div>
<p>Execution of /usr/bin/gs showed up in strace as well btw, don&#8217;t worry <img src='http://notes.benv.junerules.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
So now the big question was: when did ghostscript become retarded?</p>
<p>I took my &#8220;print to file&#8221; postscript document, and tried opening it in ghostview.<br />
It just looked at me like a cow looks at an oncoming train. Or in its own words:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Error: <span style="color: #000000; font-weight: bold;">/</span>undefined <span style="color: #000000; font-weight: bold;">in</span> ilQ2-amMq3gmMqGPL Ghostscript <span style="color: #000000;">8.70</span>: Unrecoverable error, <span style="color: #7a0874; font-weight: bold;">exit</span> code <span style="color: #000000;">1</span><br />
<br />
Operand stack:<br />
<br />
Execution stack:<br />
&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">%</span>interp_exit &nbsp; .runexec2 &nbsp; <span style="color: #660033;">--nostringval--</span> &nbsp; <span style="color: #660033;">--nostringval--</span> &nbsp; <span style="color: #660033;">--nostringval--</span> &nbsp; <span style="color: #000000;">2</span> &nbsp; <span style="color: #000000; font-weight: bold;">%</span>stopped_push &nbsp; <span style="color: #660033;">--nostringval--</span> &nbsp; <span style="color: #660033;">--nostringval--</span> &nbsp; <span style="color: #660033;">--nostringval--</span> &nbsp; <span style="color: #c20cb9; font-weight: bold;">false</span> &nbsp; <span style="color: #000000;">1</span> &nbsp; <span style="color: #000000; font-weight: bold;">%</span>stopped_push &nbsp; <span style="color: #000000;">1862</span> &nbsp; <span style="color: #000000;">1</span> &nbsp; <span style="color: #000000;">3</span> &nbsp; <span style="color: #000000; font-weight: bold;">%</span>oparray_pop &nbsp; <span style="color: #000000;">1861</span> &nbsp; <span style="color: #000000;">1</span> &nbsp; <span style="color: #000000;">3</span> &nbsp; <span style="color: #000000; font-weight: bold;">%</span>oparray_pop &nbsp; <span style="color: #000000;">1845</span> &nbsp; <span style="color: #000000;">1</span> &nbsp; <span style="color: #000000;">3</span> &nbsp; <span style="color: #000000; font-weight: bold;">%</span>oparray_pop &nbsp; <span style="color: #000000;">1739</span> &nbsp; <span style="color: #000000;">1</span> &nbsp; <span style="color: #000000;">3</span> &nbsp; <span style="color: #000000; font-weight: bold;">%</span>oparray_pop &nbsp; <span style="color: #660033;">--nostringval--</span> &nbsp; <span style="color: #000000; font-weight: bold;">%</span>errorexec_pop &nbsp; .runexec2 &nbsp; <span style="color: #660033;">--nostringval--</span> &nbsp; <span style="color: #660033;">--nostringval--</span> &nbsp; <span style="color: #660033;">--nostringval--</span> &nbsp; <span style="color: #000000;">2</span> &nbsp; <span style="color: #000000; font-weight: bold;">%</span>stopped_push &nbsp; <span style="color: #660033;">--nostringval--</span><br />
Dictionary stack:<br />
&nbsp; &nbsp;--dict:<span style="color: #000000;">1150</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1684</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>ro<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>G<span style="color: #7a0874; font-weight: bold;">&#41;</span>-- &nbsp; --dict:<span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">20</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>G<span style="color: #7a0874; font-weight: bold;">&#41;</span>-- &nbsp; --dict:<span style="color: #000000;">71</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">200</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>L<span style="color: #7a0874; font-weight: bold;">&#41;</span>-- &nbsp; --dict:<span style="color: #000000;">65</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">75</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>L<span style="color: #7a0874; font-weight: bold;">&#41;</span>-- &nbsp; --dict:<span style="color: #000000;">18</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">25</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>L<span style="color: #7a0874; font-weight: bold;">&#41;</span>--<br />
Current allocation mode is <span style="color: #7a0874; font-weight: bold;">local</span><br />
Last OS error: <span style="color: #000000;">11</span></div></div>
<p>Ah-HA!</p>
<p>&#8230;.</p>
<p>What?</p>
<p>Since I&#8217;m by no means an expert on postscript, I googled it. The search revealed that apparently this could be the result of an eps image conversion gone bad.<br />
Postscript doesn&#8217;t like to deal with binary data, so it&#8217;s not supposed to be there.<br />
<span style="color:#FFFF00">This can mean only one thing</span>!<br />
<span style="color:#FF0000">xpdf failed!!!!!!</span></p>
<p>Some testing revealed that xpdf on the old slackware32 chroot environment still does work, and printing the exact same PDF file there works fine, while printing that document from the 64 bit<br />
slackware envrionment fails with the above story. Fascinating. Seems like it isn&#8217;t a library issue though, unless it&#8217;s cleverly hidden in the X libraries. I hope they&#8217;ll fix this soon <img src='http://notes.benv.junerules.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Just for reference, this is the <span style="color:#FF00FF">xpdf-3.02pl3-x86_64-1</span> package that fails.</p>
<p>Well, now that we all know the details we can go to bed.<br />
And if you need to print that pdf document: simply use <span style="color:#00FF00">pdf2ps</span>, it works. (and stay away from habbokrat reader)</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.benv.junerules.com/all/software/pdf-printing-and-cups-the-cups-drama-tm-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Printing and cups</title>
		<link>http://notes.benv.junerules.com/all/software/printing-and-cups/</link>
		<comments>http://notes.benv.junerules.com/all/software/printing-and-cups/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 13:29:06 +0000</pubDate>
		<dc:creator>BenV</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[cups]]></category>
		<category><![CDATA[printing]]></category>
		<category><![CDATA[slackware]]></category>

		<guid isPermaLink="false">http://notes.benv.junerules.com/?p=199</guid>
		<description><![CDATA[We tried to do something that seems fairly simple. &#8220;Print out these tickets for HAR2009&#8220;, where we went last weekend and had a great time The tickets were delivered to me by mail in PDF format. Sounds easy huh? Note that this story was written the day before we went there, just not finished, so [...]]]></description>
			<content:encoded><![CDATA[<p>We tried to do something that seems fairly simple. &#8220;Print out these tickets for <a href="https://wiki.har2009.org/page/Main_Page" title="Hacking At Random 2009">HAR2009</a>&#8220;, where we went last weekend and had a great time <img src='http://notes.benv.junerules.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
The tickets were delivered to me by mail in PDF format. Sounds easy huh?<br />
Note that this story was written the day before we went there, just not finished, so timing might be a bit awkward. Here are the details.<span id="more-199"></span></p>
<p>Attempt 1:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">lpr</span> har_ticket_00.pdf<br />
$</div></div>
<p>Easy. It even works, the printer starts rumbling and out it comes. Oh&#8230;. seems like the barcode is a bit screwed&#8230;. mhm, wonder how it managed to do that. (the rest looked fine).<br />
Browsing through the cups error_log gave some gibberish, this line caught my attention:</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">W [11/Aug/2009:16:58:55 +0200] [Job 624] This document does not conform to the Adobe Document Structuring Conventions and may not print correctly!</div></div>
<p>Mhm, interesting. Google returned a bunch of filter thingies, and I was like &#8220;maybe it&#8217;ll work better if I try converting it to ps myself first&#8221;.<br />
So I ran pdf2ps (instead of pdftops as cups does) and viewed the resulting ps file. Looks a lot better. Print it!<br />
lpr on the file, and out it comes. Huh, no landscape? I try <code class="codecolorer text vibrant"><span class="text">lpr -o landscape stupidfile.ps</span></code> which also does portrait. RAAAH, STUPID KANKER CUPS.<br />
After an hour of google and cursing I said &#8220;Fine, you do it&#8221; to lotjuh, who asked me earlier if she had to do it with her <a href="http://www.adobe.com/nl/products/reader/">Habbokrat Reader</a>&#8230;. what a piece of garbage that is&#8230;.</p>
<p>Anyway, lotjuh soon ran into a new issue. First of all, her new Windows 7 didn&#8217;t have a printer driver, and trying to install the Vista on failed. Our printer is a cheap Brother DCP135C, which isn&#8217;t THAT old I thought. Oh well, that&#8217;s your windows problems for you <img src='http://notes.benv.junerules.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
So she booted to linux. Surprise! Print didn&#8217;t work. That is, it said &#8220;OK&#8221; but out came nothing. Jobs just collected at her local cups.</p>
<p>*grumble*WHYYYYY???</p>
<p>Debugging this is a tough, since none of the logs give any useful information whatsoever, even in debug mode.</p>
<p>To understand this problem you might want some more network background info:<br />
We have our internet through xs4all, who gave us a Fritzbox for that. Since I couldn&#8217;t get it to work like our previous internet setup with the external IP address on our local server,<br />
we eventually decided that the thing could route for us, but we have our own DHCP server running on our local server.<br />
So in our LAN the default gateway is the fritzbox, but our local server has most ports forwarded to it. In order to also run a dns server and dns cache it has multiple IP addresses in our local lan.<br />
In fact, it has 3 IPs in the 192.168.1.x range on a single ethernet device.</p>
<p>Back to cups:<br />
In cupsd.conf I have <code class="codecolorer text vibrant"><span class="text">Listen 192.168.1.1:631</span></code>. That should work, right?<br />
However, BrowseAddress only accepts a .255 at the end, or an @IF statement. So I had @IF(eth_local) there.<br />
Result: clients get confused, try to send data to all 3 IP addresses on the network. And since I can&#8217;t put the primary IP address in the BrowseAddress&#8230;. it fails.<br />
My guess is that cups detects all 3 IP addresses on that interface and happily announces those, while only 1 of them should be used. Especially because of the listen statement.<br />
I fixed this by using the second address, which I conviently have on a &#8216;different&#8217; ethernet device eth_local:0. This seems to work a lot better, the clients now have a single printer in their cups<br />
configuration and it even provides its location!</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Device URI: ipp://192.168.1.2:631/printers/DCP135C</div></div>
<p>instead of the old</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Device URI: file://dev/null</div></div>
<p>However, my first problem was still present. The whining about invalid PDF files. Printing from KWord also gave this error. The local cups would happily forward my job to our server, which then barfed on the thing:</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">D [11/Aug/2009:19:47:17 +0200] [Job 637] Printer using device file &quot;/dev/usblp0&quot;...<br />
D [11/Aug/2009:19:47:17 +0200] Discarding unused printer-state-changed event...<br />
D [11/Aug/2009:19:47:17 +0200] [Job 637] backendRunLoop(print_fd=0, device_fd=5, use_bc=0, side_cb=0x804a23f)<br />
D [11/Aug/2009:19:47:17 +0200] [Job 637] Page = 595x842; 9,9 to 586,833<br />
D [11/Aug/2009:19:47:17 +0200] [Job 637] slow_collate=0, slow_duplex=0, slow_order=1<br />
W [11/Aug/2009:19:47:17 +0200] [Job 637] This document does not conform to the Adobe Document Structuring Conventions and may not print correctly!<br />
D [11/Aug/2009:19:47:17 +0200] Discarding unused printer-state-changed event...<br />
D [11/Aug/2009:19:47:17 +0200] Discarding unused job-progress event...<br />
D [11/Aug/2009:19:47:17 +0200] PID 12180 (/usr/lib/cups/filter/pdftops) exited with no errors.<br />
D [11/Aug/2009:19:47:17 +0200] PID 12181 (/usr/lib/cups/filter/pstops) exited with no errors.<br />
D [11/Aug/2009:19:47:18 +0200] [Job 637] Error: error occurred at print phase !!<br />
E [11/Aug/2009:19:47:18 +0200] [Job 637] No pages found!<br />
D [11/Aug/2009:19:47:18 +0200] Discarding unused printer-state-changed event...<br />
D [11/Aug/2009:19:47:18 +0200] Discarding unused job-progress event...<br />
D [11/Aug/2009:19:47:18 +0200] [Job 637] GPL Ghostscript 8.64: Unrecoverable error, exit code 1</div></div>
<p>&#8230; well, that&#8217;s just lovely.<br />
(insert your curse of the day here).</p>
<p>Oh btw, if anyone ever wonders about the status of their printer and cups and everything:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ lpstat <span style="color: #660033;">-t</span><br />
scheduler is running<br />
system default destination: DCP135C<br />
members of class default:<br />
&nbsp; &nbsp; unknown<br />
members of class printers:<br />
&nbsp; &nbsp; unknown<br />
device <span style="color: #000000; font-weight: bold;">for</span> DCP135C: ipp:<span style="color: #000000; font-weight: bold;">//</span>192.168.1.2:<span style="color: #000000;">631</span><span style="color: #000000; font-weight: bold;">/</span>printers<span style="color: #000000; font-weight: bold;">/</span>DCP135C<br />
device <span style="color: #000000; font-weight: bold;">for</span> default: ipp:<span style="color: #000000; font-weight: bold;">//</span>192.168.1.2:<span style="color: #000000;">631</span><span style="color: #000000; font-weight: bold;">/</span>classes<span style="color: #000000; font-weight: bold;">/</span>default<br />
device <span style="color: #000000; font-weight: bold;">for</span> printers: ipp:<span style="color: #000000; font-weight: bold;">//</span>192.168.1.2:<span style="color: #000000;">631</span><span style="color: #000000; font-weight: bold;">/</span>classes<span style="color: #000000; font-weight: bold;">/</span>printers<br />
DCP135C accepting requests since Tue <span style="color: #000000;">11</span> Aug <span style="color: #000000;">2009</span> 07:<span style="color: #000000;">44</span>:<span style="color: #000000;">45</span> PM CEST<br />
default accepting requests since Tue <span style="color: #000000;">11</span> Aug <span style="color: #000000;">2009</span> 07:<span style="color: #000000;">44</span>:<span style="color: #000000;">46</span> PM CEST<br />
printers accepting requests since Tue <span style="color: #000000;">11</span> Aug <span style="color: #000000;">2009</span> 07:<span style="color: #000000;">44</span>:<span style="color: #000000;">47</span> PM CEST<br />
printer DCP135C is idle. &nbsp;enabled since Tue <span style="color: #000000;">11</span> Aug <span style="color: #000000;">2009</span> 07:<span style="color: #000000;">44</span>:<span style="color: #000000;">45</span> PM CEST<br />
printer default is idle. &nbsp;enabled since Tue <span style="color: #000000;">11</span> Aug <span style="color: #000000;">2009</span> 07:<span style="color: #000000;">44</span>:<span style="color: #000000;">46</span> PM CEST<br />
printer printers is idle. &nbsp;enabled since Tue <span style="color: #000000;">11</span> Aug <span style="color: #000000;">2009</span> 07:<span style="color: #000000;">44</span>:<span style="color: #000000;">47</span> PM CEST</div></div>
<p>So far I haven&#8217;t found a solution for this problem yet, except for a print to file, scp, manually convert, lpr style workaround, but that&#8217;s tedious.<br />
If anyone knows, I&#8217;m interested in the cause and fix for it.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.benv.junerules.com/all/software/printing-and-cups/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
