Gtk+ printing support

Today we finally landed the printing branch of gtk+. This means that if you build gtk+ from cvs (what will become 2.10) you get support for page setup and print dialogs.

The actual printing is done through Cairo, which recently has gotten some kick-ass work from Carl Worth on the PDF and postscript backends. On windows cairo draws using GDI, so the native print drivers are used. In fact, on windows you even get the native print dialogs.

From a users perspective there are two new dialogs. First the Page Setup dialog:

This dialog lets you set up the page size, layout and the printer margins. This is enough to let the application lay out pages, and is typically used very early when writing a document.

Then there is the actual print dialog:

You use this when you want to actually print the document. It lets you print to a printer or to a file. It also allows you to set all sorts of settings that control how the print job is handled. Some are generic, like what pages to print, and some are printer-specific like duplex or paper stapling.

This code is now mostly working, but we really need people to test it. So, anyone working on an application that prints, please port your app to this API and give us feedback on it. Its important that we get API feedback early so we can fix it early.

14 Responses to “Gtk+ printing support”

  1. Ploum says:

    Is there any plan to support the mode “brochure” ?

  2. Dave says:

    Why not make the page properties dialog instant apply?

  3. mike says:

    Is it possible to pass a postscript file directly to the printing engine? Gnomeprint didn’t have a public API for this, so pygtk was unable to support this, and I currently have to exec gtklp to print a postscript file to a selectable printer.

  4. Looking the first screenshot I wonder What is the idea to have three orientations? I mean, two differents lanscapes mode. Why the user can’t rotate the paper after printing the page?

    IMHO, only are needed two orientations.

  5. alex says:

    mike: Only if you use the unix-only api. The highlevel portable API can’t do that. (Windows doesn’t handle ps files all that well!)

  6. Rob says:

    would there be any harm from standardizing landscape so that there was just one choice for landscape orientation, with top being normally on what would be the left size of the printout?

  7. aent says:

    What about Print Preview?

  8. Hub says:


    Some ideas I had previously wtr to PDF generation.

    A few things I would love to see in the APIs:

    1/ hooks to input the JPEG/DCT stream to the printing system. That way printing a document with JPEG image to a PDF file will allow to have the JPEG data directly saved compressed. Really appreciated for size when you want to transform your documents to PDF.

    2/ hooks to be able to specify “anchors” and “links”. that we you can generate the ToC links directly.

    That last was already a feature request for gnome-print

  9. Alan Horkan says:

    Looks strange to me to have a dropdown with two lines of text in it. It seems wrong to have only pictures and no labels for the choices Orientation. I’ll probably file bug reports on these later.

  10. Mark Howard says:

    This looks fantastic, thans for all your excellent efforts. I wish I could see the other tabs of the print dialog.
    A few questions:
    - Have you considered a thumbnail style preview? This would help lots with orientation, multiple pages per sheet (which I assume is on a different tab) and things like staple location.
    - How do you save default preferences from the print dialog?
    - Does number of copies really deserve to be on the main page — If I print multiple copies then I usually also want to think about other ‘advanced’ options such as stapling and double sided printing.

    - Why does paper size and orientation have to be separate from the main print dialog? I’ve seen lots of people get annoyed at printing when they open the dialog to print but then have to close it and find another to change the orientation.

  11. Quinten says:

    You also need odd/even printing, for people who don’t have a double-sided printer.

  12. Marc says:

    Great stuff, keep the work!

  13. Teleyinex says:

    Here and here the users have discussed about the print dialog.

    We think that there is a bug that we cannot select when we want to print odd or even pages, like for example in kpdf or another kde app. Is this a bug? Why we cant print in that way? Have you fixed that? Thanks.

  14. Ferocious says:

    Nice :)