diff --git a/CodeGenerator/codegenerator.h b/CodeGenerator/codegenerator.h index dc71632..22579ae 100644 --- a/CodeGenerator/codegenerator.h +++ b/CodeGenerator/codegenerator.h @@ -141,6 +141,8 @@ public: _PDFObjectReference, _PDFObject, _PDFIntegerVector, + _PDFObjectReferenceVector, + _PDFFormSubmitFlags, _QString, _QPointF, _QRectF, diff --git a/PdfForQtLib/sources/pdfdocumentbuilder.cpp b/PdfForQtLib/sources/pdfdocumentbuilder.cpp index ff404da..0743ddd 100644 --- a/PdfForQtLib/sources/pdfdocumentbuilder.cpp +++ b/PdfForQtLib/sources/pdfdocumentbuilder.cpp @@ -1460,6 +1460,94 @@ PDFObjectReference PDFDocumentBuilder::createActionGoToRemote(PDFObjectReference } +PDFObjectReference PDFDocumentBuilder::createActionHide(PDFObjectReference annotation, + bool hide) +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Type"); + objectBuilder << WrapName("Action"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("S"); + objectBuilder << WrapName("Hide"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("T"); + objectBuilder << annotation; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("H"); + objectBuilder << hide; + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference actionReference = addObject(objectBuilder.takeObject()); + return actionReference; +} + + +PDFObjectReference PDFDocumentBuilder::createActionHide(QString field, + bool hide) +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Type"); + objectBuilder << WrapName("Action"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("S"); + objectBuilder << WrapName("Hide"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("T"); + objectBuilder << field; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("H"); + objectBuilder << hide; + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference actionReference = addObject(objectBuilder.takeObject()); + return actionReference; +} + + +PDFObjectReference PDFDocumentBuilder::createActionImportData(PDFObjectReference fileSpecification) +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Type"); + objectBuilder << WrapName("Action"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("S"); + objectBuilder << WrapName("ImportData"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("F"); + objectBuilder << fileSpecification; + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference actionReference = addObject(objectBuilder.takeObject()); + return actionReference; +} + + +PDFObjectReference PDFDocumentBuilder::createActionJavaScript(QString code) +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Type"); + objectBuilder << WrapName("Action"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("S"); + objectBuilder << WrapName("JavaScript"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("JS"); + objectBuilder << code; + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference actionReference = addObject(objectBuilder.takeObject()); + return actionReference; +} + + PDFObjectReference PDFDocumentBuilder::createActionLaunch(PDFObjectReference fileSpecification, bool newWindow) { @@ -1524,6 +1612,322 @@ PDFObjectReference PDFDocumentBuilder::createActionLaunchWin(QByteArray fileName } +PDFObjectReference PDFDocumentBuilder::createActionNamed(QByteArray name) +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Type"); + objectBuilder << WrapName("Action"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("S"); + objectBuilder << WrapName("Named"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("N"); + objectBuilder << WrapName(name); + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference actionReference = addObject(objectBuilder.takeObject()); + return actionReference; +} + + +PDFObjectReference PDFDocumentBuilder::createActionNavigateFirstPage() +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Type"); + objectBuilder << WrapName("Action"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("S"); + objectBuilder << WrapName("Named"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("N"); + objectBuilder << WrapName("FirstPage"); + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference actionReference = addObject(objectBuilder.takeObject()); + return actionReference; +} + + +PDFObjectReference PDFDocumentBuilder::createActionNavigateLastPage() +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Type"); + objectBuilder << WrapName("Action"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("S"); + objectBuilder << WrapName("Named"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("N"); + objectBuilder << WrapName("LastPage"); + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference actionReference = addObject(objectBuilder.takeObject()); + return actionReference; +} + + +PDFObjectReference PDFDocumentBuilder::createActionNavigateNextPage() +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Type"); + objectBuilder << WrapName("Action"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("S"); + objectBuilder << WrapName("Named"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("N"); + objectBuilder << WrapName("NextPage"); + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference actionReference = addObject(objectBuilder.takeObject()); + return actionReference; +} + + +PDFObjectReference PDFDocumentBuilder::createActionNavigatePrevPage() +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Type"); + objectBuilder << WrapName("Action"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("S"); + objectBuilder << WrapName("Named"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("N"); + objectBuilder << WrapName("PrevPage"); + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference actionReference = addObject(objectBuilder.takeObject()); + return actionReference; +} + + +PDFObjectReference PDFDocumentBuilder::createActionResetForm() +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Type"); + objectBuilder << WrapName("Action"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("S"); + objectBuilder << WrapName("ResetForm"); + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference actionReference = addObject(objectBuilder.takeObject()); + return actionReference; +} + + +PDFObjectReference PDFDocumentBuilder::createActionResetFormExcludedFields(PDFObjectReferenceVector fields) +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Type"); + objectBuilder << WrapName("Action"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("S"); + objectBuilder << WrapName("ResetForm"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("Fields"); + objectBuilder << fields; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("Flags"); + objectBuilder << 1; + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference actionReference = addObject(objectBuilder.takeObject()); + return actionReference; +} + + +PDFObjectReference PDFDocumentBuilder::createActionResetFormFields(PDFObjectReferenceVector fields) +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Type"); + objectBuilder << WrapName("Action"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("S"); + objectBuilder << WrapName("ResetForm"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("Fields"); + objectBuilder << fields; + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference actionReference = addObject(objectBuilder.takeObject()); + return actionReference; +} + + +PDFObjectReference PDFDocumentBuilder::createActionSubmitForm(QString URL, + PDFFormSubmitFlags flags) +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Type"); + objectBuilder << WrapName("Action"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("S"); + objectBuilder << WrapName("SubmitForm"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("F"); + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("UF"); + objectBuilder << URL; + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("Flags"); + objectBuilder << flags; + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference actionReference = addObject(objectBuilder.takeObject()); + return actionReference; +} + + +PDFObjectReference PDFDocumentBuilder::createActionSubmitForm(QString URL, + PDFObjectReferenceVector fields, + PDFFormSubmitFlags flags) +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Type"); + objectBuilder << WrapName("Action"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("S"); + objectBuilder << WrapName("SubmitForm"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("F"); + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("UF"); + objectBuilder << URL; + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("Fields"); + objectBuilder << fields; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("Flags"); + objectBuilder << flags; + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference actionReference = addObject(objectBuilder.takeObject()); + return actionReference; +} + + +PDFObjectReference PDFDocumentBuilder::createActionThread(PDFObjectReference thread, + PDFObjectReference bead) +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Type"); + objectBuilder << WrapName("Action"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("S"); + objectBuilder << WrapName("Thread"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("D"); + objectBuilder << thread; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("B"); + objectBuilder << bead; + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference actionReference = addObject(objectBuilder.takeObject()); + return actionReference; +} + + +PDFObjectReference PDFDocumentBuilder::createActionThread(PDFObjectReference fileSpecification, + PDFInteger thread, + PDFInteger bead) +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Type"); + objectBuilder << WrapName("Action"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("S"); + objectBuilder << WrapName("Thread"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("F"); + objectBuilder << fileSpecification; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("D"); + objectBuilder << thread; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("B"); + objectBuilder << bead; + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference actionReference = addObject(objectBuilder.takeObject()); + return actionReference; +} + + +PDFObjectReference PDFDocumentBuilder::createActionThread(PDFObjectReference fileSpecification, + PDFInteger thread) +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Type"); + objectBuilder << WrapName("Action"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("S"); + objectBuilder << WrapName("Thread"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("F"); + objectBuilder << fileSpecification; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("D"); + objectBuilder << thread; + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference actionReference = addObject(objectBuilder.takeObject()); + return actionReference; +} + + +PDFObjectReference PDFDocumentBuilder::createActionThread(PDFObjectReference thread) +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Type"); + objectBuilder << WrapName("Action"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("S"); + objectBuilder << WrapName("Thread"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("D"); + objectBuilder << thread; + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference actionReference = addObject(objectBuilder.takeObject()); + return actionReference; +} + + PDFObjectReference PDFDocumentBuilder::createActionURI(QString URL) { PDFObjectFactory objectBuilder; @@ -1724,68 +2128,6 @@ PDFObjectReference PDFDocumentBuilder::createAnnotationFileAttachment(PDFObjectR } -PDFObjectReference PDFDocumentBuilder::createAnnotationFreeText(PDFObjectReference page, - QRectF rectangle, - QString title, - QString subject, - QString contents, - TextAlignment textAlignment) -{ - PDFObjectFactory objectBuilder; - - objectBuilder.beginDictionary(); - objectBuilder.beginDictionaryItem("Type"); - objectBuilder << WrapName("Annot"); - objectBuilder.endDictionaryItem(); - objectBuilder.beginDictionaryItem("Subtype"); - objectBuilder << WrapName("FreeText"); - objectBuilder.endDictionaryItem(); - objectBuilder.beginDictionaryItem("Rect"); - objectBuilder << rectangle; - objectBuilder.endDictionaryItem(); - objectBuilder.beginDictionaryItem("F"); - objectBuilder << 4; - objectBuilder.endDictionaryItem(); - objectBuilder.beginDictionaryItem("P"); - objectBuilder << page; - objectBuilder.endDictionaryItem(); - objectBuilder.beginDictionaryItem("M"); - objectBuilder << WrapCurrentDateTime(); - objectBuilder.endDictionaryItem(); - objectBuilder.beginDictionaryItem("CreationDate"); - objectBuilder << WrapCurrentDateTime(); - objectBuilder.endDictionaryItem(); - objectBuilder.beginDictionaryItem("T"); - objectBuilder << title; - objectBuilder.endDictionaryItem(); - objectBuilder.beginDictionaryItem("Contents"); - objectBuilder << contents; - objectBuilder.endDictionaryItem(); - objectBuilder.beginDictionaryItem("Subj"); - objectBuilder << subject; - objectBuilder.endDictionaryItem(); - objectBuilder.beginDictionaryItem("Q"); - objectBuilder << WrapFreeTextAlignment(textAlignment); - objectBuilder.endDictionaryItem(); - objectBuilder.beginDictionaryItem("DA"); - objectBuilder << WrapString("/Arial 10 Tf"); - objectBuilder.endDictionaryItem(); - objectBuilder.endDictionary(); - PDFObjectReference annotationObject = addObject(objectBuilder.takeObject()); - objectBuilder.beginDictionary(); - objectBuilder.beginDictionaryItem("Annots"); - objectBuilder.beginArray(); - objectBuilder << annotationObject; - objectBuilder.endArray(); - objectBuilder.endDictionaryItem(); - objectBuilder.endDictionary(); - PDFObject pageAnnots = objectBuilder.takeObject(); - appendTo(page, pageAnnots); - updateAnnotationAppearanceStreams(annotationObject); - return annotationObject; -} - - PDFObjectReference PDFDocumentBuilder::createAnnotationFreeText(PDFObjectReference page, QRectF boundingRectangle, QRectF textRectangle, @@ -1952,6 +2294,68 @@ PDFObjectReference PDFDocumentBuilder::createAnnotationFreeText(PDFObjectReferen } +PDFObjectReference PDFDocumentBuilder::createAnnotationFreeText(PDFObjectReference page, + QRectF rectangle, + QString title, + QString subject, + QString contents, + TextAlignment textAlignment) +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Type"); + objectBuilder << WrapName("Annot"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("Subtype"); + objectBuilder << WrapName("FreeText"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("Rect"); + objectBuilder << rectangle; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("F"); + objectBuilder << 4; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("P"); + objectBuilder << page; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("M"); + objectBuilder << WrapCurrentDateTime(); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("CreationDate"); + objectBuilder << WrapCurrentDateTime(); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("T"); + objectBuilder << title; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("Contents"); + objectBuilder << contents; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("Subj"); + objectBuilder << subject; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("Q"); + objectBuilder << WrapFreeTextAlignment(textAlignment); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("DA"); + objectBuilder << WrapString("/Arial 10 Tf"); + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference annotationObject = addObject(objectBuilder.takeObject()); + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Annots"); + objectBuilder.beginArray(); + objectBuilder << annotationObject; + objectBuilder.endArray(); + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObject pageAnnots = objectBuilder.takeObject(); + appendTo(page, pageAnnots); + updateAnnotationAppearanceStreams(annotationObject); + return annotationObject; +} + + PDFObjectReference PDFDocumentBuilder::createAnnotationHighlight(PDFObjectReference page, QRectF rectangle, QColor color, @@ -2389,6 +2793,17 @@ PDFObjectReference PDFDocumentBuilder::createAnnotationLine(PDFObjectReference p } +PDFObjectReference PDFDocumentBuilder::createAnnotationLink(PDFObjectReference page, + QRectF linkRectangle, + QString URL, + LinkHighlightMode highlightMode) +{ + PDFObjectFactory objectBuilder; + + return createAnnotationLink(page, linkRectangle, createActionURI(URL), highlightMode); +} + + PDFObjectReference PDFDocumentBuilder::createAnnotationLink(PDFObjectReference page, QRectF linkRectangle, PDFObjectReference action, @@ -2431,17 +2846,6 @@ PDFObjectReference PDFDocumentBuilder::createAnnotationLink(PDFObjectReference p } -PDFObjectReference PDFDocumentBuilder::createAnnotationLink(PDFObjectReference page, - QRectF linkRectangle, - QString URL, - LinkHighlightMode highlightMode) -{ - PDFObjectFactory objectBuilder; - - return createAnnotationLink(page, linkRectangle, createActionURI(URL), highlightMode); -} - - PDFObjectReference PDFDocumentBuilder::createAnnotationPolygon(PDFObjectReference page, QPolygonF polygon, PDFReal borderWidth, @@ -2697,6 +3101,55 @@ PDFObjectReference PDFDocumentBuilder::createAnnotationSquare(PDFObjectReference } +PDFObjectReference PDFDocumentBuilder::createAnnotationSquiggly(PDFObjectReference page, + QRectF rectangle, + QColor color) +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Type"); + objectBuilder << WrapName("Annot"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("Subtype"); + objectBuilder << WrapName("Squiggly"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("Rect"); + objectBuilder << rectangle; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("P"); + objectBuilder << page; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("CreationDate"); + objectBuilder << WrapCurrentDateTime(); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("C"); + objectBuilder << color; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("QuadPoints"); + objectBuilder.beginArray(); + objectBuilder << rectangle.bottomLeft(); + objectBuilder << rectangle.bottomRight(); + objectBuilder << rectangle.topLeft(); + objectBuilder << rectangle.topRight(); + objectBuilder.endArray(); + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference annotationObject = addObject(objectBuilder.takeObject()); + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Annots"); + objectBuilder.beginArray(); + objectBuilder << annotationObject; + objectBuilder.endArray(); + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObject pageAnnots = objectBuilder.takeObject(); + appendTo(page, pageAnnots); + updateAnnotationAppearanceStreams(annotationObject); + return annotationObject; +} + + PDFObjectReference PDFDocumentBuilder::createAnnotationSquiggly(PDFObjectReference page, QRectF rectangle, QColor color, @@ -2761,55 +3214,6 @@ PDFObjectReference PDFDocumentBuilder::createAnnotationSquiggly(PDFObjectReferen } -PDFObjectReference PDFDocumentBuilder::createAnnotationSquiggly(PDFObjectReference page, - QRectF rectangle, - QColor color) -{ - PDFObjectFactory objectBuilder; - - objectBuilder.beginDictionary(); - objectBuilder.beginDictionaryItem("Type"); - objectBuilder << WrapName("Annot"); - objectBuilder.endDictionaryItem(); - objectBuilder.beginDictionaryItem("Subtype"); - objectBuilder << WrapName("Squiggly"); - objectBuilder.endDictionaryItem(); - objectBuilder.beginDictionaryItem("Rect"); - objectBuilder << rectangle; - objectBuilder.endDictionaryItem(); - objectBuilder.beginDictionaryItem("P"); - objectBuilder << page; - objectBuilder.endDictionaryItem(); - objectBuilder.beginDictionaryItem("CreationDate"); - objectBuilder << WrapCurrentDateTime(); - objectBuilder.endDictionaryItem(); - objectBuilder.beginDictionaryItem("C"); - objectBuilder << color; - objectBuilder.endDictionaryItem(); - objectBuilder.beginDictionaryItem("QuadPoints"); - objectBuilder.beginArray(); - objectBuilder << rectangle.bottomLeft(); - objectBuilder << rectangle.bottomRight(); - objectBuilder << rectangle.topLeft(); - objectBuilder << rectangle.topRight(); - objectBuilder.endArray(); - objectBuilder.endDictionaryItem(); - objectBuilder.endDictionary(); - PDFObjectReference annotationObject = addObject(objectBuilder.takeObject()); - objectBuilder.beginDictionary(); - objectBuilder.beginDictionaryItem("Annots"); - objectBuilder.beginArray(); - objectBuilder << annotationObject; - objectBuilder.endArray(); - objectBuilder.endDictionaryItem(); - objectBuilder.endDictionary(); - PDFObject pageAnnots = objectBuilder.takeObject(); - appendTo(page, pageAnnots); - updateAnnotationAppearanceStreams(annotationObject); - return annotationObject; -} - - PDFObjectReference PDFDocumentBuilder::createAnnotationStamp(PDFObjectReference page, QRectF rectangle, Stamp stampType, @@ -3052,55 +3456,6 @@ PDFObjectReference PDFDocumentBuilder::createAnnotationText(PDFObjectReference p } -PDFObjectReference PDFDocumentBuilder::createAnnotationUnderline(PDFObjectReference page, - QRectF rectangle, - QColor color) -{ - PDFObjectFactory objectBuilder; - - objectBuilder.beginDictionary(); - objectBuilder.beginDictionaryItem("Type"); - objectBuilder << WrapName("Annot"); - objectBuilder.endDictionaryItem(); - objectBuilder.beginDictionaryItem("Subtype"); - objectBuilder << WrapName("Underline"); - objectBuilder.endDictionaryItem(); - objectBuilder.beginDictionaryItem("Rect"); - objectBuilder << rectangle; - objectBuilder.endDictionaryItem(); - objectBuilder.beginDictionaryItem("P"); - objectBuilder << page; - objectBuilder.endDictionaryItem(); - objectBuilder.beginDictionaryItem("CreationDate"); - objectBuilder << WrapCurrentDateTime(); - objectBuilder.endDictionaryItem(); - objectBuilder.beginDictionaryItem("C"); - objectBuilder << color; - objectBuilder.endDictionaryItem(); - objectBuilder.beginDictionaryItem("QuadPoints"); - objectBuilder.beginArray(); - objectBuilder << rectangle.bottomLeft(); - objectBuilder << rectangle.bottomRight(); - objectBuilder << rectangle.topLeft(); - objectBuilder << rectangle.topRight(); - objectBuilder.endArray(); - objectBuilder.endDictionaryItem(); - objectBuilder.endDictionary(); - PDFObjectReference annotationObject = addObject(objectBuilder.takeObject()); - objectBuilder.beginDictionary(); - objectBuilder.beginDictionaryItem("Annots"); - objectBuilder.beginArray(); - objectBuilder << annotationObject; - objectBuilder.endArray(); - objectBuilder.endDictionaryItem(); - objectBuilder.endDictionary(); - PDFObject pageAnnots = objectBuilder.takeObject(); - appendTo(page, pageAnnots); - updateAnnotationAppearanceStreams(annotationObject); - return annotationObject; -} - - PDFObjectReference PDFDocumentBuilder::createAnnotationUnderline(PDFObjectReference page, QRectF rectangle, QColor color, @@ -3165,6 +3520,55 @@ PDFObjectReference PDFDocumentBuilder::createAnnotationUnderline(PDFObjectRefere } +PDFObjectReference PDFDocumentBuilder::createAnnotationUnderline(PDFObjectReference page, + QRectF rectangle, + QColor color) +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Type"); + objectBuilder << WrapName("Annot"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("Subtype"); + objectBuilder << WrapName("Underline"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("Rect"); + objectBuilder << rectangle; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("P"); + objectBuilder << page; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("CreationDate"); + objectBuilder << WrapCurrentDateTime(); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("C"); + objectBuilder << color; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("QuadPoints"); + objectBuilder.beginArray(); + objectBuilder << rectangle.bottomLeft(); + objectBuilder << rectangle.bottomRight(); + objectBuilder << rectangle.topLeft(); + objectBuilder << rectangle.topRight(); + objectBuilder.endArray(); + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference annotationObject = addObject(objectBuilder.takeObject()); + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Annots"); + objectBuilder.beginArray(); + objectBuilder << annotationObject; + objectBuilder.endArray(); + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObject pageAnnots = objectBuilder.takeObject(); + appendTo(page, pageAnnots); + updateAnnotationAppearanceStreams(annotationObject); + return annotationObject; +} + + PDFObjectReference PDFDocumentBuilder::createCatalog() { PDFObjectFactory objectBuilder; @@ -3264,20 +3668,6 @@ PDFObjectReference PDFDocumentBuilder::createDocumentPartRoot() } -PDFObjectReference PDFDocumentBuilder::createFileSpecification(QString fileName) -{ - PDFObjectFactory objectBuilder; - - objectBuilder.beginDictionary(); - objectBuilder.beginDictionaryItem("UF"); - objectBuilder << fileName; - objectBuilder.endDictionaryItem(); - objectBuilder.endDictionary(); - PDFObjectReference fileSpecification = addObject(objectBuilder.takeObject()); - return fileSpecification; -} - - PDFObjectReference PDFDocumentBuilder::createFileSpecification(QString fileName, QString description) { @@ -3296,6 +3686,20 @@ PDFObjectReference PDFDocumentBuilder::createFileSpecification(QString fileName, } +PDFObjectReference PDFDocumentBuilder::createFileSpecification(QString fileName) +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("UF"); + objectBuilder << fileName; + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference fileSpecification = addObject(objectBuilder.takeObject()); + return fileSpecification; +} + + PDFObject PDFDocumentBuilder::createTrailerDictionary(PDFObjectReference catalog) { PDFObjectFactory objectBuilder; diff --git a/PdfForQtLib/sources/pdfdocumentbuilder.h b/PdfForQtLib/sources/pdfdocumentbuilder.h index 3bc5f7e..071fb11 100644 --- a/PdfForQtLib/sources/pdfdocumentbuilder.h +++ b/PdfForQtLib/sources/pdfdocumentbuilder.h @@ -28,6 +28,8 @@ namespace pdf { using PDFIntegerVector = std::vector; +using PDFObjectReferenceVector = std::vector; +using PDFFormSubmitFlags = PDFActionSubmitForm::SubmitFlags; struct WrapName { @@ -397,6 +399,30 @@ public: bool newWindow); + /// Creates hide action. Hide action toggles hide/show state of field or annotation. + /// \param annotation Annotation + /// \param hide Hide (true) or show (false) + PDFObjectReference createActionHide(PDFObjectReference annotation, + bool hide); + + + /// Creates hide action. Hide action toggles hide/show state of field or annotation. + /// \param field Fully qualified name of a form field + /// \param hide Hide (true) or show (false) + PDFObjectReference createActionHide(QString field, + bool hide); + + + /// Creates import data action for interactive form. + /// \param fileSpecification Data file + PDFObjectReference createActionImportData(PDFObjectReference fileSpecification); + + + /// Creates JavaScript action. + /// \param code JavaScript code + PDFObjectReference createActionJavaScript(QString code); + + /// Creates launch action. Launch action executes document opening or printing. /// \param fileSpecification File specification /// \param newWindow Open document in new window @@ -418,6 +444,87 @@ public: bool newWindow); + /// Creates named action. Named actions are some predefined actions that interactive PDF processor + /// shall support. Valid values are NextPage, PrevPage, FirstPage, LastPage. + /// \param name Predefined name + PDFObjectReference createActionNamed(QByteArray name); + + + /// Creates action which navigates to a first page. + PDFObjectReference createActionNavigateFirstPage(); + + + /// Creates action which navigates to a last page. + PDFObjectReference createActionNavigateLastPage(); + + + /// Creates action which navigates to a next page. + PDFObjectReference createActionNavigateNextPage(); + + + /// Creates action which navigates to a previous page. + PDFObjectReference createActionNavigatePrevPage(); + + + /// Creates reset interactive form action. + PDFObjectReference createActionResetForm(); + + + /// Creates reset interactive form action, which resets all fields except those specified in a given list of + /// fields. + /// \param fields Fields to be excluded from reset + PDFObjectReference createActionResetFormExcludedFields(PDFObjectReferenceVector fields); + + + /// Creates reset interactive form action, which resets a given list of fields. + /// \param fields Fields to be reset + PDFObjectReference createActionResetFormFields(PDFObjectReferenceVector fields); + + + /// Creates submit form action. + /// \param URL Web link to server script, which will process the form + /// \param flags Flags + PDFObjectReference createActionSubmitForm(QString URL, + PDFFormSubmitFlags flags); + + + /// Creates submit form action. + /// \param URL Web link to server script, which will process the form + /// \param fields Sumbitted fields + /// \param flags Flags + PDFObjectReference createActionSubmitForm(QString URL, + PDFObjectReferenceVector fields, + PDFFormSubmitFlags flags); + + + /// Creates thread action for thread in current file. When executed, viewer jumps to a specific thread. + /// \param thread Thread + /// \param bead Bead + PDFObjectReference createActionThread(PDFObjectReference thread, + PDFObjectReference bead); + + + /// Creates thread action. When executed, viewer jumps to a specific thread. + /// \param fileSpecification File containing the thread + /// \param thread Thread index + /// \param bead Bead index + PDFObjectReference createActionThread(PDFObjectReference fileSpecification, + PDFInteger thread, + PDFInteger bead); + + + /// Creates thread action. When executed, viewer jumps to a specific thread. + /// \param fileSpecification File containing the thread + /// \param thread Thread index + PDFObjectReference createActionThread(PDFObjectReference fileSpecification, + PDFInteger thread); + + + /// Creates thread action for thread in current file. When executed, viewer jumps to a specific thread. + /// \param thread Thread + PDFObjectReference createActionThread(PDFObjectReference thread); + + /// Creates URI action. /// \param URL Target URL PDFObjectReference createActionURI(QString URL); @@ -479,23 +586,6 @@ public: QString description); - /// Free text annotation displays text directly on a page. Text appears directly on the page, in the - /// same way, as standard text in PDF document. Free text annotations are usually used to comment - /// the document. Free text annotation can also have callout line, with, or without a knee. - /// \param page Page to which is annotation added - /// \param rectangle Area in which is text displayed - /// \param title Title - /// \param subject Subject - /// \param contents Contents (text displayed) - /// \param textAlignment Text alignment. Only horizontal alignment flags are valid. - PDFObjectReference createAnnotationFreeText(PDFObjectReference page, - QRectF rectangle, - QString title, - QString subject, - QString contents, - TextAlignment textAlignment); - - /// Free text annotation displays text directly on a page. Text appears directly on the page, in the /// same way, as standard text in PDF document. Free text annotations are usually used to comment /// the document. Free text annotation can also have callout line, with, or without a knee. Specify @@ -558,6 +648,23 @@ public: AnnotationLineEnding endLineType); + /// Free text annotation displays text directly on a page. Text appears directly on the page, in the + /// same way, as standard text in PDF document. Free text annotations are usually used to comment + /// the document. Free text annotation can also have callout line, with, or without a knee. + /// \param page Page to which is annotation added + /// \param rectangle Area in which is text displayed + /// \param title Title + /// \param subject Subject + /// \param contents Contents (text displayed) + /// \param textAlignment Text alignment. Only horizontal alignment flags are valid. + PDFObjectReference createAnnotationFreeText(PDFObjectReference page, + QRectF rectangle, + QString title, + QString subject, + QString contents, + TextAlignment textAlignment); + + /// Text markup annotation is used to highlight text. It is a markup annotation, so it can contain /// window to be opened (and commented). This annotation is usually used to highlight text, but can /// also highlight other things, such as images, or other graphics. @@ -698,11 +805,11 @@ public: /// 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 URL URL to be launched when user clicks on the link /// \param highlightMode Highlight mode PDFObjectReference createAnnotationLink(PDFObjectReference page, QRectF linkRectangle, - PDFObjectReference action, + QString URL, LinkHighlightMode highlightMode); @@ -711,11 +818,11 @@ public: /// 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 action Action to be performed when user clicks on a link /// \param highlightMode Highlight mode PDFObjectReference createAnnotationLink(PDFObjectReference page, QRectF linkRectangle, - QString URL, + PDFObjectReference action, LinkHighlightMode highlightMode); @@ -802,6 +909,16 @@ public: QString contents); + /// Text markup annotation is used to squiggly underline text. It is a markup annotation, so it can + /// contain window to be opened (and commented). + /// \param page Page to which is annotation added + /// \param rectangle Area in which is markup displayed + /// \param color Color + PDFObjectReference createAnnotationSquiggly(PDFObjectReference page, + QRectF rectangle, + QColor color); + + /// Text markup annotation is used to squiggly underline text. It is a markup annotation, so it can /// contain window to be opened (and commented). /// \param page Page to which is annotation added @@ -818,16 +935,6 @@ public: QString contents); - /// Text markup annotation is used to squiggly underline text. It is a markup annotation, so it can - /// contain window to be opened (and commented). - /// \param page Page to which is annotation added - /// \param rectangle Area in which is markup displayed - /// \param color Color - PDFObjectReference createAnnotationSquiggly(PDFObjectReference page, - QRectF rectangle, - QColor color); - - /// Stamp annotation /// \param page Page to which is annotation added /// \param rectangle Stamp area @@ -890,16 +997,6 @@ public: bool open); - /// Text markup annotation is used to underline text. It is a markup annotation, so it can contain - /// window to be opened (and commented). - /// \param page Page to which is annotation added - /// \param rectangle Area in which is markup displayed - /// \param color Color - PDFObjectReference createAnnotationUnderline(PDFObjectReference page, - QRectF rectangle, - QColor color); - - /// Text markup annotation is used to underline text. It is a markup annotation, so it can contain /// window to be opened (and commented). /// \param page Page to which is annotation added @@ -916,6 +1013,16 @@ public: QString contents); + /// Text markup annotation is used to underline text. It is a markup annotation, so it can contain + /// window to be opened (and commented). + /// \param page Page to which is annotation added + /// \param rectangle Area in which is markup displayed + /// \param color Color + PDFObjectReference createAnnotationUnderline(PDFObjectReference page, + QRectF rectangle, + QColor color); + + /// Creates empty catalog. This function is used, when a new document is being created. Do not call /// this function manually. PDFObjectReference createCatalog(); @@ -941,14 +1048,14 @@ public: /// Creates file specification for external file. /// \param fileName File name - PDFObjectReference createFileSpecification(QString fileName); + /// \param description Description + PDFObjectReference createFileSpecification(QString fileName, + QString description); /// Creates file specification for external file. /// \param fileName File name - /// \param description Description - PDFObjectReference createFileSpecification(QString fileName, - QString description); + PDFObjectReference createFileSpecification(QString fileName); /// This function is used to create a new trailer dictionary, when blank document is created. Do not diff --git a/generated_code_definition.xml b/generated_code_definition.xml index 6ec6866..8175b5f 100644 --- a/generated_code_definition.xml +++ b/generated_code_definition.xml @@ -452,6 +452,318 @@ return pageReference; Creates remote GoTo action. When executed, action points to destination in another document. _PDFObjectReference + + + + + + + + + + annotation + _PDFObjectReference + Annotation + + + + + hide + _bool + Hide (true) or show (false) + + + Parameters + + _void + + + + + + + + + + + + Type + DictionaryItemSimple + WrapName("Action") + + + + + S + DictionaryItemSimple + WrapName("Hide") + + + + + T + DictionaryItemSimple + annotation + + + + + H + DictionaryItemSimple + hide + + + + Dictionary + + + + CreateObject + actionReference + _PDFObjectReference + + + + + + Code + + _void + return actionReference; + + + Actions + createActionHide + Creates hide action. Hide action toggles hide/show state of field or annotation. + _PDFObjectReference + + + + + + + + + + + field + _QString + Fully qualified name of a form field + + + + + hide + _bool + Hide (true) or show (false) + + + Parameters + + _void + + + + + + + + + + + + Type + DictionaryItemSimple + WrapName("Action") + + + + + S + DictionaryItemSimple + WrapName("Hide") + + + + + T + DictionaryItemSimple + field + + + + + H + DictionaryItemSimple + hide + + + + Dictionary + + + + CreateObject + actionReference + _PDFObjectReference + + + + + + Code + + _void + return actionReference; + + + Actions + createActionHide + Creates hide action. Hide action toggles hide/show state of field or annotation. + _PDFObjectReference + + + + + + + + + + + fileSpecification + _PDFObjectReference + Data file + + + Parameters + + _void + + + + + + + + + + + + Type + DictionaryItemSimple + WrapName("Action") + + + + + S + DictionaryItemSimple + WrapName("ImportData") + + + + + F + DictionaryItemSimple + fileSpecification + + + + Dictionary + + + + CreateObject + actionReference + _PDFObjectReference + + + + + + Code + + _void + return actionReference; + + + Actions + createActionImportData + Creates import data action for interactive form. + _PDFObjectReference + + + + + + + + + + + code + _QString + JavaScript code + + + Parameters + + _void + + + + + + + + + + + + Type + DictionaryItemSimple + WrapName("Action") + + + + + S + DictionaryItemSimple + WrapName("JavaScript") + + + + + JS + DictionaryItemSimple + code + + + + Dictionary + + + + CreateObject + actionReference + _PDFObjectReference + + + + + + Code + + _void + return actionReference; + + + Actions + createActionJavaScript + Creates JavaScript action. + _PDFObjectReference + @@ -537,6 +849,1193 @@ return pageReference; Creates launch action. Launch action executes document opening or printing. _PDFObjectReference + + + + + + + + + + fileName + _QByteArray + File name + + + + + defaultDirectory + _QByteArray + Default directory + + + + + action + _QByteArray + Action to be performed. Valid values are 'open' or 'print'. + + + + + parameters + _QByteArray + Command line arguments, which are passed to target application + + + + + newWindow + _bool + Open document in new window + + + Parameters + + _void + + + + + + + + + + + + Type + DictionaryItemSimple + WrapName("Action") + + + + + S + DictionaryItemSimple + WrapName("Launch") + + + + + + + + + + + F + DictionaryItemSimple + fileName + + + + + D + DictionaryItemSimple + defaultDirectory + + + + + O + DictionaryItemSimple + action + + + + + P + DictionaryItemSimple + parameters + + + + Dictionary + + + + Win + DictionaryItemComplex + + + + + + NewWindow + DictionaryItemSimple + newWindow + + + + Dictionary + + + + CreateObject + actionReference + _PDFObjectReference + + + + + + Code + + _void + return actionReference; + + + Actions + createActionLaunchWin + Creates launch action. Launch action executes document opening or printing. This variant for Windows operating system, where additional parameters can be specified. + _PDFObjectReference + + + + + + + + + + + name + _QByteArray + Predefined name + + + Parameters + + _void + + + + + + + + + + + + Type + DictionaryItemSimple + WrapName("Action") + + + + + S + DictionaryItemSimple + WrapName("Named") + + + + + N + DictionaryItemSimple + WrapName(name) + + + + Dictionary + + + + CreateObject + actionReference + _PDFObjectReference + + + + + + Code + + _void + return actionReference; + + + Actions + createActionNamed + Creates named action. Named actions are some predefined actions that interactive PDF processor shall support. Valid values are NextPage, PrevPage, FirstPage, LastPage. + _PDFObjectReference + + + + + + + + + + + + + + Type + DictionaryItemSimple + WrapName("Action") + + + + + S + DictionaryItemSimple + WrapName("Named") + + + + + N + DictionaryItemSimple + WrapName("FirstPage") + + + + Dictionary + + + + CreateObject + actionReference + _PDFObjectReference + + + + + + Code + + _void + return actionReference; + + + Actions + createActionNavigateFirstPage + Creates action which navigates to a first page. + _PDFObjectReference + + + + + + + + + + + + + + Type + DictionaryItemSimple + WrapName("Action") + + + + + S + DictionaryItemSimple + WrapName("Named") + + + + + N + DictionaryItemSimple + WrapName("LastPage") + + + + Dictionary + + + + CreateObject + actionReference + _PDFObjectReference + + + + + + Code + + _void + return actionReference; + + + Actions + createActionNavigateLastPage + Creates action which navigates to a last page. + _PDFObjectReference + + + + + + + + + + + + + + Type + DictionaryItemSimple + WrapName("Action") + + + + + S + DictionaryItemSimple + WrapName("Named") + + + + + N + DictionaryItemSimple + WrapName("NextPage") + + + + Dictionary + + + + CreateObject + actionReference + _PDFObjectReference + + + + + + Code + + _void + return actionReference; + + + Actions + createActionNavigateNextPage + Creates action which navigates to a next page. + _PDFObjectReference + + + + + + + + + + + + + + Type + DictionaryItemSimple + WrapName("Action") + + + + + S + DictionaryItemSimple + WrapName("Named") + + + + + N + DictionaryItemSimple + WrapName("PrevPage") + + + + Dictionary + + + + CreateObject + actionReference + _PDFObjectReference + + + + + + Code + + _void + return actionReference; + + + Actions + createActionNavigatePrevPage + Creates action which navigates to a previous page. + _PDFObjectReference + + + + + + + + + + + + + + Type + DictionaryItemSimple + WrapName("Action") + + + + + S + DictionaryItemSimple + WrapName("ResetForm") + + + + Dictionary + + + + CreateObject + actionReference + _PDFObjectReference + + + + + + Code + + _void + return actionReference; + + + Actions + createActionResetForm + Creates reset interactive form action. + _PDFObjectReference + + + + + + + + + + + fields + _PDFObjectReferenceVector + Fields to be excluded from reset + + + Parameters + + _void + + + + + + + + + + + + Type + DictionaryItemSimple + WrapName("Action") + + + + + S + DictionaryItemSimple + WrapName("ResetForm") + + + + + Fields + DictionaryItemSimple + fields + + + + + Flags + DictionaryItemSimple + 1 + + + + Dictionary + + + + CreateObject + actionReference + _PDFObjectReference + + + + + + Code + + _void + return actionReference; + + + Actions + createActionResetFormExcludedFields + Creates reset interactive form action, which resets all fields except those specified in a given list of fields. + _PDFObjectReference + + + + + + + + + + + fields + _PDFObjectReferenceVector + Fields to be reset + + + Parameters + + _void + + + + + + + + + + + + Type + DictionaryItemSimple + WrapName("Action") + + + + + S + DictionaryItemSimple + WrapName("ResetForm") + + + + + Fields + DictionaryItemSimple + fields + + + + Dictionary + + + + CreateObject + actionReference + _PDFObjectReference + + + + + + Code + + _void + return actionReference; + + + Actions + createActionResetFormFields + Creates reset interactive form action, which resets a given list of fields. + _PDFObjectReference + + + + + + + + + + + URL + _QString + Web link to server script, which will process the form + + + + + flags + _PDFFormSubmitFlags + Flags + + + Parameters + + _void + + + + + + + + + + + + Type + DictionaryItemSimple + WrapName("Action") + + + + + S + DictionaryItemSimple + WrapName("SubmitForm") + + + + + + + + + + + UF + DictionaryItemSimple + URL + + + + Dictionary + + + + F + DictionaryItemComplex + + + + + + Flags + DictionaryItemSimple + flags + + + + Dictionary + + + + CreateObject + actionReference + _PDFObjectReference + + + + + + Code + + _void + return actionReference; + + + Actions + createActionSubmitForm + Creates submit form action. + _PDFObjectReference + + + + + + + + + + + URL + _QString + Web link to server script, which will process the form + + + + + fields + _PDFObjectReferenceVector + Sumbitted fields + + + + + flags + _PDFFormSubmitFlags + Flags + + + Parameters + + _void + + + + + + + + + + + + Type + DictionaryItemSimple + WrapName("Action") + + + + + S + DictionaryItemSimple + WrapName("SubmitForm") + + + + + + + + + + + UF + DictionaryItemSimple + URL + + + + Dictionary + + + + F + DictionaryItemComplex + + + + + + Fields + DictionaryItemSimple + fields + + + + + Flags + DictionaryItemSimple + flags + + + + Dictionary + + + + CreateObject + actionReference + _PDFObjectReference + + + + + + Code + + _void + return actionReference; + + + Actions + createActionSubmitForm + Creates submit form action. + _PDFObjectReference + + + + + + + + + + + thread + _PDFObjectReference + Thread + + + + + bead + _PDFObjectReference + Bead + + + Parameters + + _void + + + + + + + + + + + + Type + DictionaryItemSimple + WrapName("Action") + + + + + S + DictionaryItemSimple + WrapName("Thread") + + + + + D + DictionaryItemSimple + thread + + + + + B + DictionaryItemSimple + bead + + + + Dictionary + + + + CreateObject + actionReference + _PDFObjectReference + + + + + + Code + + _void + return actionReference; + + + Actions + createActionThread + Creates thread action for thread in current file. When executed, viewer jumps to a specific thread. + _PDFObjectReference + + + + + + + + + + + fileSpecification + _PDFObjectReference + File containing the thread + + + + + thread + _PDFInteger + Thread index + + + + + bead + _PDFInteger + Bead index + + + Parameters + + _void + + + + + + + + + + + + Type + DictionaryItemSimple + WrapName("Action") + + + + + S + DictionaryItemSimple + WrapName("Thread") + + + + + F + DictionaryItemSimple + fileSpecification + + + + + D + DictionaryItemSimple + thread + + + + + B + DictionaryItemSimple + bead + + + + Dictionary + + + + CreateObject + actionReference + _PDFObjectReference + + + + + + Code + + _void + return actionReference; + + + Actions + createActionThread + Creates thread action. When executed, viewer jumps to a specific thread. + _PDFObjectReference + + + + + + + + + + + fileSpecification + _PDFObjectReference + File containing the thread + + + + + thread + _PDFInteger + Thread index + + + Parameters + + _void + + + + + + + + + + + + Type + DictionaryItemSimple + WrapName("Action") + + + + + S + DictionaryItemSimple + WrapName("Thread") + + + + + F + DictionaryItemSimple + fileSpecification + + + + + D + DictionaryItemSimple + thread + + + + Dictionary + + + + CreateObject + actionReference + _PDFObjectReference + + + + + + Code + + _void + return actionReference; + + + Actions + createActionThread + Creates thread action. When executed, viewer jumps to a specific thread. + _PDFObjectReference + + + + + + + + + + + thread + _PDFObjectReference + Thread + + + Parameters + + _void + + + + + + + + + + + + Type + DictionaryItemSimple + WrapName("Action") + + + + + S + DictionaryItemSimple + WrapName("Thread") + + + + + D + DictionaryItemSimple + thread + + + + Dictionary + + + + CreateObject + actionReference + _PDFObjectReference + + + + + + Code + + _void + return actionReference; + + + Actions + createActionThread + Creates thread action for thread in current file. When executed, viewer jumps to a specific thread. + _PDFObjectReference + @@ -1217,209 +2716,6 @@ return annotationReference; Creates a new file attachment annotation. This annotation needs file specification as parameter. _PDFObjectReference - - - - - - - - - - page - _PDFObjectReference - Page to which is annotation added - - - - - rectangle - _QRectF - Area in which is text displayed - - - - - title - _QString - Title - - - - - subject - _QString - Subject - - - - - contents - _QString - Contents (text displayed) - - - - - textAlignment - _TextAlignment - Text alignment. Only horizontal alignment flags are valid. - - - Parameters - - _void - - - - - - - - - - - - Type - DictionaryItemSimple - WrapName("Annot") - - - - - Subtype - DictionaryItemSimple - WrapName("FreeText") - - - - - Rect - DictionaryItemSimple - rectangle - - - - - F - DictionaryItemSimple - 4 - - - - - P - DictionaryItemSimple - page - - - - - M - DictionaryItemSimple - WrapCurrentDateTime() - - - - - CreationDate - DictionaryItemSimple - WrapCurrentDateTime() - - - - - T - DictionaryItemSimple - title - - - - - Contents - DictionaryItemSimple - contents - - - - - Subj - DictionaryItemSimple - subject - - - - - Q - DictionaryItemSimple - WrapFreeTextAlignment(textAlignment) - - - - - DA - DictionaryItemSimple - WrapString("/Arial 10 Tf") - - - - Dictionary - - - - CreateObject - annotationObject - _PDFObjectReference - - - - - - - - - - - - - - - - ArraySimple - annotationObject - - - Annots - DictionaryItemComplex - - - - - Dictionary - - - - CreateObject - pageAnnots - _PDFObject - - - - - - Code - - _void - appendTo(page, pageAnnots); -updateAnnotationAppearanceStreams(annotationObject); -return annotationObject; - - - Annotations - createAnnotationFreeText - Free text annotation displays text directly on a page. Text appears directly on the page, in the same way, as standard text in PDF document. Free text annotations are usually used to comment the document. Free text annotation can also have callout line, with, or without a knee. - _PDFObjectReference - @@ -1977,6 +3273,209 @@ return annotationObject; Free text annotation displays text directly on a page. Text appears directly on the page, in the same way, as standard text in PDF document. Free text annotations are usually used to comment the document. Free text annotation can also have callout line, with, or without a knee. Specify start/end point parameters of this function to get callout line. _PDFObjectReference + + + + + + + + + + page + _PDFObjectReference + Page to which is annotation added + + + + + rectangle + _QRectF + Area in which is text displayed + + + + + title + _QString + Title + + + + + subject + _QString + Subject + + + + + contents + _QString + Contents (text displayed) + + + + + textAlignment + _TextAlignment + Text alignment. Only horizontal alignment flags are valid. + + + Parameters + + _void + + + + + + + + + + + + Type + DictionaryItemSimple + WrapName("Annot") + + + + + Subtype + DictionaryItemSimple + WrapName("FreeText") + + + + + Rect + DictionaryItemSimple + rectangle + + + + + F + DictionaryItemSimple + 4 + + + + + P + DictionaryItemSimple + page + + + + + M + DictionaryItemSimple + WrapCurrentDateTime() + + + + + CreationDate + DictionaryItemSimple + WrapCurrentDateTime() + + + + + T + DictionaryItemSimple + title + + + + + Contents + DictionaryItemSimple + contents + + + + + Subj + DictionaryItemSimple + subject + + + + + Q + DictionaryItemSimple + WrapFreeTextAlignment(textAlignment) + + + + + DA + DictionaryItemSimple + WrapString("/Arial 10 Tf") + + + + Dictionary + + + + CreateObject + annotationObject + _PDFObjectReference + + + + + + + + + + + + + + + + ArraySimple + annotationObject + + + Annots + DictionaryItemComplex + + + + + Dictionary + + + + CreateObject + pageAnnots + _PDFObject + + + + + + Code + + _void + appendTo(page, pageAnnots); +updateAnnotationAppearanceStreams(annotationObject); +return annotationObject; + + + Annotations + createAnnotationFreeText + Free text annotation displays text directly on a page. Text appears directly on the page, in the same way, as standard text in PDF document. Free text annotations are usually used to comment the document. Free text annotation can also have callout line, with, or without a knee. + _PDFObjectReference + @@ -3412,6 +4911,60 @@ return annotationObject; Line annotation represents straight line, or some more advanced graphics, such as dimension with text. Line annotations are markup annotations, so they can have popup window. Line endings can be specified. _PDFObjectReference + + + + + + + + + + page + _PDFObjectReference + Page to which is annotation added + + + + + linkRectangle + _QRectF + Link rectangle + + + + + URL + _QString + URL to be launched when user clicks on the link + + + + + highlightMode + _LinkHighlightMode + Highlight mode + + + Parameters + + _void + + + + + + Code + + _void + return createAnnotationLink(page, linkRectangle, createActionURI(URL), highlightMode); + + + Annotations + createAnnotationLink + 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). + _PDFObjectReference + @@ -3559,60 +5112,6 @@ return annotationReference; 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). _PDFObjectReference - - - - - - - - - - page - _PDFObjectReference - Page to which is annotation added - - - - - linkRectangle - _QRectF - Link rectangle - - - - - URL - _QString - URL to be launched when user clicks on the link - - - - - highlightMode - _LinkHighlightMode - Highlight mode - - - Parameters - - _void - - - - - - Code - - _void - return createAnnotationLink(page, linkRectangle, createActionURI(URL), highlightMode); - - - Annotations - createAnnotationLink - 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). - _PDFObjectReference - @@ -4494,27 +5993,6 @@ return annotationObject; _QColor Color - - - - title - _QString - Title - - - - - subject - _QString - Subject - - - - - contents - _QString - Contents - Parameters @@ -4555,13 +6033,6 @@ return annotationObject; DictionaryItemSimple page - - - - M - DictionaryItemSimple - WrapCurrentDateTime() - @@ -4576,27 +6047,6 @@ return annotationObject; DictionaryItemSimple color - - - - T - DictionaryItemSimple - title - - - - - Contents - DictionaryItemSimple - contents - - - - - Subj - DictionaryItemSimple - subject - @@ -4698,6 +6148,27 @@ return annotationObject; _QColor Color + + + + title + _QString + Title + + + + + subject + _QString + Subject + + + + + contents + _QString + Contents + Parameters @@ -4738,6 +6209,13 @@ return annotationObject; DictionaryItemSimple page + + + + M + DictionaryItemSimple + WrapCurrentDateTime() + @@ -4752,6 +6230,27 @@ return annotationObject; DictionaryItemSimple color + + + + T + DictionaryItemSimple + title + + + + + Contents + DictionaryItemSimple + contents + + + + + Subj + DictionaryItemSimple + subject + @@ -5617,161 +7116,6 @@ return annotationObject; 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 NoZoom or NoRotate to the annotations are being set. Popup annotation is automatically created for this annotation. _PDFObjectReference - - - - - - - - - - page - _PDFObjectReference - Page to which is annotation added - - - - - rectangle - _QRectF - Area in which is markup displayed - - - - - color - _QColor - Color - - - Parameters - - _void - - - - - - - - - - - - Type - DictionaryItemSimple - WrapName("Annot") - - - - - Subtype - DictionaryItemSimple - WrapName("Underline") - - - - - Rect - DictionaryItemSimple - rectangle - - - - - P - DictionaryItemSimple - page - - - - - CreationDate - DictionaryItemSimple - WrapCurrentDateTime() - - - - - C - DictionaryItemSimple - color - - - - - - - - - ArraySimple - rectangle.bottomLeft();rectangle.bottomRight();rectangle.topLeft();rectangle.topRight() - - - QuadPoints - DictionaryItemComplex - - - - - Dictionary - - - - CreateObject - annotationObject - _PDFObjectReference - - - - - - - - - - - - - - - - ArraySimple - annotationObject - - - Annots - DictionaryItemComplex - - - - - Dictionary - - - - CreateObject - pageAnnots - _PDFObject - - - - - - Code - - _void - appendTo(page, pageAnnots); -updateAnnotationAppearanceStreams(annotationObject); -return annotationObject; - - - Annotations - createAnnotationUnderline - Text markup annotation is used to underline text. It is a markup annotation, so it can contain window to be opened (and commented). - _PDFObjectReference - @@ -5968,6 +7312,161 @@ return annotationObject; _void appendTo(page, pageAnnots); updateAnnotationAppearanceStreams(annotationObject); +return annotationObject; + + + Annotations + createAnnotationUnderline + Text markup annotation is used to underline text. It is a markup annotation, so it can contain window to be opened (and commented). + _PDFObjectReference + + + + + + + + + + + page + _PDFObjectReference + Page to which is annotation added + + + + + rectangle + _QRectF + Area in which is markup displayed + + + + + color + _QColor + Color + + + Parameters + + _void + + + + + + + + + + + + Type + DictionaryItemSimple + WrapName("Annot") + + + + + Subtype + DictionaryItemSimple + WrapName("Underline") + + + + + Rect + DictionaryItemSimple + rectangle + + + + + P + DictionaryItemSimple + page + + + + + CreationDate + DictionaryItemSimple + WrapCurrentDateTime() + + + + + C + DictionaryItemSimple + color + + + + + + + + + ArraySimple + rectangle.bottomLeft();rectangle.bottomRight();rectangle.topLeft();rectangle.topRight() + + + QuadPoints + DictionaryItemComplex + + + + + Dictionary + + + + CreateObject + annotationObject + _PDFObjectReference + + + + + + + + + + + + + + + + ArraySimple + annotationObject + + + Annots + DictionaryItemComplex + + + + + Dictionary + + + + CreateObject + pageAnnots + _PDFObject + + + + + + Code + + _void + appendTo(page, pageAnnots); +updateAnnotationAppearanceStreams(annotationObject); return annotationObject; @@ -6306,6 +7805,13 @@ return rootNodeReference; _QString File name + + + + description + _QString + Description + Parameters @@ -6325,6 +7831,13 @@ return rootNodeReference; DictionaryItemSimple fileName + + + + Desc + DictionaryItemSimple + description + Dictionary @@ -6363,13 +7876,6 @@ return rootNodeReference; _QString File name - - - - description - _QString - Description - Parameters @@ -6389,13 +7895,6 @@ return rootNodeReference; DictionaryItemSimple fileName - - - - Desc - DictionaryItemSimple - description - Dictionary @@ -8226,39 +9725,6 @@ return rootNodeReference; Sets form field value. Value must be correct for this form field, no checking is performed. Also, if you use this function, annotation widgets, which are attached to this form field, should also be updated (for example, appearance state and sometimes appearance streams). _void - - - - - - - - - - locale - _QLocale - Locale, from which is language determined - - - Parameters - - _void - - - - - - Code - - _void - setLanguage(locale.name()); - - - Structure - setLanguage - Set document language. - _void - @@ -8316,6 +9782,39 @@ return rootNodeReference; Set document language. _void + + + + + + + + + + locale + _QLocale + Locale, from which is language determined + + + Parameters + + _void + + + + + + Code + + _void + setLanguage(locale.name()); + + + Structure + setLanguage + Set document language. + _void + @@ -8789,148 +10288,5 @@ updateDocumentInfo(qMove(updatedInfoDictionary)); This function is used to update trailer dictionary. Must be called each time the final document is being built. _void - - - - - - - - - - fileName - _QByteArray - File name - - - - - defaultDirectory - _QByteArray - Default directory - - - - - action - _QByteArray - Action to be performed. Valid values are 'open' or 'print'. - - - - - parameters - _QByteArray - Command line arguments, which are passed to target application - - - - - newWindow - _bool - Open document in new window - - - Parameters - - _void - - - - - - - - - - - - Type - DictionaryItemSimple - WrapName("Action") - - - - - S - DictionaryItemSimple - WrapName("Launch") - - - - - - - - - - - F - DictionaryItemSimple - fileName - - - - - D - DictionaryItemSimple - defaultDirectory - - - - - O - DictionaryItemSimple - action - - - - - P - DictionaryItemSimple - parameters - - - - Dictionary - - - - Win - DictionaryItemComplex - - - - - - NewWindow - DictionaryItemSimple - newWindow - - - - Dictionary - - - - CreateObject - actionReference - _PDFObjectReference - - - - - - Code - - _void - return actionReference; - - - Actions - createActionLaunchWin - Creates launch action. Launch action executes document opening or printing. This variant for Windows operating system, where additional parameters can be specified. - _PDFObjectReference -