1/** 2@mainpage The Poppler Qt5 interface library 3 4The %Poppler Qt5 interface library, libpoppler-qt5, is a library that 5allows Qt5 programmers to easily load and render PDF files. The 6%Poppler Qt5 interface library uses poppler internally to do its job, 7but the Qt5 programmer will never have to worry about poppler 8internals. 9 10 11@section help Current Status 12 13The %Poppler Qt5 interface library is quite stable and working. 14 15@section refimpl Example Programs 16 17Examples programs can be found in the qt5/test directory. The %Poppler 18Qt5 interface library is also used in the KDE's 19document viewer <a href="http://okular.kde.org">Okular</a>. The source files 20for Okular's PDF plugin (%Poppler-based) can be found on the git server 21of the KDE project, under 22<a 23href="http://quickgit.kde.org/?p=okular.git&a=tree&f=generators/poppler">this 24URL</a>. 25 26 27@section req How to use the Poppler Qt5 interface library in three easy steps 28 29Programmer who would like to use the %Poppler Qt5 interface library 30simply need to add the following line to their C++ source files: 31 32@code 33#include <poppler-qt5.h> 34@endcode 35 36A PDF document can then be loaded as follows: 37@code 38QString filename; 39 40Poppler::Document* document = Poppler::Document::load(filename); 41if (!document || document->isLocked()) { 42 43 // ... error message .... 44 45 delete document; 46 return; 47} 48@endcode 49 50Pages can be rendered to QImages with the following commands: 51 52@code 53// Paranoid safety check 54if (document == 0) { 55 // ... error message ... 56 return; 57} 58 59// Access page of the PDF file 60Poppler::Page* pdfPage = document->page(pageNumber); // Document starts at page 0 61if (pdfPage == 0) { 62 // ... error message ... 63 return; 64} 65 66// Generate a QImage of the rendered page 67QImage image = pdfPage->renderToImage(xres, yres, x, y, width, height); 68if (image.isNull()) { 69 // ... error message ... 70 return; 71} 72 73// ... use image ... 74 75// after the usage, the page must be deleted 76delete pdfPage; 77@endcode 78 79Finally, don't forget to destroy the document: 80 81@code 82delete document; 83@endcode 84 */ 85 86