Poppler Qt5 24.12.0
|
#include <poppler-annotation.h>
Classes | |
class | Popup |
class | Style |
Public Types | |
enum | AdditionalActionType { CursorEnteringAction , CursorLeavingAction , MousePressedAction , MouseReleasedAction , FocusInAction , FocusOutAction , PageOpeningAction , PageClosingAction , PageVisibleAction , PageInvisibleAction } |
enum | Flag { Hidden = 1 , FixedSize = 2 , FixedRotation = 4 , DenyPrint = 8 , DenyWrite = 16 , DenyDelete = 32 , ToggleHidingOnMouse = 64 , External = 128 } |
enum | LineEffect { NoEffect = 1 , Cloudy = 2 } |
enum | LineStyle { Solid = 1 , Dashed = 2 , Beveled = 4 , Inset = 8 , Underline = 16 } |
enum | RevScope { Root = 0 , Reply = 1 , Group = 2 , Delete = 4 } |
enum | RevType { None = 1 , Marked = 2 , Unmarked = 4 , Accepted = 8 , Rejected = 16 , Cancelled = 32 , Completed = 64 } |
enum | SubType { AText = 1 , ALine = 2 , AGeom = 3 , AHighlight = 4 , AStamp = 5 , AInk = 6 , ALink = 7 , ACaret = 8 , AFileAttachment = 9 , ASound = 10 , AMovie = 11 , AScreen = 12 , AWidget = 13 , ARichMedia = 14 , A_BASE = 0 } |
Public Member Functions | |
std::unique_ptr< AnnotationAppearance > | annotationAppearance () const |
QString | author () const |
QRectF | boundary () const |
QString | contents () const |
QDateTime | creationDate () const |
int | flags () const |
QDateTime | modificationDate () const |
Popup | popup () const |
QList< Annotation * > | revisions () const |
RevScope | revisionScope () const |
RevType | revisionType () const |
void | setAnnotationAppearance (const AnnotationAppearance &annotationAppearance) |
void | setAuthor (const QString &author) |
void | setBoundary (const QRectF &boundary) |
void | setContents (const QString &contents) |
void | setCreationDate (const QDateTime &date) |
void | setFlags (int flags) |
void | setModificationDate (const QDateTime &date) |
void | setPopup (const Popup &popup) |
void | setStyle (const Style &style) |
void | setUniqueName (const QString &uniqueName) |
Style | style () const |
virtual SubType | subType () const =0 |
QString | uniqueName () const |
virtual | ~Annotation () |
Annotation class holding properties shared by all annotations.
An Annotation is an object (text note, highlight, sound, popup window, ..) contained by a Page in the document.
Create an Annotation object of the desired subclass (for example TextAnnotation) and set its properties:
Obtain a pointer to the Page where you want to add the annotation (refer to How to use the Poppler Qt5 interface library in three easy steps for instructions) and add the annotation:
You can keep on editing the annotation after it has been added to the page:
When you're done with editing the annotation, you must destroy the Annotation object:
Use the PDFConverter class to save the modified document.
According to the PDF specification, annotations whose Annotation::FixedRotation flag is set must always be shown in their original orientation, no matter what the current rendering rotation or the page's Page::orientation() values are. In comparison with regular annotations, such annotations should therefore be transformed by an extra rotation at rendering time to "undo" such context-related rotations, which is equal to -(rendering_rotation + page_orientation)
. The rotation pivot is the top-left corner of the boundary rectangle.
In practice, Poppler's Page::renderToImage only "unrotates" the page orientation, and does not unrotate the rendering rotation. This ensures consistent renderings at different Page::Rotation values: annotations are always positioned as if they were being positioned at the default page orientation.
Just like regular annotations, Poppler Qt5 exposes normalized coordinates relative to the page's default orientation. However, behind the scenes, the coordinate system is different and Poppler transparently transforms each shape. If you never call either Annotation::setFlags or Annotation::setBoundary, you don't need to worry about this; but if you do call them, then you need to adhere to the following rules:
These two rules are necessary to make Poppler's transparent coordinate conversion work properly.
Describes the flags from an annotations 'AA' dictionary.
This flag is used by the additionalAction() method for ScreenAnnotation and WidgetAnnotation.
Annotation flags.
They can be OR'd together (e.g. Annotation::FixedRotation | Annotation::DenyPrint).
Enumerator | |
---|---|
Hidden | Do not display or print the annotation. |
FixedRotation | Do not rotate the annotation according to page orientation and rendering rotation.
|
DenyPrint | Do not print the annotation. |
Annotation subclasses.
Enumerator | |
---|---|
AText | |
ALine | |
AGeom | |
AHighlight | |
AStamp | |
AInk | |
ALink | |
ACaret | |
AFileAttachment | |
ASound | |
AMovie | |
AScreen |
|
AWidget |
|
ARichMedia |
|
std::unique_ptr< AnnotationAppearance > Poppler::Annotation::annotationAppearance | ( | ) | const |
Returns the current appearance stream of this annotation.
QRectF Poppler::Annotation::boundary | ( | ) | const |
Returns this annotation's boundary rectangle in normalized coordinates.
int Poppler::Annotation::flags | ( | ) | const |
Returns this annotation's flags.
Popup Poppler::Annotation::popup | ( | ) | const |
QList< Annotation * > Poppler::Annotation::revisions | ( | ) | const |
Returns the revisions of this annotation.
RevScope Poppler::Annotation::revisionScope | ( | ) | const |
RevType Poppler::Annotation::revisionType | ( | ) | const |
void Poppler::Annotation::setAnnotationAppearance | ( | const AnnotationAppearance & | annotationAppearance | ) |
Sets the annotation's appearance stream with the annotationAppearance
.
void Poppler::Annotation::setBoundary | ( | const QRectF & | boundary | ) |
Sets this annotation's boundary rectangle.
The boundary rectangle is the smallest rectangle that contains the annotation.
void Poppler::Annotation::setFlags | ( | int | flags | ) |
Sets this annotation's flags.
void Poppler::Annotation::setPopup | ( | const Popup & | popup | ) |
void Poppler::Annotation::setStyle | ( | const Style & | style | ) |
void Poppler::Annotation::setUniqueName | ( | const QString & | uniqueName | ) |
Sets a new unique name for the annotation.
Style Poppler::Annotation::style | ( | ) | const |
|
pure virtual |
The type of the annotation.
Implemented in Poppler::TextAnnotation, Poppler::LineAnnotation, Poppler::GeomAnnotation, Poppler::HighlightAnnotation, Poppler::StampAnnotation, Poppler::InkAnnotation, Poppler::LinkAnnotation, Poppler::CaretAnnotation, Poppler::FileAttachmentAnnotation, Poppler::SoundAnnotation, Poppler::MovieAnnotation, Poppler::ScreenAnnotation, Poppler::WidgetAnnotation, and Poppler::RichMediaAnnotation.