diff --git a/PdfForQtLib/sources/pdfcatalog.cpp b/PdfForQtLib/sources/pdfcatalog.cpp index 34b6240..571d17f 100644 --- a/PdfForQtLib/sources/pdfcatalog.cpp +++ b/PdfForQtLib/sources/pdfcatalog.cpp @@ -180,7 +180,7 @@ PDFCatalog PDFCatalog::parse(const PDFObject& catalog, const PDFDocument* docume PDFCatalog catalogObject; catalogObject.m_viewerPreferences = PDFViewerPreferences::parse(catalog, document); - catalogObject.m_pages = PDFPage::parse(document, catalogDictionary->get("Pages")); + catalogObject.m_pages = PDFPage::parse(&document->getStorage(), catalogDictionary->get("Pages")); catalogObject.m_pageLabels = PDFNumberTreeLoader::parse(&document->getStorage(), catalogDictionary->get("PageLabels")); if (catalogDictionary->hasKey("OCProperties")) diff --git a/PdfForQtLib/sources/pdfdocumentbuilder.cpp b/PdfForQtLib/sources/pdfdocumentbuilder.cpp index 36a2d2e..924ad06 100644 --- a/PdfForQtLib/sources/pdfdocumentbuilder.cpp +++ b/PdfForQtLib/sources/pdfdocumentbuilder.cpp @@ -862,6 +862,113 @@ QRectF PDFDocumentBuilder::getPolygonsBoundingRect(const Polygons& polygons) con return rect; } +void PDFDocumentBuilder::flattenPageTree() +{ + PDFObjectReference pageTreeRoot = getPageTreeRoot(); + PDFObject pageTree = PDFObject::createReference(pageTreeRoot); + std::vector pages = PDFPage::parse(&m_storage, pageTree); + std::vector pageReferences; + + // First, fill inheritable attributes to pages and correct parent + for (const PDFPage& page : pages) + { + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + + objectBuilder.beginDictionaryItem("Parent"); + objectBuilder << pageTreeRoot; + objectBuilder.endDictionaryItem(); + + objectBuilder.beginDictionaryItem("MediaBox"); + objectBuilder << page.getMediaBox(); + objectBuilder.endDictionaryItem(); + + if (page.getCropBox().isValid()) + { + objectBuilder.beginDictionaryItem("CropBox"); + objectBuilder << page.getCropBox(); + objectBuilder.endDictionaryItem(); + } + + if (!page.getResources().isNull()) + { + objectBuilder.beginDictionaryItem("Resources"); + objectBuilder << page.getResources(); + objectBuilder.endDictionaryItem(); + } + + if (page.getPageRotation() != PageRotation::None) + { + PDFInteger angle = 0; + switch (page.getPageRotation()) + { + case PageRotation::Rotate90: + angle = 90; + break; + + case PageRotation::Rotate180: + angle = 180; + break; + + case PageRotation::Rotate270: + angle = 270; + break; + + default: + break; + } + + objectBuilder.beginDictionaryItem("Rotate"); + objectBuilder << angle; + objectBuilder.endDictionaryItem(); + } + + objectBuilder.endDictionary(); + mergeTo(page.getPageReference(), objectBuilder.takeObject()); + pageReferences.push_back(page.getPageReference()); + } + + setPages(pageReferences); +} + +void PDFDocumentBuilder::setPages(const std::vector& pageReferences) +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + + objectBuilder.beginDictionaryItem("Kids"); + objectBuilder.beginArray(); + for (const PDFObjectReference& pageReference : pageReferences) + { + objectBuilder << pageReference; + } + objectBuilder.endArray(); + objectBuilder.endDictionaryItem(); + + objectBuilder.beginDictionaryItem("Count"); + objectBuilder << PDFInteger(pageReferences.size()); + objectBuilder.endDictionaryItem(); + + objectBuilder.endDictionary(); + + mergeTo(getPageTreeRoot(), objectBuilder.takeObject()); +} + +std::vector PDFDocumentBuilder::getPages() const +{ + std::vector result; + + if (const PDFDictionary* pageTreeRoot = m_storage.getDictionaryFromObject(m_storage.getObject(getPageTreeRoot()))) + { + PDFDocumentDataLoaderDecorator loader(&m_storage); + result = loader.readReferenceArrayFromDictionary(pageTreeRoot, "Kids"); + } + + return result; +} + std::vector PDFDocumentBuilder::copyFrom(const std::vector& objects, const PDFObjectStorage& storage, bool createReferences) { // 1) Collect all references, which we must copy. If object is referenced, then @@ -2756,6 +2863,20 @@ PDFObject PDFDocumentBuilder::createTrailerDictionary(PDFObjectReference catalog } +void PDFDocumentBuilder::removeOutline() +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Outlines"); + objectBuilder << PDFObject(); + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObject updatedCatalog = objectBuilder.takeObject(); + mergeTo(getCatalogReference(), updatedCatalog); +} + + void PDFDocumentBuilder::setAnnotationAppearanceState(PDFObjectReference annotation, QByteArray appearanceState) { @@ -3124,6 +3245,54 @@ void PDFDocumentBuilder::updateTrailerDictionary(PDFInteger objectCount) } +void PDFDocumentBuilder::removeThreads() +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("Threads"); + objectBuilder << PDFObject(); + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObject updatedCatalog = objectBuilder.takeObject(); + mergeTo(getCatalogReference(), updatedCatalog); +} + + +void PDFDocumentBuilder::removeDocumentActions() +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("OpenAction"); + objectBuilder << PDFObject(); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("AA"); + objectBuilder << PDFObject(); + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObject updatedCatalog = objectBuilder.takeObject(); + mergeTo(getCatalogReference(), updatedCatalog); +} + + +void PDFDocumentBuilder::removeStructureTree() +{ + PDFObjectFactory objectBuilder; + + objectBuilder.beginDictionary(); + objectBuilder.beginDictionaryItem("StructTreeRoot"); + objectBuilder << PDFObject(); + objectBuilder.endDictionaryItem(); + objectBuilder.beginDictionaryItem("MarkInfo"); + objectBuilder << PDFObject(); + objectBuilder.endDictionaryItem(); + objectBuilder.endDictionary(); + PDFObject updatedCatalog = objectBuilder.takeObject(); + mergeTo(getCatalogReference(), updatedCatalog); +} + + /* END GENERATED CODE */ } // namespace pdf diff --git a/PdfForQtLib/sources/pdfdocumentbuilder.h b/PdfForQtLib/sources/pdfdocumentbuilder.h index ad2fe85..a72e4f6 100644 --- a/PdfForQtLib/sources/pdfdocumentbuilder.h +++ b/PdfForQtLib/sources/pdfdocumentbuilder.h @@ -289,6 +289,19 @@ public: const PDFFormManager* getFormManager() const; void setFormManager(const PDFFormManager* formManager); + /// Flattens page tree, inheritable attributes in non-leaf nodes will + /// be written into the page tree. Templates will be lost. + void flattenPageTree(); + + /// Sets a list of page references to page tree. Page tree must + /// be flattened to use this function. \sa flattenPageTree + /// \param pageReferences Page references + void setPages(const std::vector& pageReferences); + + /// Returns a list of page references. Page tree must + /// be flattened to use this function. \sa flattenPageTree + std::vector getPages() const; + /* START GENERATED CODE */ /// Appends a new page after last page. @@ -810,6 +823,10 @@ public: PDFObject createTrailerDictionary(PDFObjectReference catalog); + /// Removes outline tree from document catalog. + void removeOutline(); + + /// Sets annotation appearance state. /// \param annotation Annotation /// \param appearanceState Appearance state @@ -971,6 +988,18 @@ public: void updateTrailerDictionary(PDFInteger objectCount); + /// Removes threads from document catalog. + void removeThreads(); + + + /// Removes document actions from document catalog. + void removeDocumentActions(); + + + /// Removes structure tree from document catalog. + void removeStructureTree(); + + /* END GENERATED CODE */ private: diff --git a/PdfForQtLib/sources/pdfoptimizer.h b/PdfForQtLib/sources/pdfoptimizer.h index cd23ac0..89574dc 100644 --- a/PdfForQtLib/sources/pdfoptimizer.h +++ b/PdfForQtLib/sources/pdfoptimizer.h @@ -94,4 +94,6 @@ private: } // namespace pdf +Q_DECLARE_OPERATORS_FOR_FLAGS(pdf::PDFOptimizer::OptimizationFlags) + #endif // PDFOPTIMIZER_H diff --git a/PdfForQtLib/sources/pdfpage.cpp b/PdfForQtLib/sources/pdfpage.cpp index 7178c0b..283b8b7 100644 --- a/PdfForQtLib/sources/pdfpage.cpp +++ b/PdfForQtLib/sources/pdfpage.cpp @@ -25,14 +25,14 @@ namespace pdf PDFPageInheritableAttributes PDFPageInheritableAttributes::parse(const PDFPageInheritableAttributes& templateAttributes, const PDFObject& dictionary, - const PDFDocument* document) + const PDFObjectStorage* storage) { PDFPageInheritableAttributes result(templateAttributes); - const PDFObject& dereferencedDictionary = document->getObject(dictionary); + const PDFObject& dereferencedDictionary = storage->getObject(dictionary); if (dereferencedDictionary.isDictionary()) { - PDFDocumentDataLoaderDecorator loader(document); + PDFDocumentDataLoaderDecorator loader(storage); const PDFDictionary* dictionary = dereferencedDictionary.getDictionary(); if (dictionary->hasKey("MediaBox")) @@ -106,11 +106,11 @@ PageRotation PDFPageInheritableAttributes::getPageRotation() const return PageRotation::None; } -std::vector PDFPage::parse(const PDFDocument* document, const PDFObject& root) +std::vector PDFPage::parse(const PDFObjectStorage* storage, const PDFObject& root) { std::vector result; std::set visited; - parseImpl(result, visited, PDFPageInheritableAttributes(), root, document); + parseImpl(result, visited, PDFPageInheritableAttributes(), root, storage); return result; } @@ -228,24 +228,24 @@ void PDFPage::parseImpl(std::vector& pages, std::set& visitedReferences, const PDFPageInheritableAttributes& templateAttributes, const PDFObject& root, - const PDFDocument* document) + const PDFObjectStorage* storage) { // Are we in internal node, or leaf (page object)? PDFObjectReference objectReference = root.isReference() ? root.getReference() : PDFObjectReference(); - const PDFObject& dereferenced = document->getObject(root); + const PDFObject& dereferenced = storage->getObject(root); if (dereferenced.isDictionary()) { const PDFDictionary* dictionary = dereferenced.getDictionary(); - const PDFObject& typeObject = document->getObject(dictionary->get("Type")); + const PDFObject& typeObject = storage->getObject(dictionary->get("Type")); if (typeObject.isName()) { - PDFPageInheritableAttributes currentInheritableAttributes = PDFPageInheritableAttributes::parse(templateAttributes, root, document); + PDFPageInheritableAttributes currentInheritableAttributes = PDFPageInheritableAttributes::parse(templateAttributes, root, storage); QByteArray typeString = typeObject.getString(); if (typeString == "Pages") { - const PDFObject& kids = document->getObject(dictionary->get("Kids")); + const PDFObject& kids = storage->getObject(dictionary->get("Kids")); if (kids.isArray()) { const PDFArray* kidsArray = kids.getArray(); @@ -268,7 +268,7 @@ void PDFPage::parseImpl(std::vector& pages, } visitedReferences.insert(kid.getReference()); - parseImpl(pages, visitedReferences, currentInheritableAttributes, kid, document); + parseImpl(pages, visitedReferences, currentInheritableAttributes, kid, storage); } } else @@ -284,7 +284,7 @@ void PDFPage::parseImpl(std::vector& pages, page.m_pageReference = objectReference; page.m_mediaBox = currentInheritableAttributes.getMediaBox(); page.m_cropBox = currentInheritableAttributes.getCropBox(); - page.m_resources = document->getObject(currentInheritableAttributes.getResources()); + page.m_resources = storage->getObject(currentInheritableAttributes.getResources()); page.m_pageRotation = currentInheritableAttributes.getPageRotation(); if (!page.m_cropBox.isValid()) @@ -292,11 +292,11 @@ void PDFPage::parseImpl(std::vector& pages, page.m_cropBox = page.m_mediaBox; } - PDFDocumentDataLoaderDecorator loader(document); + PDFDocumentDataLoaderDecorator loader(storage); page.m_bleedBox = loader.readRectangle(dictionary->get("BleedBox"), page.getCropBox()); page.m_trimBox = loader.readRectangle(dictionary->get("TrimBox"), page.getCropBox()); page.m_artBox = loader.readRectangle(dictionary->get("ArtBox"), page.getCropBox()); - page.m_contents = document->getObject(dictionary->get("Contents")); + page.m_contents = storage->getObject(dictionary->get("Contents")); page.m_annots = loader.readReferenceArrayFromDictionary(dictionary, "Annots"); page.m_lastModified = PDFEncoding::convertToDateTime(loader.readStringFromDictionary(dictionary, "LastModified")); page.m_thumbnailReference = loader.readReferenceFromDictionary(dictionary, "Thumb"); diff --git a/PdfForQtLib/sources/pdfpage.h b/PdfForQtLib/sources/pdfpage.h index d657ad5..b102968 100644 --- a/PdfForQtLib/sources/pdfpage.h +++ b/PdfForQtLib/sources/pdfpage.h @@ -94,8 +94,8 @@ public: /// Parses inheritable attributes from the page tree node /// \param templateAttributes Template attributes /// \param dictionary Dictionary, from which the data will be read - /// \param document Document owning this data - static PDFPageInheritableAttributes parse(const PDFPageInheritableAttributes& templateAttributes, const PDFObject& dictionary, const PDFDocument* document); + /// \param storage Storage owning this data + static PDFPageInheritableAttributes parse(const PDFPageInheritableAttributes& templateAttributes, const PDFObject& dictionary, const PDFObjectStorage* storage); const QRectF& getMediaBox() const { return m_mediaBox; } const QRectF& getCropBox() const { return m_cropBox; } @@ -117,9 +117,9 @@ public: explicit PDFPage() = default; /// Parses the page tree. If error occurs, then exception is thrown. - /// \param document Document owning this tree + /// \param storage Storage owning this tree /// \param root Root object of page tree - static std::vector parse(const PDFDocument* document, const PDFObject& root); + static std::vector parse(const PDFObjectStorage* storage, const PDFObject& root); inline const QRectF& getMediaBox() const { return m_mediaBox; } inline const QRectF& getCropBox() const { return m_cropBox; } @@ -249,12 +249,12 @@ private: /// \param visitedReferences Visited references (to check cycles in page tree and avoid hangup) /// \param templateAttributes Template attributes (inheritable attributes defined in parent) /// \param root Root object of page tree - /// \param document Document owning this tree + /// \param storage Storage owning this tree static void parseImpl(std::vector& pages, std::set& visitedReferences, const PDFPageInheritableAttributes& templateAttributes, const PDFObject& root, - const PDFDocument* document); + const PDFObjectStorage* storage); /// Returns object from page dictionary. This function requires, /// that storage of object is present, for object fetching. Objects diff --git a/PdfTool/PdfTool.pro b/PdfTool/PdfTool.pro index 34c30c0..002be2e 100644 --- a/PdfTool/PdfTool.pro +++ b/PdfTool/PdfTool.pro @@ -55,6 +55,7 @@ SOURCES += \ pdftoolinfopageboxes.cpp \ pdftoolinfostructuretree.cpp \ pdftoolrender.cpp \ + pdftoolseparate.cpp \ pdftoolverifysignatures.cpp \ pdftoolxml.cpp @@ -83,5 +84,6 @@ HEADERS += \ pdftoolinfopageboxes.h \ pdftoolinfostructuretree.h \ pdftoolrender.h \ + pdftoolseparate.h \ pdftoolverifysignatures.h \ pdftoolxml.h diff --git a/PdfTool/pdftoolabstractapplication.cpp b/PdfTool/pdftoolabstractapplication.cpp index 391398c..cb88864 100644 --- a/PdfTool/pdftoolabstractapplication.cpp +++ b/PdfTool/pdftoolabstractapplication.cpp @@ -164,6 +164,11 @@ void PDFToolAbstractApplication::initializeCommandLineParser(QCommandLineParser* parser->addOption(QCommandLineOption("no-permissive-reading", "Do not attempt to fix damaged documents.")); } + if (optionFlags.testFlag(Separate)) + { + parser->addPositionalArgument("pattern", "Page pattern, must contain '%' character if multiple pages are selected."); + } + if (optionFlags.testFlag(SignatureVerification)) { parser->addOption(QCommandLineOption("ver-no-user-cert", "Disable user certificate store.")); @@ -361,6 +366,11 @@ PDFToolOptions PDFToolAbstractApplication::getOptions(QCommandLineParser* parser options.permissiveReading = !parser->isSet("no-permissive-reading"); } + if (optionFlags.testFlag(Separate)) + { + options.separatePagePattern = positionalArguments.size() >= 2 ? positionalArguments[1] : QString(); + } + if (optionFlags.testFlag(SignatureVerification)) { options.verificationUseUserCertificates = !parser->isSet("ver-no-user-cert"); diff --git a/PdfTool/pdftoolabstractapplication.h b/PdfTool/pdftoolabstractapplication.h index fec086e..516eb39 100644 --- a/PdfTool/pdftoolabstractapplication.h +++ b/PdfTool/pdftoolabstractapplication.h @@ -129,6 +129,9 @@ struct PDFToolOptions int renderMSAAsamples = 4; int renderRasterizerCount = pdf::PDFRasterizerPool::getDefaultRasterizerCount(); + // For option 'Separate' + QString separatePagePattern; + /// Returns page range. If page range is invalid, then \p errorMessage is empty. /// \param pageCount Page count /// \param[out] errorMessage Error message @@ -194,6 +197,7 @@ public: ImageExportSettingsResolution = 0x00008000, ///< Settings for resolution of exported images ColorManagementSystem = 0x00010000, ///< Color management system settings RenderFlags = 0x00020000, ///< Render flags for page image rasterizer + Separate = 0x00040000, ///< Settings for Separate tool }; Q_DECLARE_FLAGS(Options, Option) diff --git a/PdfTool/pdftoolseparate.cpp b/PdfTool/pdftoolseparate.cpp new file mode 100644 index 0000000..14ab6c6 --- /dev/null +++ b/PdfTool/pdftoolseparate.cpp @@ -0,0 +1,140 @@ +// Copyright (C) 2020 Jakub Melka +// +// This file is part of PdfForQt. +// +// PdfForQt is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// PdfForQt is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with PDFForQt. If not, see . + +#include "pdftoolseparate.h" +#include "pdfdocumentbuilder.h" +#include "pdfexception.h" +#include "pdfoptimizer.h" +#include "pdfdocumentwriter.h" + +namespace pdftool +{ + +static PDFToolSeparate s_toolSeparateApplication; + +QString PDFToolSeparate::getStandardString(StandardString standardString) const +{ + switch (standardString) + { + case Command: + return "separate"; + + case Name: + return PDFToolTranslationContext::tr("Extract pages"); + + case Description: + return PDFToolTranslationContext::tr("Separate document into single page documents."); + + default: + Q_ASSERT(false); + break; + } + + return QString(); +} + +int PDFToolSeparate::execute(const PDFToolOptions& options) +{ + pdf::PDFDocument document; + QByteArray sourceData; + if (!readDocument(options, document, &sourceData)) + { + return ErrorDocumentReading; + } + + if (!document.getStorage().getSecurityHandler()->isAllowed(pdf::PDFSecurityHandler::Permission::CopyContent)) + { + PDFConsole::writeError(PDFToolTranslationContext::tr("Document doesn't allow to copy content."), options.outputCodec); + return ErrorPermissions; + } + + QString parseError; + std::vector pageIndices = options.getPageRange(document.getCatalog()->getPageCount(), parseError, true); + + if (!parseError.isEmpty()) + { + PDFConsole::writeError(parseError, options.outputCodec); + return ErrorInvalidArguments; + } + + if (options.separatePagePattern.isEmpty()) + { + PDFConsole::writeError(PDFToolTranslationContext::tr("File template is empty."), options.outputCodec); + return ErrorInvalidArguments; + } + + if (!options.separatePagePattern.contains("%")) + { + PDFConsole::writeError(PDFToolTranslationContext::tr("File template must contain character '%' for page number."), options.outputCodec); + return ErrorInvalidArguments; + } + + for (pdf::PDFInteger pageIndex : pageIndices) + { + try + { + pdf::PDFDocumentBuilder documentBuilder(&document); + documentBuilder.flattenPageTree(); + std::vector pageReferences = documentBuilder.getPages(); + std::vector singlePageRef = { pageReferences[pageIndex] }; + documentBuilder.setPages(singlePageRef); + documentBuilder.removeOutline(); + documentBuilder.removeThreads(); + documentBuilder.removeDocumentActions(); + documentBuilder.removeStructureTree(); + + pdf::PDFDocument singlePageDocument = documentBuilder.build(); + + // Optimize document - remove unused objects and shrink object storage + pdf::PDFOptimizer optimizer(pdf::PDFOptimizer::RemoveUnusedObjects | pdf::PDFOptimizer::ShrinkObjectStorage, nullptr); + optimizer.setDocument(&singlePageDocument); + optimizer.optimize(); + singlePageDocument = optimizer.takeOptimizedDocument(); + + QString fileName = options.separatePagePattern; + fileName.replace('%', QString::number(pageIndex + 1)); + + if (QFileInfo::exists(fileName)) + { + PDFConsole::writeError(PDFToolTranslationContext::tr("File '%1' already exists. Page %2 was not extracted.").arg(fileName).arg(pageIndex + 1), options.outputCodec); + } + else + { + pdf::PDFDocumentWriter writer(nullptr); + pdf::PDFOperationResult result = writer.write(fileName, &singlePageDocument, false); + if (!result) + { + PDFConsole::writeError(result.getErrorMessage(), options.outputCodec); + } + } + } + catch (pdf::PDFException exception) + { + PDFConsole::writeError(exception.getMessage(), options.outputCodec); + } + } + + return ExitSuccess; +} + +PDFToolAbstractApplication::Options PDFToolSeparate::getOptionsFlags() const +{ + return ConsoleFormat | OpenDocument | PageSelector | Separate; +} + + +} // namespace pdftool diff --git a/PdfTool/pdftoolseparate.h b/PdfTool/pdftoolseparate.h new file mode 100644 index 0000000..f7a7401 --- /dev/null +++ b/PdfTool/pdftoolseparate.h @@ -0,0 +1,36 @@ +// Copyright (C) 2020 Jakub Melka +// +// This file is part of PdfForQt. +// +// PdfForQt is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// PdfForQt is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with PDFForQt. If not, see . + +#ifndef PDFTOOLSEPARATE_H +#define PDFTOOLSEPARATE_H + +#include "pdftoolabstractapplication.h" + +namespace pdftool +{ + +class PDFToolSeparate : public PDFToolAbstractApplication +{ +public: + virtual QString getStandardString(StandardString standardString) const override; + virtual int execute(const PDFToolOptions& options) override; + virtual Options getOptionsFlags() const override; +}; + +} // namespace pdftool + +#endif // PDFTOOLSEPARATE_H diff --git a/generated_code_definition.xml b/generated_code_definition.xml index 57b832e..708b342 100644 --- a/generated_code_definition.xml +++ b/generated_code_definition.xml @@ -5763,6 +5763,47 @@ return annotationObject; This function is used to create a new trailer dictionary, when blank document is created. Do not call this function manually. _PDFObject + + + + + + + + + + + + + Outlines + DictionaryItemSimple + PDFObject() + + + + Dictionary + + + + CreateObject + updatedCatalog + _PDFObject + + + + + + Code + + _void + mergeTo(getCatalogReference(), updatedCatalog); + + + Structure + removeOutline + Removes outline tree from document catalog. + _void + @@ -7289,5 +7330,142 @@ updateDocumentInfo(qMove(updatedInfoDictionary)); This function is used to update trailer dictionary. Must be called each time the final document is being built. _void + + + + + + + + + + + + + Threads + DictionaryItemSimple + PDFObject() + + + + Dictionary + + + + CreateObject + updatedCatalog + _PDFObject + + + + + + Code + + _void + mergeTo(getCatalogReference(), updatedCatalog); + + + Structure + removeThreads + Removes threads from document catalog. + _void + + + + + + + + + + + + + + OpenAction + DictionaryItemSimple + PDFObject() + + + + + AA + DictionaryItemSimple + PDFObject() + + + + Dictionary + + + + CreateObject + updatedCatalog + _PDFObject + + + + + + Code + + _void + mergeTo(getCatalogReference(), updatedCatalog); + + + Structure + removeDocumentActions + Removes document actions from document catalog. + _void + + + + + + + + + + + + + + StructTreeRoot + DictionaryItemSimple + PDFObject() + + + + + MarkInfo + DictionaryItemSimple + PDFObject() + + + + Dictionary + + + + CreateObject + updatedCatalog + _PDFObject + + + + + + Code + + _void + mergeTo(getCatalogReference(), updatedCatalog); + + + Structure + removeStructureTree + Removes structure tree from document catalog. + _void +