[cairo] Printer orientation bug in Win32
Christoph Lindemann
Christoph.Lindemann at PrintAssociates.com
Tue Feb 22 15:53:16 PST 2011
I have not looked a the Cairo code, so I do not know how it is currently implemented. But I have the following comments:
"DocumentProperties" MUST ALWAYS be called prior to using a DEVMODE structure with the GDI, to ensure a valid version including the private part. Or else the driver might just discard you changes, use whatever it sees fit or fail the job, depending on how forgiving the driver is (which most are, but don't count on it)
Also do not base any assumptions in your code on the setting you provide in the input DEVMODE, the driver might change change settings or fail the call to DocumentProperties depending on the printer capabilities. So if the printer/driver does not support landscape orientation, it might just change the output DEVMODE back to portrait. Always check the the returned DEVMODE.
Use the "GetDeviceCaps" function to get correct information like extends, margins, colors, pixel aspect ratio...
With "DeviceCapabilities" you can retrieve the number of degrees, the landscape orientation is rotated from portrait.
And some printer drivers accept JPEG or PNG directly, you can check for that with "ExtEscape"
If "GNU Win32 API" does not support DocumentProperties, then that is bad.
/christoph
On 22/02/2011, at 06.48, "Ian" <ian at underpressuredivers.com> wrote:
What I'm not sure of is how to fix it. I think that
cairo_win32_printing_surface_create() needs to swap the width/height when
the printer mode is landscape, but I can't find a way to get at that. I
think it is provided by the Windows API DocumentProperties() function, but
DocumentProperties is not supported in the GNU Win32 API.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20110223/b5fd1145/attachment.htm>
More information about the cairo
mailing list