Create link annotation

This commit is contained in:
Jakub Melka 2020-03-23 19:10:22 +01:00
parent 35ffc256f3
commit f4bb5c2fa1
8 changed files with 1270 additions and 803 deletions

View File

@ -40,6 +40,14 @@ QObjectList GeneratedCodeStorage::getFunctions() const
void GeneratedCodeStorage::setFunctions(const QObjectList& functions)
{
m_functions = functions;
auto comparator = [](const QObject* left, const QObject* right)
{
const GeneratedFunction* leftFunction = qobject_cast<const GeneratedFunction*>(left);
const GeneratedFunction* rightFunction = qobject_cast<const GeneratedFunction*>(right);
return leftFunction->getFunctionName() < rightFunction->getFunctionName();
};
std::sort(m_functions.begin(), m_functions.end(), comparator);
}
GeneratedFunction* GeneratedCodeStorage::addFunction(const QString& name)

View File

@ -145,7 +145,8 @@ public:
_QRectF,
_QColor,
_QVariant,
_TextAnnotationIcon
_TextAnnotationIcon,
_LinkHighlightMode
};
Q_ENUM(DataType)
@ -352,7 +353,8 @@ public:
{
Structure,
Annotations,
ColorSpace
ColorSpace,
Actions
};
Q_ENUM(FunctionType)

View File

@ -40,6 +40,12 @@ void PDFExamplesGenerator::generateAnnotationsExample()
builder.createAnnotationText(page1, QRectF(250, 300, 24, 24), pdf::TextAnnotationIcon::Note, "Title1", "Subject1", "Note", true);
builder.createAnnotationText(page1, QRectF(250, 350, 24, 24), pdf::TextAnnotationIcon::Paragraph, "Title1", "Subject1", "Paragraph", true);
pdf::PDFObjectReference page2 = builder.appendPage(QRectF(0, 0, 400, 400));
builder.createAnnotationLink(page2, QRectF(50, 50, 200, 50), "www.seznam.cz", pdf::LinkHighlightMode::Invert);
builder.createAnnotationLink(page2, QRectF(50, 150, 200, 50), "www.seznam.cz", pdf::LinkHighlightMode::None);
builder.createAnnotationLink(page2, QRectF(50, 250, 200, 50), "www.seznam.cz", pdf::LinkHighlightMode::Outline);
builder.createAnnotationLink(page2, QRectF(50, 350, 200, 50), "www.seznam.cz", pdf::LinkHighlightMode::Push);
pdf::PDFObjectReference page5 = builder.appendPage(QRectF(0, 0, 400, 400));
builder.createAnnotationSquare(page5, QRectF(50, 50, 50, 50), 3.0, Qt::green, Qt::red, "Title1", "Subject1", "Contents - green filling, red boundary");
builder.createAnnotationSquare(page5, QRectF(50, 150, 50, 50), 3.0, QColor(), Qt::red, "Title2", "Subject2", "Contents - red boundary");

View File

@ -197,14 +197,14 @@ PDFAnnotationPtr PDFAnnotation::parse(const PDFDocument* document, PDFObject obj
}
linkAnnotation->m_previousAction = PDFAction::parse(document, dictionary->get("PA"));
constexpr const std::array<std::pair<const char*, PDFLinkAnnotation::HighlightMode>, 4> highlightMode = {
std::pair<const char*, PDFLinkAnnotation::HighlightMode>{ "N", PDFLinkAnnotation::HighlightMode::None },
std::pair<const char*, PDFLinkAnnotation::HighlightMode>{ "I", PDFLinkAnnotation::HighlightMode::Invert },
std::pair<const char*, PDFLinkAnnotation::HighlightMode>{ "O", PDFLinkAnnotation::HighlightMode::Outline },
std::pair<const char*, PDFLinkAnnotation::HighlightMode>{ "P", PDFLinkAnnotation::HighlightMode::Push }
constexpr const std::array<std::pair<const char*, LinkHighlightMode>, 4> highlightMode = {
std::pair<const char*, LinkHighlightMode>{ "N", LinkHighlightMode::None },
std::pair<const char*, LinkHighlightMode>{ "I", LinkHighlightMode::Invert },
std::pair<const char*, LinkHighlightMode>{ "O", LinkHighlightMode::Outline },
std::pair<const char*, LinkHighlightMode>{ "P", LinkHighlightMode::Push }
};
linkAnnotation->m_highlightMode = loader.readEnumByName(dictionary->get("H"), highlightMode.begin(), highlightMode.end(), PDFLinkAnnotation::HighlightMode::Invert);
linkAnnotation->m_highlightMode = loader.readEnumByName(dictionary->get("H"), highlightMode.begin(), highlightMode.end(), LinkHighlightMode::Invert);
linkAnnotation->m_activationRegion = parseQuadrilaterals(document, dictionary->get("QuadPoints"), annotationsRectangle);
}
else if (subtype == "FreeText")

