G
G
Gleb Igumnov2011-06-28 07:01:07
Qt
Gleb Igumnov, 2011-06-28 07:01:07

Using Win32 version of Poppler-qt4?

I downloaded poppler from windows.kde.org and got two problems.
1. How to make poppler-qt4 static lib? The devel version comes with lib, which is a wrapper for dll (and you don’t want to drag dlls around with you), if you build it yourself in a static library configuration and with the /MT switch, either one still requires a dll at startup.
2. When I try to build an example

#include &lt;poppler-qt4.h&gt;<br/>
<br/>
QString filename;<br/>
Poppler::Document* document = Poppler::Document::load(filename);<br/>
if (!document || document-&gt;isLocked()) {<br/>
 delete document;<br/>
 return;<br/>
}<br/>
if (document == 0) {<br/>
 return;<br/>
}<br/>
Poppler::Page* pdfPage = document-&gt;page(pageNumber); // Document starts at page 0<br/>
if (pdfPage == 0) {<br/>
 return;<br/>
}<br/>
QImage image = pdfPage-&gt;renderToImage();<br/>
if (image.isNull()) {<br/>
 return;<br/>
}<br/>
<br/>
// ... use image ...<br/>
<br/>
// after the usage, the page must be deleted<br/>
delete pdfPage;<br/>
delete document;

the program silently dies on renderToImage(), delete pdfPage, delete document
, while page->text() and page->thumbnail() work fine
Has anyone met this?
Could this be due to the fact that I have one version of Qt statically linked, and Poppler, because it is built dynamically and requires Qt dlls, uses another?
Environment:
Windows 7, MS Visual Studio Professional 2008, Qt 4.7

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
mark_ablov, 2011-06-28
@mark_ablov

1. /MT is responsible for the fact that we link statically standard MS'a libs, and this does not affect Qt in any way. In order to change the type of linking, you need to change the type of the project, and put the Static Library.

G
Gleb Igumnov, 2011-06-28
@CrazySage

I did both

M
MikhailEdoshin, 2011-06-28
@MikhailEdoshin

That is, you build poppleras a static library, then link your project, static Qt and the resulting static poppler, and when you run it crashes, requiring some kind of DLL?
If so, then look through dumpbin /imports( help ) which DLLs your built project imports. If there is some kind of DLL there, look at the build log - there, accordingly, there should also be a static wrapper for this DLL. Or, if there's nothing there, maybe in the sources poppler'a - MS allows you to specify the library at the source level with pragma comment( help). In any case, this static wrapper must be somewhere in the vicinity, otherwise the project would not build. You need to disable it in the project settings - explicitly, or, if it is written in the source code, then through /NODEFAULTLIB:<name>.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question