Debian Codegraph @

qt5/src/Mainpage.dox

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