View File

@ -545,6 +545,14 @@ private:
QString m_stateModel;
};
enum class LinkHighlightMode
{
None,
Invert,
Outline,
Push
};
/// Link annotation represents hypertext link to a destination to elsewhere
/// in the document, or action to be performed.
class PDFLinkAnnotation : public PDFAnnotation
@ -554,16 +562,8 @@ public:
virtual AnnotationType getType() const override { return AnnotationType::Link; }
enum class HighlightMode
{
None,
Invert,
Outline,
Push
};
const PDFAction* getAction() const { return m_action.data(); }
HighlightMode getHighlightMode() const { return m_highlightMode; }
LinkHighlightMode getHighlightMode() const { return m_highlightMode; }
const PDFAction* getURIAction() const { return m_previousAction.data(); }
const PDFAnnotationQuadrilaterals& getActivationRegion() const { return m_activationRegion; }
@ -571,7 +571,7 @@ private:
friend static PDFAnnotationPtr PDFAnnotation::parse(const PDFDocument* document, PDFObject object);
PDFActionPtr m_action;
HighlightMode m_highlightMode = HighlightMode::Invert;
LinkHighlightMode m_highlightMode = LinkHighlightMode::Invert;
PDFActionPtr m_previousAction;
PDFAnnotationQuadrilaterals m_activationRegion;
};

View File

