[poppler] Printing with poppler on Windows

Peter Åstrand astrand at cendio.se
Thu Feb 7 01:28:57 PST 2008


On Wed, 6 Feb 2008, Dominic Lachowicz wrote:

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

Hi and thanks for your help. Do you really mean Glib here? I thought Glib 
was pretty low level and didn't deal with graphics at all?


>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()

C is fine, but Poppler and Cairo is new too me. I'll try this path anyway. 
The first step is trying to build the existing tools for Windows, using 
our MinGW cross compile environment. I've basically succeeded, though it 
was a lot of work:

* Build libxml2 
* Build Freetype
* Build Fontconfig
* Build Cairo
* Build poppler

Are all these dependencies really necessary? Does Freetype/Fontconfig work 
well on Windows? 

My current poppler config looks like this:

Building poppler with support for:
  splash output:      no
  cairo output:       yes
  abiword output:     no
  qt wrapper:         no
  qt4 wrapper:        no
  glib wrapper:       no
  use gtk-doc:        no
  use libjpeg:        no
  use zlib:           no
  command line utils: yes

Note that I have "glib wrapper: no". Is this correct? 

I've been able to build poppler and the utils binaries, such as 
pdfinfo.exe and pdfimages.exe. Seems to work. However, when running, I 
get:

 "Fontconfig error: Cannot load default config file"

Is this normal? 

Best regards, 
Peter


>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.


---
Peter Åstrand		ThinLinc Chief Developer
Cendio AB		http://www.cendio.se
Wallenbergs gata 4
583 30 Linköping	Phone: +46-13-21 46 00


More information about the poppler mailing list