Bug 13344

Summary: the win32 printing surface is not resizable
Product: cairo Reporter: mehmet yasar <myasar>
Component: win32 backendAssignee: cairo-bugs mailing list <cairo-bugs>
Status: RESOLVED NOTABUG QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium CC: ajohnson
Version: 1.5.2   
Hardware: x86 (IA32)   
OS: Windows (All)   
Whiteboard:
i915 platform: i915 features:

Description mehmet yasar 2007-11-22 03:16:00 UTC
Like PS or PDF surface the win32 printing surface should be resizable (with a function like cairo_win32_printing_surface_set_size).
Comment 1 Adrian Johnson 2008-01-11 04:33:31 UTC
The reason this function is not implemented is because cairo doesn't own the device you are printing to. It just translates the cairo API to GDI calls. It is the responsibility of the application to do all the setup of the Windows device. For example the application needs to call the StartDoc, EndDoc, StartPage, and EndPage functions. 

The recommended way to change the page size is to destroy the cairo_win32_printing surface, use the windows API to change the page size, then create a new cairo_win32_printing surface with the same device handle. This works because the printing surface does not store any document level state. All it does is store the drawing commands you call then when show_page is called or the surface is finished it calls the GDI drawing functions on the device handle you supply to draw the page.

The PS and PDF surfaces have set size because without those functions it would not be possible for an application to change the page size.

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.