Bug 15348

Summary: printing some PDFs from evince is crashing our Xerox printer
Product: cairo Reporter: Sebastien Bacher <seb128>
Component: pdf backendAssignee: Adrian Johnson <ajohnson>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium CC: cmsj, james.troup
Version: 1.5.15   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Fix printer crash

Description Sebastien Bacher 2008-04-04 01:49:18 UTC
The bug has been opened on https://bugs.launchpad.net/ubuntu/+source/poppler/+bug/207776

"We have a Xerox Workcentre 7228 which has been in regular, daily use for the last year.
As people in the office are upgrading to Hardy, the printer is starting to crash quite a lot.

I will shortly be attaching a PDF and the Postscript output from gutsy and hardy to this bug.
Printing this PDF from Gutsy produces a printer error, but the printer continues to function. From Hardy it causes the printer to completely crash (which is clearly a printer bug, but may indicate that poppler is doing something wrong too).

http://launchpadlibrarian.net/12921700/UbuntuDesktop.pdf
PDF that may kill Xerox Workcentre printers  (124.4 KiB, application/pdf)"

The ps generated using evince has some font rendering issue, using the poppler pdftops on the pdf works correctly, that seems to be a cairo issue
Comment 1 Adrian Johnson 2008-04-04 04:37:27 UTC
The file xerox-killer-hardy.ps works for me. ie it displays in ghostscript without errors and prints on my LaserJet 4050.

I couldn't see anything obvious in the file like large fallback images that may be causing a problem.

There are a some things the bug reporter could try:

- Check the CUPS settings. There should be a way to get CUPS to filter the PostScript through ghostscript. This may help as ghostscript has more knowledge about printer limitations than cairo.

- Trim down the PS file to find the smallest set of PostScript commands that crash the printer.

- git bisect cairo to find the commit that started crashing the printer.

I can't see that there is anything I can do unless I can reproduce the problem myself.

The font rendering issues should be all fixed in git.

Comment 2 James Cloos 2008-04-04 09:11:15 UTC
You may want to CC the bug report to Xerox and Adobe.