@ -64,6 +64,42 @@ void PDFObjectFactory::endDictionaryItem()
std::get<PDFDictionary>(dictionaryItem.object).addEntry(qMove(topItem.itemName), qMove(std::get<PDFObject>(topItem.object)));
}
PDFObjectFactory& PDFObjectFactory::operator<<(LinkHighlightMode mode)
{
switch (mode)
{
case LinkHighlightMode::None:
{
*this << WrapName("N");
break;
}
case LinkHighlightMode::Invert:
{
*this << WrapName("I");
break;
}
case LinkHighlightMode::Outline:
{
*this << WrapName("O");
break;
}
case LinkHighlightMode::Push:
{
*this << WrapName("P");
break;
}
default:
Q_ASSERT(false);
break;
}
return *this;
}
PDFObjectFactory& PDFObjectFactory::operator<<(TextAnnotationIcon icon)
{
switch (icon)
@ -374,7 +410,59 @@ PDFInteger PDFDocumentBuilder::getPageTreeRootChildCount() const
/* START GENERATED CODE */
PDFObjectReference PDFDocumentBuilder::createAnnotationSquare(PDFObjectReference page,
PDFObjectReference PDFDocumentBuilder::appendPage(QRectF mediaBox)
{
PDFObjectFactory objectBuilder;
objectBuilder.beginDictionary();
objectBuilder.beginDictionaryItem("Type");
objectBuilder << WrapName("Page");
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("Parent");
objectBuilder << getPageTreeRoot();
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionary();
objectBuilder.endDictionary();
objectBuilder.beginDictionaryItem("MediaBox");
objectBuilder << mediaBox;
objectBuilder.endDictionaryItem();
objectBuilder.endDictionary();
PDFObjectReference pageReference = addObject(objectBuilder.takeObject());
objectBuilder.beginDictionary();
objectBuilder.beginDictionaryItem("Kids");
objectBuilder << std::initializer_list<PDFObjectReference>{ pageReference };
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("Count");
objectBuilder << getPageTreeRootChildCount() + 1;
objectBuilder.endDictionaryItem();
objectBuilder.endDictionary();
PDFObject updatedTreeRoot = objectBuilder.takeObject();
appendTo(getPageTreeRoot(), updatedTreeRoot);
return pageReference;
}
PDFObjectReference PDFDocumentBuilder::createActionURI(QString URL)
{
PDFObjectFactory objectBuilder;
objectBuilder.beginDictionary();
objectBuilder.beginDictionaryItem("Type");
objectBuilder << WrapName("Action");
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("S");
objectBuilder << WrapName("URI");
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("URI");
objectBuilder << URL;
objectBuilder.endDictionaryItem();
objectBuilder.endDictionary();
PDFObjectReference actionReference = addObject(objectBuilder.takeObject());
return actionReference;
}
PDFObjectReference PDFDocumentBuilder::createAnnotationCircle(PDFObjectReference page,
QRectF rectangle,
PDFReal borderWidth,
QColor fillColor,
@ -386,8 +474,11 @@ PDFObjectReference PDFDocumentBuilder::createAnnotationSquare(PDFObjectReference
PDFObjectFactory objectBuilder;
objectBuilder.beginDictionary();
objectBuilder.beginDictionaryItem("Type");
objectBuilder << WrapName("Annot");
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("Subtype");
objectBuilder << WrapName("Square");
objectBuilder << WrapName("Circle");
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("Rect");
objectBuilder << rectangle;
@ -447,6 +538,58 @@ PDFObjectReference PDFDocumentBuilder::createAnnotationSquare(PDFObjectReference
}
PDFObjectReference PDFDocumentBuilder::createAnnotationLink(PDFObjectReference page,
QRectF linkRectangle,
PDFObjectReference action,
LinkHighlightMode highlightMode)
{
PDFObjectFactory objectBuilder;
objectBuilder.beginDictionary();
objectBuilder.beginDictionaryItem("Type");
objectBuilder << WrapName("Annot");
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("Subtype");
objectBuilder << WrapName("Link");
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("P");
objectBuilder << page;
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("Rect");
objectBuilder << linkRectangle;
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("A");
objectBuilder << action;
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("H");
objectBuilder << highlightMode;
objectBuilder.endDictionaryItem();
objectBuilder.endDictionary();
PDFObjectReference annotationReference = addObject(objectBuilder.takeObject());
objectBuilder.beginDictionary();
objectBuilder.beginDictionaryItem("Annots");
objectBuilder.beginArray();
objectBuilder << annotationReference;
objectBuilder.endArray();
objectBuilder.endDictionaryItem();
objectBuilder.endDictionary();
PDFObject pageAnnots = objectBuilder.takeObject();
appendTo(page, pageAnnots);
return annotationReference;
}
PDFObjectReference PDFDocumentBuilder::createAnnotationLink(PDFObjectReference page,
QRectF linkRectangle,
QString URL,
LinkHighlightMode highlightMode)
{
PDFObjectFactory objectBuilder;
return createAnnotationLink(page, linkRectangle, createActionURI(URL), highlightMode);
}
PDFObjectReference PDFDocumentBuilder::createAnnotationPopup(PDFObjectReference page,
PDFObjectReference parentAnnotation,
QRectF rectangle,
@ -455,6 +598,9 @@ PDFObjectReference PDFDocumentBuilder::createAnnotationPopup(PDFObjectReference
PDFObjectFactory objectBuilder;
objectBuilder.beginDictionary();
objectBuilder.beginDictionaryItem("Type");
objectBuilder << WrapName("Annot");
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("Subtype");
objectBuilder << WrapName("Popup");
objectBuilder.endDictionaryItem();
@ -476,130 +622,7 @@ PDFObjectReference PDFDocumentBuilder::createAnnotationPopup(PDFObjectReference
}
PDFObjectReference PDFDocumentBuilder::createCatalog()
{
PDFObjectFactory objectBuilder;
objectBuilder.beginDictionary();
objectBuilder.beginDictionaryItem("Type");
objectBuilder << WrapName("Catalog");
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("Pages");
objectBuilder << createCatalogPageTreeRoot();
objectBuilder.endDictionaryItem();
objectBuilder.endDictionary();
PDFObjectReference catalogReference = addObject(objectBuilder.takeObject());
return catalogReference;
}
PDFObject PDFDocumentBuilder::createTrailerDictionary(PDFObjectReference catalog)
{
PDFObjectFactory objectBuilder;
objectBuilder.beginDictionary();
objectBuilder.beginDictionaryItem("Size");
objectBuilder << 1;
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("Root");
objectBuilder << catalog;
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("Info");
objectBuilder.beginDictionary();
objectBuilder.beginDictionaryItem("Producer");
objectBuilder << getProducerString();
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("CreationDate");
objectBuilder << WrapCurrentDateTime();
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("ModDate");
objectBuilder << WrapCurrentDateTime();
objectBuilder.endDictionaryItem();
objectBuilder.endDictionary();
objectBuilder.endDictionaryItem();
objectBuilder.endDictionary();
PDFObject trailerDictionary = objectBuilder.takeObject();
return trailerDictionary;
}
void PDFDocumentBuilder::updateTrailerDictionary(PDFInteger objectCount)
{
PDFObjectFactory objectBuilder;
objectBuilder.beginDictionary();
objectBuilder.beginDictionaryItem("Size");
objectBuilder << objectCount;
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("Info");
objectBuilder.beginDictionary();
objectBuilder.beginDictionaryItem("Producer");
objectBuilder << getProducerString();
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("ModDate");
objectBuilder << WrapCurrentDateTime();
objectBuilder.endDictionaryItem();
objectBuilder.endDictionary();
objectBuilder.endDictionaryItem();
objectBuilder.endDictionary();
PDFObject trailerDictionary = objectBuilder.takeObject();
m_storage.updateTrailerDictionary(qMove(trailerDictionary));
}
PDFObjectReference PDFDocumentBuilder::appendPage(QRectF mediaBox)
{
PDFObjectFactory objectBuilder;
objectBuilder.beginDictionary();
objectBuilder.beginDictionaryItem("Type");
objectBuilder << WrapName("Page");
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("Parent");
objectBuilder << getPageTreeRoot();
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionary();
objectBuilder.endDictionary();
objectBuilder.beginDictionaryItem("MediaBox");
objectBuilder << mediaBox;
objectBuilder.endDictionaryItem();
objectBuilder.endDictionary();
PDFObjectReference pageReference = addObject(objectBuilder.takeObject());
objectBuilder.beginDictionary();
objectBuilder.beginDictionaryItem("Kids");
objectBuilder << std::initializer_list<PDFObjectReference>{ pageReference };
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("Count");
objectBuilder << getPageTreeRootChildCount() + 1;
objectBuilder.endDictionaryItem();
objectBuilder.endDictionary();
PDFObject updatedTreeRoot = objectBuilder.takeObject();
appendTo(getPageTreeRoot(), updatedTreeRoot);
return pageReference;
}
PDFObjectReference PDFDocumentBuilder::createCatalogPageTreeRoot()
{
PDFObjectFactory objectBuilder;
objectBuilder.beginDictionary();
objectBuilder.beginDictionaryItem("Type");
objectBuilder << WrapName("Pages");
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("Kids");
objectBuilder << WrapEmptyArray();
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("Count");
objectBuilder << 0;
objectBuilder.endDictionaryItem();
objectBuilder.endDictionary();
PDFObjectReference pageTreeRoot = addObject(objectBuilder.takeObject());
return pageTreeRoot;
}
PDFObjectReference PDFDocumentBuilder::createAnnotationCircle(PDFObjectReference page,
PDFObjectReference PDFDocumentBuilder::createAnnotationSquare(PDFObjectReference page,
QRectF rectangle,
PDFReal borderWidth,
QColor fillColor,
@ -611,8 +634,11 @@ PDFObjectReference PDFDocumentBuilder::createAnnotationCircle(PDFObjectReference
PDFObjectFactory objectBuilder;
objectBuilder.beginDictionary();
objectBuilder.beginDictionaryItem("Type");
objectBuilder << WrapName("Annot");
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("Subtype");
objectBuilder << WrapName("Circle");
objectBuilder << WrapName("Square");
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("Rect");
objectBuilder << rectangle;
@ -683,6 +709,9 @@ PDFObjectReference PDFDocumentBuilder::createAnnotationText(PDFObjectReference p
PDFObjectFactory objectBuilder;
objectBuilder.beginDictionary();
objectBuilder.beginDictionaryItem("Type");
objectBuilder << WrapName("Annot");
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("Subtype");
objectBuilder << WrapName("Text");
objectBuilder.endDictionaryItem();
@ -741,6 +770,97 @@ PDFObjectReference PDFDocumentBuilder::createAnnotationText(PDFObjectReference p
}
PDFObjectReference PDFDocumentBuilder::createCatalog()
{
PDFObjectFactory objectBuilder;
objectBuilder.beginDictionary();
objectBuilder.beginDictionaryItem("Type");
objectBuilder << WrapName("Catalog");
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("Pages");
objectBuilder << createCatalogPageTreeRoot();
objectBuilder.endDictionaryItem();
objectBuilder.endDictionary();
PDFObjectReference catalogReference = addObject(objectBuilder.takeObject());
return catalogReference;
}
PDFObjectReference PDFDocumentBuilder::createCatalogPageTreeRoot()
{
PDFObjectFactory objectBuilder;
objectBuilder.beginDictionary();
objectBuilder.beginDictionaryItem("Type");
objectBuilder << WrapName("Pages");
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("Kids");
objectBuilder << WrapEmptyArray();
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("Count");
objectBuilder << 0;
objectBuilder.endDictionaryItem();
objectBuilder.endDictionary();
PDFObjectReference pageTreeRoot = addObject(objectBuilder.takeObject());
return pageTreeRoot;
}
PDFObject PDFDocumentBuilder::createTrailerDictionary(PDFObjectReference catalog)
{
PDFObjectFactory objectBuilder;
objectBuilder.beginDictionary();
objectBuilder.beginDictionaryItem("Size");
objectBuilder << 1;
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("Root");
objectBuilder << catalog;
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("Info");
objectBuilder.beginDictionary();
objectBuilder.beginDictionaryItem("Producer");
objectBuilder << getProducerString();
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("CreationDate");
objectBuilder << WrapCurrentDateTime();
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("ModDate");
objectBuilder << WrapCurrentDateTime();
objectBuilder.endDictionaryItem();
objectBuilder.endDictionary();
objectBuilder.endDictionaryItem();
objectBuilder.endDictionary();
PDFObject trailerDictionary = objectBuilder.takeObject();
return trailerDictionary;
}
void PDFDocumentBuilder::updateTrailerDictionary(PDFInteger objectCount)
{
PDFObjectFactory objectBuilder;
objectBuilder.beginDictionary();
objectBuilder.beginDictionaryItem("Size");
objectBuilder << objectCount;
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("Info");
objectBuilder.beginDictionary();
objectBuilder.beginDictionaryItem("Producer");
objectBuilder << getProducerString();
objectBuilder.endDictionaryItem();
objectBuilder.beginDictionaryItem("ModDate");
objectBuilder << WrapCurrentDateTime();
objectBuilder.endDictionaryItem();
objectBuilder.endDictionary();
objectBuilder.endDictionaryItem();
objectBuilder.endDictionary();
PDFObject trailerDictionary = objectBuilder.takeObject();
m_storage.updateTrailerDictionary(qMove(trailerDictionary));
}
/* END GENERATED CODE */
} // namespace pdf

View File

@ -79,6 +79,7 @@ public:
PDFObjectFactory& operator<<(QString textString);
PDFObjectFactory& operator<<(WrapEmptyArray);
PDFObjectFactory& operator<<(TextAnnotationIcon icon);
PDFObjectFactory& operator<<(LinkHighlightMode mode);
/// Treat containers - write them as array
template<typename Container, typename ValueType = decltype(*std::begin(std::declval<Container>()))>
@ -182,68 +183,14 @@ public:
/* START GENERATED CODE */
/// Square annotation displays rectangle (or square). When opened, they display pop-up window
/// containing the text of associated note (and window title). Square border/fill color can be defined,
/// along with border width.
/// \param page Page to which is annotation added
/// \param rectangle Area in which is rectangle displayed
/// \param borderWidth Width of the border line of rectangle
/// \param fillColor Fill color of rectangle (interior color). If you do not want to have area color filled,
/// then use invalid QColor.
/// \param strokeColor Stroke color (color of the rectangle border). If you do not want to have a
/// border, then use invalid QColor.
/// \param title Title (it is displayed as title of popup window)
/// \param subject Subject (short description of the subject being adressed by the annotation)
/// \param contents Contents (text displayed, for example, in the marked annotation dialog)
PDFObjectReference createAnnotationSquare(PDFObjectReference page,
QRectF rectangle,
PDFReal borderWidth,
QColor fillColor,
QColor strokeColor,
QString title,
QString subject,
QString contents);
/// Creates a new popup annotation on the page. Popup annotation is represented usually by floating
/// window, which can be opened, or closed. Popup annotation is associated with parent annotation,
/// which can be usually markup annotation. Popup annotation displays parent annotation's texts, for
/// example, title, comment, date etc.
/// \param page Page to which is annotation added
/// \param parentAnnotation Parent annotation (for which is popup window displayed)
/// \param rectangle Area on the page, where popup window appears
/// \param opened Is the window opened?
PDFObjectReference createAnnotationPopup(PDFObjectReference page,
PDFObjectReference parentAnnotation,
QRectF rectangle,
bool opened);
/// Creates empty catalog. This function is used, when a new document is being created. Do not call
/// this function manually.
PDFObjectReference createCatalog();
/// This function is used to create a new trailer dictionary, when blank document is created. Do not
/// call this function manually.
/// \param catalog Reference to document catalog
PDFObject createTrailerDictionary(PDFObjectReference catalog);
/// This function is used to update trailer dictionary. Must be called each time the final document is
/// being built.
/// \param objectCount Number of objects (including empty ones)
void updateTrailerDictionary(PDFInteger objectCount);
/// Appends a new page after last page.
/// \param mediaBox Media box of the page (size of paper)
PDFObjectReference appendPage(QRectF mediaBox);
/// Creates page tree root for the catalog. This function is only called when new document is being
/// created. Do not call this function manually.
PDFObjectReference createCatalogPageTreeRoot();
/// Creates URI action.
/// \param URL Target URL
PDFObjectReference createActionURI(QString URL);
/// Circle annotation displays ellipse (or circle). When opened, they display pop-up window containing
@ -269,6 +216,69 @@ public:
QString contents);
/// Creates new link annotation. It usually represents clickable hypertext link. User can also specify
/// action, which can be executed, for example, link can be also in the PDF document (link to some
/// location in document).
/// \param page Page to which is annotation added
/// \param linkRectangle Link rectangle
/// \param action Action to be performed when user clicks on a link
/// \param highlightMode Highlight mode
PDFObjectReference createAnnotationLink(PDFObjectReference page,
QRectF linkRectangle,
PDFObjectReference action,
LinkHighlightMode highlightMode);
/// Creates new link annotation. It usually represents clickable hypertext link. User can also specify
/// action, which can be executed, for example, link can be also in the PDF document (link to some
/// location in document).
/// \param page Page to which is annotation added
/// \param linkRectangle Link rectangle
/// \param URL URL to be launched when user clicks on the link
/// \param highlightMode Highlight mode
PDFObjectReference createAnnotationLink(PDFObjectReference page,
QRectF linkRectangle,
QString URL,
LinkHighlightMode highlightMode);
/// Creates a new popup annotation on the page. Popup annotation is represented usually by floating
/// window, which can be opened, or closed. Popup annotation is associated with parent annotation,
/// which can be usually markup annotation. Popup annotation displays parent annotation's texts, for
/// example, title, comment, date etc.
/// \param page Page to which is annotation added
/// \param parentAnnotation Parent annotation (for which is popup window displayed)
/// \param rectangle Area on the page, where popup window appears
/// \param opened Is the window opened?
PDFObjectReference createAnnotationPopup(PDFObjectReference page,
PDFObjectReference parentAnnotation,
QRectF rectangle,
bool opened);
/// Square annotation displays rectangle (or square). When opened, they display pop-up window
/// containing the text of associated note (and window title). Square border/fill color can be defined,
/// along with border width.
/// \param page Page to which is annotation added
/// \param rectangle Area in which is rectangle displayed
/// \param borderWidth Width of the border line of rectangle
/// \param fillColor Fill color of rectangle (interior color). If you do not want to have area color filled,
/// then use invalid QColor.
/// \param strokeColor Stroke color (color of the rectangle border). If you do not want to have a
/// border, then use invalid QColor.
/// \param title Title (it is displayed as title of popup window)
/// \param subject Subject (short description of the subject being adressed by the annotation)
/// \param contents Contents (text displayed, for example, in the marked annotation dialog)
PDFObjectReference createAnnotationSquare(PDFObjectReference page,
QRectF rectangle,
PDFReal borderWidth,
QColor fillColor,
QColor strokeColor,
QString title,
QString subject,
QString contents);
/// Creates text annotation. Text annotation is "sticky note" attached to a point in the PDF document.
/// When closed, it is displayed as icon, if opened, widget appears with attached text. Text annotations
/// do not scale or rotate, they appear independent of zoom/rotate. So, they behave as if flags
@ -289,6 +299,28 @@ public:
bool open);
/// Creates empty catalog. This function is used, when a new document is being created. Do not call
/// this function manually.
PDFObjectReference createCatalog();
/// Creates page tree root for the catalog. This function is only called when new document is being
/// created. Do not call this function manually.
PDFObjectReference createCatalogPageTreeRoot();
/// This function is used to create a new trailer dictionary, when blank document is created. Do not
/// call this function manually.
/// \param catalog Reference to document catalog
PDFObject createTrailerDictionary(PDFObjectReference catalog);
/// This function is used to update trailer dictionary. Must be called each time the final document is
/// being built.
/// \param objectCount Number of objects (including empty ones)
void updateTrailerDictionary(PDFInteger objectCount);
/* END GENERATED CODE */
private:

File diff suppressed because it is too large Load Diff