blob: f5dc6ef30eceb233f5b7d5cecee33587e8be368d [file] [log] [blame]
/**
@mainpage The Poppler Qt4 interface library
The %Poppler Qt4 interface library, libpoppler-qt4, is a library that
allows Qt4 programmers to easily load and render PDF files. The
%Poppler Qt4 interface library uses poppler internally to do its job,
but the Qt4 programmer will never have to worry about poppler
internals.
@section help Current Status
The %Poppler Qt4 interface library is quite stable and working.
@section refimpl Example Programs
Examples programs can be found in the qt4/test directory. The %Poppler
Qt4 interface library is also used in the development version of KDE's
document viewer <a href="http://okular.kde.org">Okular</a>. The source files
for Okular's PDF plugin (%Poppler-based) can be found on the subversion server
of the KDE project, under
<a
href="http://websvn.kde.org/trunk/KDE/kdegraphics/okular/generators/poppler">this
URL</a>.
@section req How to use the Poppler Qt4 interface library in three easy steps
Programmer who would like to use the %Poppler Qt4 interface library
simply need to add the following line to their C++ source files:
@code
#include <poppler-qt4.h>
@endcode
A PDF document can then be loaded as follows:
@code
QString filename;
Poppler::Document* document = Poppler::Document::load(filename);
if (!document || document->isLocked()) {
// ... error message ....
delete document;
return;
}
@endcode
Pages can be rendered to QImages with the following commands:
@code
// Paranoid safety check
if (document == 0) {
// ... error message ...
return;
}
// Access page of the PDF file
Poppler::Page* pdfPage = document->page(pageNumber); // Document starts at page 0
if (pdfPage == 0) {
// ... error message ...
return;
}
// Generate a QImage of the rendered page
QImage image = pdfPage->renderToImage(xres, yres, x, y, width, height);
if (image.isNull()) {
// ... error message ...
return;
}
// ... use image ...
// after the usage, the page must be deleted
delete pdfPage;
@endcode
Finally, don't forget to destroy the document:
@code
delete document;
@endcode
*/