(AIUI Xerox uses Adobe's RIP.)
Comment 3 Carl Worth 2008-04-04 15:57:36 UTC
As Adrian mentioned above, there's not a lot we can do unless we can
replicate the bad behavior. But we're also quite happy to work with
anyone that can replicate the bad behavior to help us figure out
exactly what in cairo's PostScript output the printer doesn't like.

Sebastien, can you pass some of this information on to the original
reporter and invite them to join the conversation here, (or on the
cairo mailing list), if interested in helping us figure this out? I
couldn't seem to get launchpad to give me a contact address for the
reporter, (maybe I missed it).

Meanwhile, we have seen that there is a bug in the positioning of
glyphs when taking the original UbuntuDesktop.pdf file, and running it
through poppler and cairo to produce a PostScript file. Adrian will
debug that problem in the next day or two. And if we're lucky, a fix
for that might happen to address the problem with the printer.

-Carl

Comment 4 Carl Worth 2008-04-05 23:46:38 UTC
(In reply to comment #3)
> Meanwhile, we have seen that there is a bug in the positioning of
> glyphs when taking the original UbuntuDesktop.pdf file, and running it
> through poppler and cairo to produce a PostScript file. Adrian will
> debug that problem in the next day or two. And if we're lucky, a fix
> for that might happen to address the problem with the printer.

Adrian's fix for that bug has landed now. The underlying causes were
quite involved. See:

	http://gitweb.freedesktop.org/?p=cairo;a=commit;h=0d5902b7167f8cb4bfc96fd813003cd220441151

I don't know if Adrian has any guess as to whether this fix might have
reduced the likelihood of the PostScript file crashing a printer. But
it's definitely worth a shot if the original reporter could try to
replicate the problem with this fix in place. (We'll have a new cairo
snapshot with this fix in it momentarily.)

Thanks again,

-Carl
Comment 5 Sebastien Bacher 2008-04-06 06:07:00 UTC
Thank you for your work on the issue. I can confirm that the current git version fixes the glyph positioning bug, I'll try the people who have the printing issue at the office to try again tomorrow and update the bug 
Comment 6 Sebastien Bacher 2008-04-06 06:08:01 UTC
ups typo in the previous comment ,I'll ask them to try them to try again rather ;-) 
Comment 7 Carl Worth 2008-04-06 09:38:17 UTC
(In reply to comment #5)
> Thank you for your work on the issue. I can confirm that the current git
> version fixes the glyph positioning bug, I'll try the people who have the
> printing issue at the office to try again tomorrow and update the bug 

And the fix is in the 1.5.18 snapshot now, so that might make it even easier for them to test the fix.

-Carl
Comment 8 Chris Jones 2008-04-07 01:42:51 UTC
(I am the original reporter of the Launchpad bug)

Sebastian provided me with a PS produced by cairo git and unfortunately it still hard crashes the printer.

FWIW we have reported this to Xerox and sent them the PS file. They have confirmed it crashes their lab machines and will work on some kind of fix, but there is no ETA and no indication if the fix will be to reject whatever it is that is confusing the printer, or to actually print it.
Comment 9 Adrian Johnson 2008-04-07 01:54:58 UTC
(In reply to comment #8)
> FWIW we have reported this to Xerox and sent them the PS file. They have
> confirmed it crashes their lab machines and will work on some kind of fix, but
> there is no ETA and no indication if the fix will be to reject whatever it is
> that is confusing the printer, or to actually print it.

If they can tell us what it is in the PostScript file that is causing the crash we may be able to implement a workaround.
Comment 10 Chris Jones 2008-04-07 02:29:12 UTC
I have asked the Xerox support engineer I am in contact with if he can get some information for me about what exactly is crashing the printer.
Comment 11 Carl Worth 2008-04-10 13:45:22 UTC
(In reply to comment #8)
> Sebastian provided me with a PS produced by cairo git and unfortunately it
> still hard crashes the printer.
> 
> FWIW we have reported this to Xerox and sent them the PS file. They have
> confirmed it crashes their lab machines and will work on some kind of fix, but
> there is no ETA and no indication if the fix will be to reject whatever it is
> that is confusing the printer, or to actually print it.

Hi Chris,

While we're waiting to hear back from Xerox, there's some more
debugging we can do as well.

First, if you could post for me a cairo-produced PostScript file
(produced after the bugfix described above preferably), then I'll
start pasing that PostScript file around to see if I can find other
people with access to printers which crash with this file.

Also, then the next step, (for someone with access to a crashing
printer), would be to produce as minimal a file as possible that
preserves the crash. This can be done by removing as many elements as
possible within whatever application originally produced the file. And
after that, by manually trimming the PostScript file down. We can help
with the manual-trimming process, but this will go a lot faster if
someone can do that with direct access to a printer, (to verify that
the result after trimming still crashes).

If we can get a truly minimal PostScript file out of that process,
then hopefully we'll be able to find a tweak to it to avoid the crash,
and then put a workaround into cairo for that.

Thanks,

-Carl
Comment 12 Chris Jones 2008-04-11 03:51:17 UTC
Adrian sent a patched version of the postscript to the Launchpad bug which does not crash the printer and also prints properly:

--- xerox-killer-hardy.ps       2008-04-10 13:37:52.000000000 +0100
+++ xerox-killer-hardy-patched.ps       2008-04-11 11:40:50.000000000 +0100
@@ -44,7 +44,7 @@
   } forall
 } bind def
 /Td { moveto } bind def
-/Tm { 6 array astore cairo_font exch selectfont 0 0 moveto } bind def
+/Tm { 6 2 roll 0 0 6 array astore cairo_font exch selectfont moveto } bind def
 /g { setgray } bind def
 /rg { setrgbcolor } bind def
 %%EndProlog
Comment 13 Adrian Johnson 2008-04-11 05:16:39 UTC
Created attachment 15833 [details] [review]
Fix printer crash

The attached patch is the proposed patch to fix the printer crash bug. Please test and confirm that it fixes the crash and PDFs print out correctly with all glyphs correctly positioned.
Comment 14 Chris Jones 2008-04-11 06:04:35 UTC
my testcase no longer crashes the printer, so I believe this patch is good. Thanks very much Adrian!

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.