After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 599401 - GtkPrint should not rotate context for PDF when printing landscape
GtkPrint should not rotate context for PDF when printing landscape
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Printing
3.3.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
: 622783 (view as bug list)
Depends on:
Blocks: 585442 632660 669456
 
 
Reported: 2009-10-23 13:03 UTC by Adrian Johnson
Modified: 2012-09-12 13:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Don't rotate pdf landscape (4.18 KB, patch)
2009-10-26 12:29 UTC, Adrian Johnson
none Details | Review
Don't rotate pdf landscape (6.93 KB, patch)
2009-10-28 12:05 UTC, Adrian Johnson
none Details | Review
adapted patch to gtk-2-24 branch (6.46 KB, patch)
2010-12-12 12:11 UTC, Hans Breuer
none Details | Review
don't rotate pdf landscape - rebased to git master (7.12 KB, patch)
2010-12-28 09:28 UTC, Adrian Johnson
none Details | Review
don't rotate pdf landscape - rebased to git master (7.11 KB, patch)
2012-03-12 13:06 UTC, Adrian Johnson
none Details | Review
don't rotate pdf landscape (6.94 KB, patch)
2012-09-12 09:50 UTC, Marek Kašík
committed Details | Review

Description Adrian Johnson 2009-10-23 13:03:24 UTC
1. Open gedit and paste in some text
2. Print to PDF in landscape orientation
3. View the PDF in evince

Result:
Page is in portrait orientation with text rotated 90 degrees.

PostScript is the only output format that requires the context to be rotated 90 degrees for landscape printing. Other output formats should swap the width and height values instead of rotating 90 degrees when in landscape orientation.

ie

if (landscape)
  cairo_pdf_surface_create (file, height, width)
else
  cairo_pdf_surface_create (file, width, height)

The context can be rotated 180 degrees for the reverse portrait and reverse landscape orientations.
Comment 1 Adrian Johnson 2009-10-26 12:29:45 UTC
Created attachment 146259 [details] [review]
Don't rotate pdf landscape

Patch to fix this problem.

I found gtk_page_setup_get_paper_width/height to be a better solution than swapping width and height when in landscape orientation.
Comment 2 Adrian Johnson 2009-10-28 12:05:36 UTC
Created attachment 146418 [details] [review]
Don't rotate pdf landscape

The previous patch broke PDF output with reverse portrait/reverse landscape orientation. Fixed in this patch.
Comment 3 Marek Kašík 2009-11-02 17:20:19 UTC
Hi Adrian,

the first page is not rendered correctly when printing landscape to PDF with your last patch (with gtk-demo). The page is cropped.

Marek
Comment 4 Adrian Johnson 2009-11-02 21:20:31 UTC
The cropped page is a cairo bug:

https://bugs.freedesktop.org/show_bug.cgi?id=24691

This occurs because the PDF surface is created in portrait orientation then before the page is rendered the page size is changed to landscape.

It is on our list of blockers to be fixed before cairo 1.10 is released.
https://bugs.freedesktop.org/show_bug.cgi?id=24384
Comment 5 Marek Kašík 2010-10-15 14:03:52 UTC
*** Bug 622783 has been marked as a duplicate of this bug. ***
Comment 6 Hans Breuer 2010-12-12 12:11:36 UTC
Created attachment 176279 [details] [review]
adapted patch to gtk-2-24 branch

Applying the adapted patch to gtk-2-24 resolves two bugs reported against Dia (see blocks). Any objections to commit it?
Comment 7 Adrian Johnson 2010-12-28 09:28:38 UTC
Created attachment 177121 [details] [review]
don't rotate pdf landscape - rebased to git master

I've rebased the patch to git master and successfully tested with cairo 1.10.2
cairo git master. The problem referred to in comment 3 has been fixed in cairo.
Comment 8 Adrian Johnson 2011-07-19 11:28:03 UTC
Are there any issues with this patch that need addressing? The patch still applies.
Comment 9 Adrian Johnson 2012-03-12 13:06:20 UTC
Created attachment 209478 [details] [review]
don't rotate pdf landscape - rebased to git master

Another 12 months has passed. Rebasing to master.
Comment 10 Marek Kašík 2012-09-12 09:50:03 UTC
Created attachment 224089 [details] [review]
don't rotate pdf landscape

Hi Adrian,

thank you for the patch and I'm sorry for the long delay.
I tested the patch and it breaks printing to CUPS printers. It prints landscape-sized page to portrait-sized page when printing to a CUPS printer. The result is that the print is cropped. The problem is easy to fix by checking "manual_orientation" also inside of unix_start_page in the "type == CAIRO_SURFACE_TYPE_PDF" part (current CUPS backend accepts PDFs).

Other than that the patch is ok with me. But since there is hard freeze quite soon I would like to have approval from a core Gtk+ developer. Matthias do you agree with committing this to master now or should we wait after the freeze?

Regards

Marek
Comment 11 Matthias Clasen 2012-09-12 13:18:30 UTC
I'm fine with getting it in this week - your comment indicates that you've done enough testing that we can be confident it works...
Comment 12 Marek Kašík 2012-09-12 13:44:20 UTC
(In reply to comment #11)
> I'm fine with getting it in this week - your comment indicates that you've done
> enough testing that we can be confident it works...

Yes, you are right, I spent quite a lot of time on testing of various printing scenarios this week.
I've committed the patch to the master.

Thanks

Marek