-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpoppler-qt5.h
1779 lines (1380 loc) · 46.2 KB
/
poppler-qt5.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* poppler-qt.h: qt interface to poppler
* Copyright (C) 2005, Net Integration Technologies, Inc.
* Copyright (C) 2005, 2007, Brad Hards <[email protected]>
* Copyright (C) 2005-2013, Albert Astals Cid <[email protected]>
* Copyright (C) 2005, Stefan Kebekus <[email protected]>
* Copyright (C) 2006-2011, Pino Toscano <[email protected]>
* Copyright (C) 2009 Shawn Rutledge <[email protected]>
* Copyright (C) 2010 Suzuki Toshiya <[email protected]>
* Copyright (C) 2010 Matthias Fauconneau <[email protected]>
* Copyright (C) 2011 Andreas Hartmetz <[email protected]>
* Copyright (C) 2011 Glad Deschrijver <[email protected]>
* Copyright (C) 2012, Guillermo A. Amaral B. <[email protected]>
* Copyright (C) 2012, Fabio D'Urso <[email protected]>
* Copyright (C) 2012, Tobias Koenig <[email protected]>
* Copyright (C) 2012, 2014 Adam Reichold <[email protected]>
* Copyright (C) 2012, 2013 Thomas Freitag <[email protected]>
* Copyright (C) 2013 Anthony Granger <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __POPPLER_QT_H__
#define __POPPLER_QT_H__
#include "poppler-annotation.h"
#include "poppler-link.h"
#include "poppler-optcontent.h"
#include "poppler-page-transition.h"
#include <QtCore/QByteArray>
#include <QtCore/QDateTime>
#include <QtCore/QSet>
#include <QtXml/QDomDocument>
#include "poppler-export.h"
class EmbFile;
class Sound;
class AnnotMovie;
/**
The %Poppler Qt5 binding.
*/
namespace Poppler {
class Document;
class DocumentData;
class PageData;
class FormField;
class TextBoxData;
class PDFConverter;
class PSConverter;
/**
Debug/error function.
This function type is used for debugging & error output;
the first parameter is the actual message, the second is the unaltered
closure argument which was passed to the setDebugErrorFunction call.
\since 0.16
*/
typedef void (*PopplerDebugFunc)(const QString & /*message*/, const QVariant & /*closure*/);
/**
Set a new debug/error output function.
If not set, by default error and debug messages will be sent to the
Qt \p qDebug() function.
\param debugFunction the new debug function
\param closure user data which will be passes as-is to the debug function
\since 0.16
*/
POPPLER_QT5_EXPORT void setDebugErrorFunction(PopplerDebugFunc debugFunction, const QVariant &closure);
/**
Describes the physical location of text on a document page
This very simple class describes the physical location of text
on the page. It consists of
- a QString that contains the text
- a QRectF that gives a box that describes where on the page
the text is found.
*/
class POPPLER_QT5_EXPORT TextBox {
friend class Page;
public:
/**
The default constructor sets the \p text and the rectangle that
contains the text. Coordinates for the \p bBox are in points =
1/72 of an inch.
*/
TextBox(const QString& text, const QRectF &bBox);
/**
Destructor.
*/
~TextBox();
/**
Returns the text of this text box
*/
QString text() const;
/**
Returns the position of the text, in point, i.e., 1/72 of
an inch
\since 0.8
*/
QRectF boundingBox() const;
/**
Returns the pointer to the next text box, if there is one.
Otherwise, it returns a null pointer.
*/
TextBox *nextWord() const;
/**
Returns the bounding box of the \p i -th characted of the word.
*/
QRectF charBoundingBox(int i) const;
/**
Returns whether there is a space character after this text box
*/
bool hasSpaceAfter() const;
private:
Q_DISABLE_COPY(TextBox)
TextBoxData *m_data;
};
class FontInfoData;
/**
Container class for information about a font within a PDF
document
*/
class POPPLER_QT5_EXPORT FontInfo {
friend class Document;
public:
/**
The type of font.
*/
enum Type {
unknown,
Type1,
Type1C,
Type1COT,
Type3,
TrueType,
TrueTypeOT,
CIDType0,
CIDType0C,
CIDType0COT,
CIDTrueType,
CIDTrueTypeOT
};
/// \cond PRIVATE
/**
Create a new font information container.
*/
FontInfo();
/**
Create a new font information container.
*/
FontInfo( const FontInfoData &fid );
/// \endcond
/**
Copy constructor.
*/
FontInfo( const FontInfo &fi );
/**
Destructor.
*/
~FontInfo();
/**
The name of the font. Can be QString::null if the font has no name
*/
QString name() const;
/**
The path of the font file used to represent this font on this system,
or a null string is the font is embedded
*/
QString file() const;
/**
Whether the font is embedded in the file, or not
\return true if the font is embedded
*/
bool isEmbedded() const;
/**
Whether the font provided is only a subset of the full
font or not. This only has meaning if the font is embedded.
\return true if the font is only a subset
*/
bool isSubset() const;
/**
The type of font encoding
\return a enumerated value corresponding to the font encoding used
\sa typeName for a string equivalent
*/
Type type() const;
/**
The name of the font encoding used
\note if you are looking for the name of the font (as opposed to the
encoding format used), you probably want name().
\sa type for a enumeration version
*/
QString typeName() const;
/**
Standard assignment operator
*/
FontInfo& operator=( const FontInfo &fi );
private:
FontInfoData *m_data;
};
class FontIteratorData;
/**
Iterator for reading the fonts in a document.
FontIterator provides a Java-style iterator for reading the fonts in a
document.
You can use it in the following way:
\code
Poppler::FontIterator* it = doc->newFontIterator();
while (it->hasNext()) {
QList<Poppler::FontInfo> fonts = it->next();
// do something with the fonts
}
// after doing the job, the iterator must be freed
delete it;
\endcode
\since 0.12
*/
class POPPLER_QT5_EXPORT FontIterator {
friend class Document;
friend class DocumentData;
public:
/**
Destructor.
*/
~FontIterator();
/**
Returns the fonts of the current page and then advances the iterator
to the next page.
*/
QList<FontInfo> next();
/**
Checks whether there is at least one more page to iterate, ie returns
false when the iterator is beyond the last page.
*/
bool hasNext() const;
/**
Returns the current page where the iterator is.
*/
int currentPage() const;
private:
Q_DISABLE_COPY( FontIterator )
FontIterator( int, DocumentData *dd );
FontIteratorData *d;
};
class EmbeddedFileData;
/**
Container class for an embedded file with a PDF document
*/
class POPPLER_QT5_EXPORT EmbeddedFile {
friend class DocumentData;
friend class AnnotationPrivate;
public:
/// \cond PRIVATE
EmbeddedFile(EmbFile *embfile);
/// \endcond
/**
Destructor.
*/
~EmbeddedFile();
/**
The name associated with the file
*/
QString name() const;
/**
The description associated with the file, if any.
This will return an empty QString if there is no description element
*/
QString description() const;
/**
The size of the file.
This will return < 0 if there is no size element
*/
int size() const;
/**
The modification date for the embedded file, if known.
*/
QDateTime modDate() const;
/**
The creation date for the embedded file, if known.
*/
QDateTime createDate() const;
/**
The MD5 checksum of the file.
This will return an empty QByteArray if there is no checksum element.
*/
QByteArray checksum() const;
/**
The MIME type of the file, if known.
\since 0.8
*/
QString mimeType() const;
/**
The data as a byte array
*/
QByteArray data();
/**
Is the embedded file valid?
\since 0.12
*/
bool isValid() const;
/**
A QDataStream for the actual data?
*/
//QDataStream dataStream() const;
private:
Q_DISABLE_COPY(EmbeddedFile)
EmbeddedFile(EmbeddedFileData &dd);
EmbeddedFileData *m_embeddedFile;
};
/**
\brief A page in a document.
The Page class represents a single page within a PDF document.
You cannot construct a Page directly, but you have to use the Document
functions that return a new Page out of an index or a label.
*/
class POPPLER_QT5_EXPORT Page {
friend class Document;
public:
/**
Destructor.
*/
~Page();
/**
The type of rotation to apply for an operation
*/
enum Rotation { Rotate0 = 0, ///< Do not rotate
Rotate90 = 1, ///< Rotate 90 degrees clockwise
Rotate180 = 2, ///< Rotate 180 degrees
Rotate270 = 3 ///< Rotate 270 degrees clockwise (90 degrees counterclockwise)
};
/**
The kinds of page actions
*/
enum PageAction {
Opening, ///< The action when a page is "opened"
Closing ///< The action when a page is "closed"
};
/**
How the text is going to be returned
\since 0.16
*/
enum TextLayout {
PhysicalLayout, ///< The text is layouted to resemble the real page layout
RawOrderLayout ///< The text is returned without any type of processing
};
/**
Additional flags for the renderToPainter method
\since 0.16
*/
enum PainterFlag {
/**
Do not save/restore the caller-owned painter.
renderToPainter() by default preserves, using save() + restore(),
the state of the painter specified; if this is not needed, this
flag can avoid this job
*/
DontSaveAndRestore = 0x00000001
};
Q_DECLARE_FLAGS( PainterFlags, PainterFlag )
/**
Render the page to a QImage using the current
\link Document::renderBackend() Document renderer\endlink.
If \p x = \p y = \p w = \p h = -1, the method will automatically
compute the size of the image from the horizontal and vertical
resolutions specified in \p xres and \p yres. Otherwise, the
method renders only a part of the page, specified by the
parameters (\p x, \p y, \p w, \p h) in pixel coordinates. The returned
QImage then has size (\p w, \p h), independent of the page
size.
\param x specifies the left x-coordinate of the box, in
pixels.
\param y specifies the top y-coordinate of the box, in
pixels.
\param w specifies the width of the box, in pixels.
\param h specifies the height of the box, in pixels.
\param xres horizontal resolution of the graphics device,
in dots per inch
\param yres vertical resolution of the graphics device, in
dots per inch
\param rotate how to rotate the page
\warning The parameter (\p x, \p y, \p w, \p h) are not
well-tested. Unusual or meaningless parameters may lead to
rather unexpected results.
\returns a QImage of the page, or a null image on failure.
\since 0.6
*/
QImage renderToImage(double xres=72.0, double yres=72.0, int x=-1, int y=-1, int w=-1, int h=-1, Rotation rotate = Rotate0) const;
/**
Render the page to the specified QPainter using the current
\link Document::renderBackend() Document renderer\endlink.
If \p x = \p y = \p w = \p h = -1, the method will automatically
compute the size of the page area from the horizontal and vertical
resolutions specified in \p xres and \p yres. Otherwise, the
method renders only a part of the page, specified by the
parameters (\p x, \p y, \p w, \p h) in pixel coordinates.
\param painter the painter to paint on
\param x specifies the left x-coordinate of the box, in
pixels.
\param y specifies the top y-coordinate of the box, in
pixels.
\param w specifies the width of the box, in pixels.
\param h specifies the height of the box, in pixels.
\param xres horizontal resolution of the graphics device,
in dots per inch
\param yres vertical resolution of the graphics device, in
dots per inch
\param rotate how to rotate the page
\param flags additional painter flags
\warning The parameter (\p x, \p y, \p w, \p h) are not
well-tested. Unusual or meaningless parameters may lead to
rather unexpected results.
\returns whether the painting succeeded
\note This method is only supported for Arthur
\since 0.16
*/
bool renderToPainter(QPainter* painter, double xres=72.0, double yres=72.0, int x=-1, int y=-1, int w=-1, int h=-1,
Rotation rotate = Rotate0, PainterFlags flags = 0) const;
/**
Get the page thumbnail if it exists.
\return a QImage of the thumbnail, or a null image
if the PDF does not contain one for this page
\since 0.12
*/
QImage thumbnail() const;
/**
Returns the text that is inside a specified rectangle
\param rect the rectangle specifying the area of interest,
with coordinates given in points, i.e., 1/72th of an inch.
If rect is null, all text on the page is given
\since 0.16
**/
QString text(const QRectF &rect, TextLayout textLayout) const;
/**
Returns the text that is inside a specified rectangle.
The text is returned using the physical layout of the page
\param rect the rectangle specifying the area of interest,
with coordinates given in points, i.e., 1/72th of an inch.
If rect is null, all text on the page is given
**/
QString text(const QRectF &rect) const;
/**
The starting point for a search
*/
enum SearchDirection { FromTop, ///< Start sorting at the top of the document
NextResult, ///< Find the next result, moving "down the page"
PreviousResult ///< Find the previous result, moving "up the page"
};
/**
The type of search to perform
*/
enum SearchMode { CaseSensitive, ///< Case differences cause no match in searching
CaseInsensitive ///< Case differences are ignored in matching
};
/**
Returns true if the specified text was found.
\param text the text the search
\param rectXXX in all directions is used to return where the text was found, for NextResult and PreviousResult
indicates where to continue searching for
\param direction in which direction do the search
\param caseSensitive be case sensitive?
\param rotate the rotation to apply for the search order
\since 0.14
**/
bool search(const QString &text, double &rectLeft, double &rectTop, double &rectRight, double &rectBottom, SearchDirection direction, SearchMode caseSensitive, Rotation rotate = Rotate0) const;
/**
Returns a list of all occurrences of the specified text on the page.
\param text the text to search
\param caseSensitive whether to be case sensitive
\param rotate the rotation to apply for the search order
\warning Do not use the returned QRectF as arguments of another search call because of truncation issues if qreal is defined as float.
\since 0.22
**/
QList<QRectF> search(const QString &text, SearchMode caseSensitive, Rotation rotate = Rotate0) const;
/**
Returns a list of text of the page
This method returns a QList of TextBoxes that contain all
the text of the page, with roughly one text word of text
per TextBox item.
For text written in western languages (left-to-right and
up-to-down), the QList contains the text in the proper
order.
\note The caller owns the text boxes and they should
be deleted when no longer required.
\warning This method is not tested with Asian scripts
*/
QList<TextBox*> textList(Rotation rotate = Rotate0) const;
/**
\return The dimensions (cropbox) of the page, in points (i.e. 1/72th of an inch)
*/
QSizeF pageSizeF() const;
/**
\return The dimensions (cropbox) of the page, in points (i.e. 1/72th of an inch)
*/
QSize pageSize() const;
/**
Returns the transition of this page
\returns a pointer to a PageTransition structure that
defines how transition to this page shall be performed.
\note The PageTransition structure is owned by this page, and will
automatically be destroyed when this page class is
destroyed.
**/
PageTransition *transition() const;
/**
Gets the page action specified, or NULL if there is no action.
\since 0.6
**/
Link *action( PageAction act ) const;
/**
Types of orientations that are possible
*/
enum Orientation {
Landscape, ///< Landscape orientation (portrait, with 90 degrees clockwise rotation )
Portrait, ///< Normal portrait orientation
Seascape, ///< Seascape orientation (portrait, with 270 degrees clockwise rotation)
UpsideDown ///< Upside down orientation (portrait, with 180 degrees rotation)
};
/**
The orientation of the page
*/
Orientation orientation() const;
/**
The default CTM
*/
void defaultCTM(double *CTM, double dpiX, double dpiY, int rotate, bool upsideDown);
/**
Gets the links of the page
*/
QList<Link*> links() const;
/**
Returns the annotations of the page
\note If you call this method twice, you get different objects
pointing to the same annotations (see Annotation).
The caller owns the returned objects and they should be deleted
when no longer required.
*/
QList<Annotation*> annotations() const;
/**
Adds an annotation to the page
\note Ownership of the annotation object stays with the caller, who can
delete it at any time.
\since 0.20
*/
void addAnnotation( const Annotation *ann );
/**
Removes an annotation from the page and destroys the annotation object
\note There mustn't be other Annotation objects pointing this annotation
\since 0.20
*/
void removeAnnotation( const Annotation *ann );
/**
Returns the form fields on the page
The caller gets the ownership of the returned objects.
\since 0.6
*/
QList<FormField*> formFields() const;
/**
Returns the page duration. That is the time, in seconds, that the page
should be displayed before the presentation automatically advances to the next page.
Returns < 0 if duration is not set.
\since 0.6
*/
double duration() const;
/**
Returns the label of the page, or a null string is the page has no label.
\since 0.6
**/
QString label() const;
private:
Q_DISABLE_COPY(Page)
Page(DocumentData *doc, int index);
PageData *m_page;
};
/**
\brief PDF document.
The Document class represents a PDF document: its pages, and all the global
properties, metadata, etc.
\section ownership Ownership of the returned objects
All the functions that returns class pointers create new object, and the
responsability of those is given to the callee.
The only exception is \link Poppler::Page::transition() Page::transition()\endlink.
\section document-loading Loading
To get a Document, you have to load it via the load() & loadFromData()
functions.
In all the functions that have passwords as arguments, they \b must be Latin1
encoded. If you have a password that is a UTF-8 string, you need to use
QString::toLatin1() (or similar) to convert the password first.
If you have a UTF-8 character array, consider converting it to a QString first
(QString::fromUtf8(), or similar) before converting to Latin1 encoding.
\section document-rendering Rendering
To render pages of a document, you have different Document functions to set
various options.
\subsection document-rendering-backend Backends
%Poppler offers a different backends for rendering the pages. Currently
there are two backends (see #RenderBackend), but only the Splash engine works
well and has been tested.
The available rendering backends can be discovered via availableRenderBackends().
The current rendering backend can be changed using setRenderBackend().
Please note that setting a backend not listed in the available ones
will always result in null QImage's.
\section document-cms Color management support
%Poppler, if compiled with this support, provides functions to handle color
profiles.
To know whether the %Poppler version you are using has support for color
management, you can query Poppler::isCmsAvailable(). In case it is not
avilable, all the color management-related functions will either do nothing
or return null.
*/
class POPPLER_QT5_EXPORT Document {
friend class Page;
friend class DocumentData;
public:
/**
The page mode
*/
enum PageMode {
UseNone, ///< No mode - neither document outline nor thumbnail images are visible
UseOutlines, ///< Document outline visible
UseThumbs, ///< Thumbnail images visible
FullScreen, ///< Fullscreen mode (no menubar, windows controls etc)
UseOC, ///< Optional content group panel visible
UseAttach ///< Attachments panel visible
};
/**
The page layout
*/
enum PageLayout {
NoLayout, ///< Layout not specified
SinglePage, ///< Display a single page
OneColumn, ///< Display a single column of pages
TwoColumnLeft, ///< Display the pages in two columns, with odd-numbered pages on the left
TwoColumnRight, ///< Display the pages in two columns, with odd-numbered pages on the right
TwoPageLeft, ///< Display the pages two at a time, with odd-numbered pages on the left
TwoPageRight ///< Display the pages two at a time, with odd-numbered pages on the right
};
/**
The render backends available
\since 0.6
*/
enum RenderBackend {
SplashBackend, ///< Splash backend
ArthurBackend ///< Arthur (Qt) backend
};
/**
The render hints available
\since 0.6
*/
enum RenderHint {
Antialiasing = 0x00000001, ///< Antialiasing for graphics
TextAntialiasing = 0x00000002, ///< Antialiasing for text
TextHinting = 0x00000004, ///< Hinting for text \since 0.12.1
TextSlightHinting = 0x00000008, ///< Lighter hinting for text when combined with TextHinting \since 0.18
OverprintPreview = 0x00000010, ///< Overprint preview \since 0.22
ThinLineSolid = 0x00000020, ///< Enhance thin lines solid \since 0.24
ThinLineShape = 0x00000040 ///< Enhance thin lines shape. Wins over ThinLineSolid \since 0.24
};
Q_DECLARE_FLAGS( RenderHints, RenderHint )
/**
Form types
\since 0.22
*/
enum FormType {
NoForm, ///< Document doesn't contain forms
AcroForm, ///< AcroForm
XfaForm ///< Adobe XML Forms Architecture (XFA), currently unsupported
};
/**
Set a color display profile for the current document.
\param outputProfileA is a \c cmsHPROFILE of the LCMS library.
\since 0.12
*/
void setColorDisplayProfile(void *outputProfileA);
/**
Set a color display profile for the current document.
\param name is the name of the display profile to set.
\since 0.12
*/
void setColorDisplayProfileName(const QString &name);
/**
Return the current RGB profile.
\return a \c cmsHPROFILE of the LCMS library.
\since 0.12
*/
void* colorRgbProfile() const;
/**
Return the current display profile.
\return a \c cmsHPROFILE of the LCMS library.
\since 0.12
*/
void *colorDisplayProfile() const;
/**
Load the document from a file on disk
\param filePath the name (and path, if required) of the file to load
\param ownerPassword the Latin1-encoded owner password to use in
loading the file
\param userPassword the Latin1-encoded user ("open") password
to use in loading the file
\return the loaded document, or NULL on error
\note The caller owns the pointer to Document, and this should
be deleted when no longer required.
\warning The returning document may be locked if a password is required
to open the file, and one is not provided (as the userPassword).
*/
static Document *load(const QString & filePath,
const QByteArray &ownerPassword=QByteArray(),
const QByteArray &userPassword=QByteArray());
/**
Load the document from memory
\param fileContents the file contents. They are copied so there is no need
to keep the byte array around for the full life time of
the document.
\param ownerPassword the Latin1-encoded owner password to use in
loading the file
\param userPassword the Latin1-encoded user ("open") password
to use in loading the file
\return the loaded document, or NULL on error
\note The caller owns the pointer to Document, and this should
be deleted when no longer required.
\warning The returning document may be locked if a password is required
to open the file, and one is not provided (as the userPassword).
\since 0.6
*/
static Document *loadFromData(const QByteArray &fileContents,
const QByteArray &ownerPassword=QByteArray(),
const QByteArray &userPassword=QByteArray());
/**
Get a specified Page
Note that this follows the PDF standard of being zero based - if you
want the first page, then you need an index of zero.
The caller gets the ownership of the returned object.
\param index the page number index
*/
Page *page(int index) const;
/**
\overload
The intent is that you can pass in a label like \c "ix" and
get the page with that label (which might be in the table of
contents), or pass in \c "1" and get the page that the user
expects (which might not be the first page, if there is a
title page and a table of contents).
\param label the page label
*/
Page *page(const QString &label) const;
/**
The number of pages in the document
*/
int numPages() const;
/**
The type of mode that should be used by the application
when the document is opened. Note that while this is
called page mode, it is really viewer application mode.
*/
PageMode pageMode() const;
/**
The layout that pages should be shown in when the document
is first opened. This basically describes how pages are
shown relative to each other.
*/
PageLayout pageLayout() const;
/**
The predominant reading order for text as supplied by
the document's viewer preferences.
\since 0.26
*/
Qt::LayoutDirection textDirection() const;
/**
Provide the passwords required to unlock the document
\param ownerPassword the Latin1-encoded owner password to use in
loading the file
\param userPassword the Latin1-encoded user ("open") password
to use in loading the file
*/
bool unlock(const QByteArray &ownerPassword, const QByteArray &userPassword);
/**
Determine if the document is locked