G
G
Gleb Igumnov2011-03-24 12:52:18
Qt
Gleb Igumnov, 2011-03-24 12:52:18

Poppler + Win32 + Qt4 + C++ pdf rendering?

There was a need in the Windows application to render a PDF file, just display the page on the screen. I found the Poppler library, which seems to be able to do this and, in addition, has a qt4 frontend. I downloaded it, sort of compiled it using cmake and visual studio 2008, and got two files at the output - poppler.idb and poppler.lib.
When I try to connect the library in Qt Creator by typing the line into the pro-file
Code:
LIBS+=poppler.lib
I get errors on unresolved external
's, when I try to pick up the poppler dll found on the developer's site, I get the error
Invalid or corrupt file: cannot read at 0x2E0

Accordingly, the question is what am I doing it wrong (if it is suddenly clear from the given facts) or how to understand what I am doing wrong?
I have no experience in using CMake, and I could mess up with building and connecting libraries under Windows. The poppler

call used was taken from the qt forums:
Code:

Poppler::Document *doc = Poppler::Document::load(&quot;D:\\sample.pdf&quot;);<br/>
 QImage image = doc-&gt;page(0)-&gt;renderToImage(<br/>
 physicalDpiX(),<br/>
 physicalDpiY());<br/>
 ui-&gt;label-&gt;setPixmap(QPixmap::fromImage(image));

Answer the question

In order to leave comments, you need to log in

5 answer(s)
P
proDOOMman, 2011-03-24
@proDOOMman

Maybe QtCreator uses mingw as a compiler? The studio and gcc are not good friends with each other, try to assemble something with one

I
ixSci, 2011-03-24
@ixSci

1) Show what unresolved it gives you
2) Check if there are such functions in either using dumpbin
3) Check that when building this poppler, the -Zc:wchar_t- flag is set in the studio project settings. By default, Qt is built with it, but developers often forget to include it in cmake.

S
silvansky, 2011-07-05
@silvansky

Weird.
1. Was the poppler collected statically or dynamically? Well, in the sense, for which linking?
2. If it is static, then there should be a poppler.a file or something like that - and it should link to the program.
3. If dynamically, then popler.dll should have been built as well - it should be slipped into the program. But again, was it dynamically or statically linked with Qt?

Y
YourChief, 2011-03-24
@YourChief

and tried to collect the main project by visual studio and specify this poppler.lib in Additional Dependencies there?

G
Gleb Igumnov, 2011-03-25
@CrazySage

Another question by the way - how good / bad is muPDF? And is there an instruction for using it as a library?)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question