[cairo] anyone using cairo to print on windows 98?

John Steele Scott (t-tec) john at t-tec.com.au
Fri Jun 2 00:16:13 PDT 2006


Hi,

Recently I have been modifying an aging graphing program to use cairo for
rendering. I have been able to render nicely to screen using GDI, and
produce decent looking PDF files (the compression is not so good, since
most of my output is lines, but that's another story). Yesterday I turned
my attention to printing.

I have been able to get printing quite well on Windows XP by obtaining a HDC
to the printer, and using cairo's win32 backend to draw on it.
Unfortunately,  this does not work on Windows 98. One of the printers I
tested on produced no output at all, and the other one seemed to print
filled rectangles, but no lines (actually it only printed filled rectangles
rendered prior to the first line being stroked).

Digging into it a bit (most GDI functions on Windows 98 do not return errors
via GetLastError(), so cairo's error output is not to be believed), I found
that the first GDI call to fail was CreateDIBSection in
_create_dc_and_bitmap. Apparently this is likely to fail for large bitmaps
on Windows 98 (see
<http://support.microsoft.com/default.aspx?scid=kb;en-us;Q227617>), and
since I'm using the native printer resolution, I am indirectly creating
large bitmaps.

So . . . can anyone suggest a workaround to this?

I think my next approach will be to render to an in memory image, and then
copy that directly to the printer HDC using SetPixel().

I am using the 1.1.6 snapshot.

cheers,

John



More information about the cairo mailing list