1
/* poppler-qt.h: qt interface to poppler
2
* Copyright (C) 2005, Net Integration Technologies, Inc.
3
* Copyright (C) 2005, Tobias Koening <tokoe@kde.org>
4
* Copyright (C) 2005-2007, Albert Astals Cid <aacid@kde.org>
5
* Copyright (C) 2005-2006, Stefan Kebekus <stefan.kebekus@math.uni-koeln.de>
6
* Copyright (C) 2006, Wilfried Huss <Wilfried.Huss@gmx.at>
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2, or (at your option)
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
23
#ifndef __POPPLER_QT_H__
24
#define __POPPLER_QT_H__
26
#include "poppler-link-qt3.h"
27
#include "poppler-page-transition.h"
30
#include <qdatetime.h>
39
/* A rectangle on a page, with coordinates in PDF points. */
43
Rectangle(double x1 = 0, double y1 = 0, double x2 = 0, double y2 = 0) :
44
m_x1(x1), m_y1(y1), m_x2(x2), m_y2(y2) {}
45
bool isNull() const { return m_x1 == 0 && m_y1 == 0 && m_x2 == 0 && m_y2 == 0; }
56
TextBox(const QString& text, const Rectangle &bBox) :
57
m_text(text), m_bBox(bBox) {};
59
QString getText() const { return m_text; };
60
Rectangle getBoundingBox() const { return m_bBox; };
69
Container class for information about a font within a PDF document
90
Create a new font information container
92
FontInfo( const QString &fontName, const bool isEmbedded,
93
const bool isSubset, Type type );
97
FontInfo( const FontInfo &fi );
102
The name of the font. Can be QString::null if the font has no name
104
const QString &name() const;
107
Whether the font is embedded in the file, or not
109
\return true if the font is embedded
111
bool isEmbedded() const;
114
Whether the font provided is only a subset of the full
115
font or not. This only has meaning if the font is embedded.
117
\return true if the font is only a subset
119
bool isSubset() const;
122
The type of font encoding
126
const QString &typeName() const;
134
friend class Document;
137
void renderToPixmap(QPixmap **q, int x, int y, int w, int h, double xres, double yres, bool doLinks = false) const;
140
This is a convenience function that is equivalent to
141
renderToPixmap() with xres and yres set to 72.0. We keep it
142
only for binary compatibility
146
void renderToPixmap(QPixmap **q, int x, int y, int w, int h, bool doLinks = false) const;
149
\brief Render the page to a QImage using the Splash renderer
151
This method can be used to render the page to a QImage. It
152
uses the "Splash" rendering engine.
154
\param xres horizontal resolution of the graphics device,
155
in dots per inch (defaults to 72 dpi)
157
\param yres vertical resolution of the graphics device, in
158
dots per inch (defaults to 72 dpi)
160
\returns a QImage of the page.
164
QImage renderToImage(double xres = 72.0, double yres = 72.0, bool doLinks = false) const;
167
* Returns the size of the page in points
169
QSize pageSize() const;
172
* Returns the text that is inside the Rectangle r
173
* If r is a null Rectangle all text of the page is given
175
QString getText(const Rectangle &r) const;
177
QValueList<TextBox*> textList() const;
180
* Returns the transition of this page
182
PageTransition *getTransition() const;
192
* The orientation of the page
194
Orientation orientation() const;
197
Gets the links of the page once it has been rendered if doLinks was true
199
QValueList<Link*> links() const;
202
Page(const Document *doc, int index);
220
static Document *load(const QString & filePath);
222
Page *getPage(int index) const{ return new Page(this, index); }
224
int getNumPages() const;
226
PageMode getPageMode() const;
228
bool unlock(const QCString &password);
230
bool isLocked() const;
232
QDateTime getDate( const QString & data ) const;
233
QString getInfo( const QString & data ) const;
234
bool isEncrypted() const;
235
bool isLinearized() const;
236
bool okToPrint() const;
237
bool okToChange() const;
238
bool okToCopy() const;
239
bool okToAddNotes() const;
240
double getPDFVersion() const;
242
The version of the PDF specification that the document
245
\param major an optional pointer to a variable where store the
246
"major" number of the version
247
\param minor an optional pointer to a variable where store the
248
"minor" number of the version
252
void getPdfVersion(int *major, int *minor) const;
254
bool print(const QString &fileName, QValueList<int> pageList, double hDPI, double vDPI, int rotate);
256
// If you are using QPrinter you can get paper size doing
257
// QPrinter dummy(QPrinter::PrinterResolution);
258
// dummy.setFullPage(true);
259
// dummy.setPageSize(thePageSizeYouWant);
260
// QPaintDeviceMetrics metrics(&dummy);
261
// int width = metrics.width();
262
// int height = metrics.height();
263
bool print(const QString &fileName, QValueList<int> pageList, double hDPI, double vDPI, int rotate, int paperWidth, int paperHeight);
266
The fonts within the PDF document.
268
\note this can take a very long time to run with a large
269
document. You may wish to use the call below if you have more
272
QValueList<FontInfo> fonts() const;
277
\param numPages the number of pages to scan
278
\param fontList pointer to the list where the font information
281
\return false if the end of the document has been reached
283
bool scanForFonts( int numPages, QValueList<FontInfo> *fontList ) const;
286
Gets the TOC of the Document, it is application responsabiliy to delete
287
it when no longer needed
289
* In the tree the tag name is the 'screen' name of the entry. A tag can have
290
* attributes. Here follows the list of tag attributes with meaning:
291
* - Destination: A string description of the referred destination
292
* - DestinationName: A 'named reference' to the viewport that must be converted
293
* using linkDestination( *destination_name* )
294
* - ExternalFileName: A link to a external filename
296
\returns NULL if the Document does not have TOC
298
QDomDocument *toc() const;
300
LinkDestination *linkDestination( const QString &name );
306
Document(DocumentData *dataA);