GTK+ printing

I’m just starting to learn about printing in GTK+. The documentation provides a good API reference, but is a bit intimidating, and I didn’t find much in the way of sample code. There’s a sample called “printedit” in libegg, but it is somewhat out of date. I updated it for renamed functions and in one case an added argument, and it seems to basically work. It’s a trivial text editor with printing. It positions the text at the absolute top left corner of the page, which is outside the actual printable area on most printers, so my first challenge will be to add a half-inch margin.

I’m really glad that they used Cairo and Pango for the rendering. I haven’t dealt with writing code to print from a GUI application since the early days of the Macintosh, and that was really ugly.

I haven’t yet tried printing from Windows, but Cody Russell committed patches back in April to make it work. Thanks, Cody!

This entry was posted in Software. Bookmark the permalink.

Leave a Reply