[poppler] Printing with poppler on Windows

Dominic Lachowicz domlachowicz at gmail.com
Wed Feb 6 07:00:58 PST 2008


Hi Peter,

Both the Glib and Qt backends can render directly to GDI.

If you know a little C code, it shouldn't be too hard to:

1) Get the Windows default printer's HDC. See UT_GetDefaultPrinterDC()
in AbiWord's code [1] for how to do that.
2) Create a cairo printing surface for it [2]
3) Load a PopplerDocument using poppler_document_new_from_file()
4) For each PopplerPage in the document, poppler_page_render_for_printing()

Good luck,
Dom

1: http://www.abisource.com/viewvc/abiword/trunk/src/af/util/win/ut_Win32OS.cpp?revision=21481&view=markup
2: http://cgit.freedesktop.org/cairo/tree/src/cairo-win32.h
cairo_win32_printing_surface_create()

On Feb 6, 2008 9:17 AM, Peter Åstrand <astrand at cendio.se> wrote:
>
> I'd like to do the equivalent of "pdftops foo.pdf | lpr" in Windows. That
> is, print foo.pdf on the default printer. I like poppler and would love to
> use it for this task, if possible. But as I understand it, no such tool is
> yet included? Perhaps poppler doesn't even support rendering to GDI at the
> moment?
>
> I've found http://blog.kowalczyk.info/software/sumatrapdf/, and it
> can be invoked with "-print-to-default". However:
>
> * It does not use the normal poppler library, but rather a fork (and in
> newer versions "mupdf" instead).
>
> * It's a GUI application. I'd like a command line one.
>
> * Lots of code. I'd like something small and simple.
>
> Any ideas?
>
> Best regards,
> ---
> Peter Åstrand           ThinLinc Chief Developer
> Cendio AB               http://www.cendio.se
> Wallenbergs gata 4
> 583 30 Linköping        Phone: +46-13-21 46 00
> _______________________________________________
> poppler mailing list
> poppler at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/poppler
>
>



-- 
Counting bodies like sheep to the rhythm of the war drums.


More information about the poppler mailing list