GTK apps should send PDF to CUPS when printing
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
| Evince |
Expired
|
Wishlist
|
||
| GTK+ |
Fix Released
|
Wishlist
|
||
| evince (Ubuntu) |
Wishlist
|
Ubuntu Desktop Bugs | ||
| gtk+2.0 (Ubuntu) |
Medium
|
Unassigned |
Bug Description
To implement the Blueprint "PDF as standard print job format"
https:/
applications need to output PDF instead of PostScript when printing.
GTK applications still output PostScript. This can be changed by applying a simple patch which is attached.
This makes for example GEdit and GIMP (built-in standard dialog) sending PDF to CUPS.
Other programs, like evince and Firefox still send PostScript. Here there are probably similar patches needed in the applications themselves.
Related branches
Changed in gtk: | |
status: | Unknown → New |
Till Kamppeter (till-kamppeter) wrote : | #3 |
evince and several other applications are not affected by the GTK patch applied here. They need additional patches to output PDF instead of PostScript when printing, perhaps also in the individual applications.
I tried forcing evince to output pdf. It sort of works, but the pdftopdf filter consumes very large amounts of memory on large-ish documents. For a 5 meg pdf file, the resident size of pdftopdf grew to 1.6 gigabytes and the machine was swapping like crazy before I killed the process.
I'm attaching the patch to evince that I used.
It's possible the out-of-memory problems would be alleviated by the patch in http://
Till Kamppeter (till-kamppeter) wrote : | #6 |
Johan, can you try the patch to see whether evince printing works better then? Thanks.
Unfortunately, the patch from the gnome bug didn't help. Evince still produces very large pdf output files for some documents.
Wow. The poppler pdf output seems to be... less than optimal. Running pdfimages on a 3-page pdf that came from the evince "Print preview" functionality gave me 10 000 ppm images. Poppler seems to embed bitmaps into the pdf, one for each character of text.
No wonder the file is huge. Possibly related thread: http://
The reason for the huge files is a bug in Cairo that was fixed very recently. See http://
Would there be any chance of the Cairo fix going into Jaunty? If not, it's probably better to leave Evince as it is.
Sorry, make that "bug in poppler".
Sebastien Bacher (seb128) wrote : | #11 |
the poppler changes are far to be trivial and probably for next cycle rather
Changed in evince: | |
assignee: | nobody → desktop-bugs |
importance: | Undecided → Wishlist |
With Karmic and poppler 0.11, the above patch to make evince output PDF works much better.
The PDF file that evince gives to cups is now just slightly bigger than the original, instead of being a factor of 100 larger, like it was before.
Till Kamppeter (till-kamppeter) wrote : | #13 |
seb128, Poppler is fixed now in Karmic. Could you apply the Evince patch for Karmic's evince? Thanks.
Sebastien Bacher (seb128) wrote : | #14 |
not sure that's something we want to change in a stable serie or a sru candidate
Till Kamppeter (till-kamppeter) wrote : | #15 |
I thought about Karmic.
Sebastien Bacher (seb128) wrote : | #16 |
sorry I read the previous comment too quickly, I will upload after the alpha freeze, could you open an upstream bug about that too?
Till Kamppeter (till-kamppeter) wrote : | #17 |
Upstream bug added: http://
Changed in evince: | |
status: | Unknown → New |
Till Kamppeter (till-kamppeter) wrote : | #18 |
seb128, not that the evince patch is not working correctly. It makes jobs sent to a real printer being sent in PDF, but it also emits PDF if the user prints to a file and chooses PostScript as output format. Probably some additional check is needed.
The patch just papers over the fact that the original check is buggy: file_format is always set to the null string, when it should be "pdf" or "ps".
I'll try to figure out why this happens.
I believe the bug is in this line in ev-print-
file_format = gtk_print_
... but the key GTK_PRINT_
I'm attaching a new patch. If file_format is NULL (which it is for any real printer) or "pdf" (which it is when you select "print to file" and choose pdf as the format), the patch will make evince output pdf.
If file_format is "ps" (which it will only be if you select "print to file" and choose ps as the format), the patch will make evince output postscript.
Here's a slightly updated patch that uses gtk_printer_
Till Kamppeter (till-kamppeter) wrote : | #22 |
Did you test this patch whether it actually works? Does gtk_printer_
Yes, I tested that and it does work. But the patch with gtk_printer_
Till Kamppeter (till-kamppeter) wrote : | #24 |
Thank you for the patches.
There is one possibility to make it even better: It should be checked what the input file format is and if it is the same as the print output format selected by your patch (PDF or PostScript), the input file should be sent directly to CUPS instead of evince re-rendering it.
Bartek (tschew) wrote : | #25 |
Hi Till, I'm only familiar with the pagination parts of ev-print-operation (the re-rendering bit) and not with the initialisation steps so I might be off: As far as I understand gtk-print-operation is used for real printer targets in evince > 2.24 so evince does not do any re-rendering. (for instance, multiple pages per sheet works correctly for a real printer but has a number of bugs when exporting to file)
Except maybe in the case of printing multiple pages per sheet and printer drivers that don't natively support it. (not sure about this though, a quick glance does not reveal any relevant conditionals)
Till Kamppeter (till-kamppeter) wrote : | #26 |
Another suggestion is the following (I do not know whether this is perhaps already implemented):
CUPS has sophisticated page management methods: N-up, selected pages, scale to fit, even/odd pages, ... These work very well if the page management is completely left to CUPS and not a part already done by evince or GTK Print and another part by CUPS. This is important because the page management actions have to be done in the correct order. For example if both 4-up and odd pages are selected, the first sheet should come out with page 1, 2, 3, 4 and the second with page 9, 10, 11, 12. So the N-up has to be done before filtering out every second sheet. For selected page ranges it is different. If the user selects 2-up and wants to print only page 1, 5-10, 16, and 17, he should get the following sheets: 1/5, 6/7, 8/9, 10/16, 17/blank.
So the best would be that in case of printing to a CUPS queue to always send the full document in PDF (the input file if it was already PDF) and the page management options as IPP attributes, as well as the PPD options. Then CUPS will do everything to get the document correctly printed.
Bartek (tschew) wrote : | #27 |
I think the argument against doing what you suggest is that some printer drivers mess up the page management (is this even true? I don't know how cups operates and which part does the pagination.) and the evince guys wanted to produce a write once run everywhere solution.
Using gtk-print-operation the ranges and sheets that you mention should come out correctly (ie printing to a real printer with a recent version of evince), at least they do for me.
As for printing to file (which is known broken for the cases you mention) I have a patch in bug http://
I wrote a test-script (http://
Till Kamppeter (till-kamppeter) wrote : | #28 |
CUPS page management is completely independent of the printer driver. It happens in the pdftopdf filter (in Ubuntu and Debian unstable) or in the pstops filter (all other Linux distros).
Having the page management completely be donme by evince is also no problem, but it must be really completely done by evince, and it must have all functionality of the CUPS page management.
Adding a final, functionally equivalent but slightly cleaned-up version of the patch.
As for punting the page management to CUPS, code just landed in evince that does the page management with gtkprint: http://
So presumably gtk is now the proper place for changing that.
Till Kamppeter (till-kamppeter) wrote : | #30 |
Johan, thank you very much for your patch. It works perfectly. "Print to file" gives the selected file format and printing to a CUPS queue sends PDF. The output fioles are also small and do not have text converted to bitmaps. All is perfect now.
With this patch applied there should be no complaints any more that printing from evince gives bad quality, is too slow, or even does not work at all.
Changed in evince (Ubuntu): | |
status: | New → In Progress |
status: | In Progress → Triaged |
Sebastien Bacher (seb128) wrote : | #31 |
Thank you for your work there, could you add your updated patch to the upstream bug for review?
Changed in evince: | |
status: | New → Fix Released |
Sebastien Bacher (seb128) wrote : | #32 |
the issue is fixed in karmic
Changed in evince (Ubuntu): | |
status: | Triaged → Fix Released |
Changed in evince: | |
importance: | Unknown → Wishlist |
status: | Fix Released → New |
Changed in gtk: | |
importance: | Unknown → Wishlist |
Changed in gtk: | |
status: | New → Fix Released |
Changed in evince: | |
status: | New → Expired |
This bug was fixed in the package gtk+2.0 - 2.14.3-0ubuntu2
---------------
gtk+2.0 (2.14.3-0ubuntu2) intrepid; urgency=low
* debian/ patches/ 061_use_ pdf_as_ default_ printing_ standard. patch:
- launchpad patch to use pdf as default printing standard (lp: #258421)
-- Sebastien Bacher <email address hidden> Thu, 25 Sep 2008 00:47:22 +0200