diff --git a/PdfForQtLib/sources/pdfdocumentbuilder.cpp b/PdfForQtLib/sources/pdfdocumentbuilder.cpp index a65af7d..ff404da 100644 --- a/PdfForQtLib/sources/pdfdocumentbuilder.cpp +++ b/PdfForQtLib/sources/pdfdocumentbuilder.cpp @@ -1384,6 +1384,146 @@ PDFObjectReference PDFDocumentBuilder::createActionGoTo(PDFDestination destinati } +PDFObjectReference PDFDocumentBuilder::createActionGoToDocumentPart(PDFObjectReference documentPart) +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Type"); + objectBuilder << WrapName("Action"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("S"); + objectBuilder << WrapName("GoToDp"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("Dp"); + objectBuilder << documentPart; + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference actionReference = addObject(objectBuilder.takeObject()); + return actionReference; +} + + +PDFObjectReference PDFDocumentBuilder::createActionGoToEmbedded(PDFObjectReference fileSpecification, + PDFDestination destination, + bool newWindow) +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Type"); + objectBuilder << WrapName("Action"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("S"); + objectBuilder << WrapName("GoToE"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("F"); + objectBuilder << fileSpecification; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("D"); + objectBuilder << destination; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("NewWindow"); + objectBuilder << newWindow; + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference actionReference = addObject(objectBuilder.takeObject()); + return actionReference; +} + + +PDFObjectReference PDFDocumentBuilder::createActionGoToRemote(PDFObjectReference fileSpecification, + PDFDestination destination, + bool newWindow) +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Type"); + objectBuilder << WrapName("Action"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("S"); + objectBuilder << WrapName("GoToR"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("F"); + objectBuilder << fileSpecification; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("D"); + objectBuilder << destination; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("NewWindow"); + objectBuilder << newWindow; + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference actionReference = addObject(objectBuilder.takeObject()); + return actionReference; +} + + +PDFObjectReference PDFDocumentBuilder::createActionLaunch(PDFObjectReference fileSpecification, + bool newWindow) +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Type"); + objectBuilder << WrapName("Action"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("S"); + objectBuilder << WrapName("Launch"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("F"); + objectBuilder << fileSpecification; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("NewWindow"); + objectBuilder << newWindow; + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference actionReference = addObject(objectBuilder.takeObject()); + return actionReference; +} + + +PDFObjectReference PDFDocumentBuilder::createActionLaunchWin(QByteArray fileName, + QByteArray defaultDirectory, + QByteArray action, + QByteArray parameters, + bool newWindow) +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Type"); + objectBuilder << WrapName("Action"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("S"); + objectBuilder << WrapName("Launch"); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("Win"); + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("F"); + objectBuilder << fileName; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("D"); + objectBuilder << defaultDirectory; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("O"); + objectBuilder << action; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("P"); + objectBuilder << parameters; + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("NewWindow"); + objectBuilder << newWindow; + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference actionReference = addObject(objectBuilder.takeObject()); + return actionReference; +} + + PDFObjectReference PDFDocumentBuilder::createActionURI(QString URL) { PDFObjectFactory objectBuilder; @@ -3124,6 +3264,38 @@ 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) +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("UF"); + objectBuilder << fileName; + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("Desc"); + objectBuilder << description; + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObjectReference fileSpecification = addObject(objectBuilder.takeObject()); + return fileSpecification; +} + + PDFObject PDFDocumentBuilder::createTrailerDictionary(PDFObjectReference catalog) { PDFObjectFactory objectBuilder; @@ -3582,14 +3754,6 @@ void PDFDocumentBuilder::setFormFieldValue(PDFObjectReference formField, } -void PDFDocumentBuilder::setLanguage(QLocale locale) -{ - PDFObjectFactory objectBuilder; - - setLanguage(locale.name()); -} - - void PDFDocumentBuilder::setLanguage(QString language) { PDFObjectFactory objectBuilder; @@ -3604,6 +3768,14 @@ void PDFDocumentBuilder::setLanguage(QString language) } +void PDFDocumentBuilder::setLanguage(QLocale locale) +{ + PDFObjectFactory objectBuilder; + + setLanguage(locale.name()); +} + + void PDFDocumentBuilder::setPageArtBox(PDFObjectReference page, QRectF box) { diff --git a/PdfForQtLib/sources/pdfdocumentbuilder.h b/PdfForQtLib/sources/pdfdocumentbuilder.h index 806b529..3bc5f7e 100644 --- a/PdfForQtLib/sources/pdfdocumentbuilder.h +++ b/PdfForQtLib/sources/pdfdocumentbuilder.h @@ -373,6 +373,51 @@ public: PDFObjectReference createActionGoTo(PDFDestination destination); + /// Creates GoTo action. This action changes view to a specific document part. + /// \param documentPart Document part + PDFObjectReference createActionGoToDocumentPart(PDFObjectReference documentPart); + + + /// Creates embedded GoTo action. When executed, action points to destination in another document, + /// which is embedded in this document. + /// \param fileSpecification File specification + /// \param destination Destination in a embedded document + /// \param newWindow Open document in new window + PDFObjectReference createActionGoToEmbedded(PDFObjectReference fileSpecification, + PDFDestination destination, + bool newWindow); + + + /// Creates remote GoTo action. When executed, action points to destination in another document. + /// \param fileSpecification File specification + /// \param destination Destination in a remote document + /// \param newWindow Open document in a new window + PDFObjectReference createActionGoToRemote(PDFObjectReference fileSpecification, + PDFDestination destination, + bool newWindow); + + + /// Creates launch action. Launch action executes document opening or printing. + /// \param fileSpecification File specification + /// \param newWindow Open document in new window + PDFObjectReference createActionLaunch(PDFObjectReference fileSpecification, + bool newWindow); + + + /// Creates launch action. Launch action executes document opening or printing. This variant for + /// Windows operating system, where additional parameters can be specified. + /// \param fileName File name + /// \param defaultDirectory Default directory + /// \param action Action to be performed. Valid values are 'open' or 'print'. + /// \param parameters Command line arguments, which are passed to target application + /// \param newWindow Open document in new window + PDFObjectReference createActionLaunchWin(QByteArray fileName, + QByteArray defaultDirectory, + QByteArray action, + QByteArray parameters, + bool newWindow); + + /// Creates URI action. /// \param URL Target URL PDFObjectReference createActionURI(QString URL); @@ -894,6 +939,18 @@ public: PDFObjectReference createDocumentPartRoot(); + /// Creates file specification for external file. + /// \param fileName File name + PDFObjectReference createFileSpecification(QString fileName); + + + /// Creates file specification for external file. + /// \param fileName File name + /// \param description Description + PDFObjectReference createFileSpecification(QString fileName, + QString description); + + /// 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 @@ -1074,11 +1131,6 @@ public: PDFObject value); - /// Set document language. - /// \param locale Locale, from which is language determined - void setLanguage(QLocale locale); - - /// Set document language. /// \param language Document language. It should be a language identifier, as defined in ISO 639 /// and ISO 3166. For example, "en-US", where first two letter means language code (en = @@ -1086,6 +1138,11 @@ public: void setLanguage(QString language); + /// Set document language. + /// \param locale Locale, from which is language determined + void setLanguage(QLocale locale); + + /// Sets art box to the page. Art box defines page's meaningful content. /// \param page Page /// \param box Box diff --git a/generated_code_definition.xml b/generated_code_definition.xml index c11483d..6ec6866 100644 --- a/generated_code_definition.xml +++ b/generated_code_definition.xml @@ -112,77 +112,6 @@ return pageReference; Appends a new page after last page. _PDFObjectReference - - - - - - - - - - URL - _QString - Target URL - - - Parameters - - _void - - - - - - - - - - - - Type - DictionaryItemSimple - WrapName("Action") - - - - - S - DictionaryItemSimple - WrapName("URI") - - - - - URI - DictionaryItemSimple - URL - - - - Dictionary - - - - CreateObject - actionReference - _PDFObjectReference - - - - - - Code - - _void - return actionReference; - - - Actions - createActionURI - Creates URI action. - _PDFObjectReference - @@ -254,6 +183,431 @@ return pageReference; Creates GoTo action. This action changes view to a specific destination in the same document. _PDFObjectReference + + + + + + + + + + documentPart + _PDFObjectReference + Document part + + + Parameters + + _void + + + + + + + + + + + + Type + DictionaryItemSimple + WrapName("Action") + + + + + S + DictionaryItemSimple + WrapName("GoToDp") + + + + + Dp + DictionaryItemSimple + documentPart + + + + Dictionary + + + + CreateObject + actionReference + _PDFObjectReference + + + + + + Code + + _void + return actionReference; + + + Actions + createActionGoToDocumentPart + Creates GoTo action. This action changes view to a specific document part. + _PDFObjectReference + + + + + + + + + + + fileSpecification + _PDFObjectReference + File specification + + + + + destination + _PDFDestination + Destination in a embedded document + + + + + newWindow + _bool + Open document in new window + + + Parameters + + _void + + + + + + + + + + + + Type + DictionaryItemSimple + WrapName("Action") + + + + + S + DictionaryItemSimple + WrapName("GoToE") + + + + + F + DictionaryItemSimple + fileSpecification + + + + + D + DictionaryItemSimple + destination + + + + + NewWindow + DictionaryItemSimple + newWindow + + + + Dictionary + + + + CreateObject + actionReference + _PDFObjectReference + + + + + + Code + + _void + return actionReference; + + + Actions + createActionGoToEmbedded + Creates embedded GoTo action. When executed, action points to destination in another document, which is embedded in this document. + _PDFObjectReference + + + + + + + + + + + fileSpecification + _PDFObjectReference + File specification + + + + + destination + _PDFDestination + Destination in a remote document + + + + + newWindow + _bool + Open document in a new window + + + Parameters + + _void + + + + + + + + + + + + Type + DictionaryItemSimple + WrapName("Action") + + + + + S + DictionaryItemSimple + WrapName("GoToR") + + + + + F + DictionaryItemSimple + fileSpecification + + + + + D + DictionaryItemSimple + destination + + + + + NewWindow + DictionaryItemSimple + newWindow + + + + Dictionary + + + + CreateObject + actionReference + _PDFObjectReference + + + + + + Code + + _void + return actionReference; + + + Actions + createActionGoToRemote + Creates remote GoTo action. When executed, action points to destination in another document. + _PDFObjectReference + + + + + + + + + + + fileSpecification + _PDFObjectReference + File specification + + + + + newWindow + _bool + Open document in new window + + + Parameters + + _void + + + + + + + + + + + + Type + DictionaryItemSimple + WrapName("Action") + + + + + S + DictionaryItemSimple + WrapName("Launch") + + + + + F + DictionaryItemSimple + fileSpecification + + + + + NewWindow + DictionaryItemSimple + newWindow + + + + Dictionary + + + + CreateObject + actionReference + _PDFObjectReference + + + + + + Code + + _void + return actionReference; + + + Actions + createActionLaunch + Creates launch action. Launch action executes document opening or printing. + _PDFObjectReference + + + + + + + + + + + URL + _QString + Target URL + + + Parameters + + _void + + + + + + + + + + + + Type + DictionaryItemSimple + WrapName("Action") + + + + + S + DictionaryItemSimple + WrapName("URI") + + + + + URI + DictionaryItemSimple + URL + + + + Dictionary + + + + CreateObject + actionReference + _PDFObjectReference + + + + + + Code + + _void + return actionReference; + + + Actions + createActionURI + Creates URI action. + _PDFObjectReference + @@ -5939,6 +6293,134 @@ return rootNodeReference; Creates document part root node (and setups catalog object). _PDFObjectReference + + + + + + + + + + fileName + _QString + File name + + + Parameters + + _void + + + + + + + + + + + + UF + DictionaryItemSimple + fileName + + + + Dictionary + + + + CreateObject + fileSpecification + _PDFObjectReference + + + + + + Code + + _void + return fileSpecification; + + + Structure + createFileSpecification + Creates file specification for external file. + _PDFObjectReference + + + + + + + + + + + fileName + _QString + File name + + + + + description + _QString + Description + + + Parameters + + _void + + + + + + + + + + + + UF + DictionaryItemSimple + fileName + + + + + Desc + DictionaryItemSimple + description + + + + Dictionary + + + + CreateObject + fileSpecification + _PDFObjectReference + + + + + + Code + + _void + return fileSpecification; + + + Structure + createFileSpecification + Creates file specification for external file. + _PDFObjectReference + @@ -8307,5 +8789,148 @@ 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 +