PDF SDK Documentation

Comprehensive Guide for Developers: Features, Integration, and API Reference

Loading...
Searching...
No Matches
document.h
1// Copyright (c) 2009-2025 Avanquest Software. All rights reserved.
2
3#ifndef PDFSDK_CXX_PDF_DOCUMENT_H_INCLUDED_
4#define PDFSDK_CXX_PDF_DOCUMENT_H_INCLUDED_
5
6#include <cstdint>
7#include <filesystem>
8#include <memory>
9#include <span>
10#include <string>
11#include <vector>
12
13#include <pdfsdk/core/types.h>
14#include <pdfsdk/cxx/bytes.h>
15#include <pdfsdk/cxx/math.h>
16#include <pdfsdk/cxx/progress_monitor.h>
17
18#include "forward_declarations.h"
19#include "standard_security.h"
20#include "wrapper_base.h"
21
22namespace PDF {
23
27class Document : public detail::RefCountedHandle<PDDoc> {
28public:
37 static Document OpenDocument(const std::filesystem::path& path,
38 const std::wstring& password = std::wstring());
39
50 static Document OpenDocumentFromMemory(std::span<const Byte> data,
51 bool copy = false,
52 const std::wstring& password = std::wstring());
53
64 static Document OpenDocumentFromStream(std::shared_ptr<IDataSource> source,
65 const std::wstring& password = std::wstring());
66
75 static Document NewDocument(const RectF& mediaBox = RectF(0.0f, 792.0f, 612.0f, 0.0f));
76
81 bool IsCompressed() const;
82
87 bool IsModified() const;
88
93 void SetModified(bool modified);
94
99 bool IsRepaired() const;
100
105 std::filesystem::path GetFilePath() const;
106
111 uint64_t GetFileSize() const;
112
118
139 void Save(const std::filesystem::path& path,
140 PDDocSaveFlags flags = kPDDocSaveFull | kPDDocSaveCompressed,
141 ProgressMonitor* progmon = nullptr,
142 const PDOptSaveSettings* optSettings = nullptr,
143 const PDVersion* version = nullptr);
144
162 PDDocSaveFlags flags = kPDDocSaveFull | kPDDocSaveCompressed,
163 ProgressMonitor* progmon = nullptr,
164 const PDOptSaveSettings* optSettings = nullptr,
165 const PDVersion* version = nullptr);
166
171 size_t GetNumPages() const;
172
178 Page GetPage(size_t index) const;
179
187 Page CreatePage(size_t insertAt, const RectF& mediaBox);
188
196 void CreatePages(size_t insertAt, size_t count, const RectF& mediaBox);
197
205 void DeletePages(const std::vector<size_t>& pageIndexes, ProgressMonitor* mon = nullptr);
206
211 void DeletePage(size_t index);
212
221 void InsertPages(size_t insertAt, const Document& sourceDoc, const std::vector<size_t>& sourcePageIndexes = {}, ProgressMonitor* mon = nullptr);
222
228 void InsertPage(const Page& page, size_t insertAt);
229
238 void MovePages(size_t insertAt, const std::vector<size_t>& pageIndexes, ProgressMonitor* mon = nullptr);
239
249 std::wstring GetInfoString(PDAtom infoDictKey) const;
250
261 void SetInfoString(PDAtom infoDictKey, const std::wstring& infoValue);
262
268 std::string GetXmpMetadata() const;
269
275 void SetXmpMetadata(const std::string& xmpPacket);
276
281 PDFAFlavor GetPDFAFlavor() const;
282
294
305 void SetCreationDate(const PDDateTime& date);
306
318
329 void SetModDate(const PDDateTime& date);
330
341 void SetPageLayout(PDAtom layout);
342
353 PDAtom GetPageLayout() const;
354
365 void SetPageMode(PDAtom mode);
366
377 PDAtom GetPageMode() const;
378
391
404
419
434 const RectF& bbox,
435 float xStep,
436 float yStep,
437 const Content& content);
438
446
460 Font CreateFontFromInfo(const PDFontInfo& fontInfo, bool forceSysFont = true, PDEFontCreateFlags createFlags = kPDEFontCreateFlagsDefault);
461
468 Font CreateFontEmbeddedCopy(const Font& font, PDEFontCreateFlags createFlags = kPDEFontCreateFlagsDefault);
469
477 Font ConvertFontToType0(const Font& font, PDEFontCreateFlags createFlags = kPDEFontCreateFlagsDefault);
478
490 template<class EnumProc>
491 void EnumFonts(EnumProc enumProc, ProgressMonitor* mon = nullptr) const;
492
500 size_t GetNumFormFields() const;
501
510 FormField GetFormField(size_t index) const;
511
520
529
541 FormField CreateFormField(const std::wstring& fullname, PDAtom type, PDFieldFlags flags);
542
549 FormField FindFormField(const std::wstring& fullname) const;
550
557 void RenameFormField(FormField field, const std::wstring& fullname);
558
569 void ExportFormFDF(const std::filesystem::path& path,
570 std::span<const FormField> fields = std::span<const FormField>(),
571 bool exclude = true);
572
584 std::vector<Byte> ExportFormFDFToMemory(std::span<const FormField> fields = std::span<const FormField>(),
585 bool exclude = true);
586
598 std::span<const FormField> fields = std::span<const FormField>(),
599 bool exclude = true);
600
608 void ImportFormFDF(const std::filesystem::path& path);
609
617 void ImportFormFDFFromMemory(std::span<const Byte> data);
618
628
639 void ExportFormXFDF(const std::filesystem::path& path,
640 std::span<const FormField> fields = std::span<const FormField>(),
641 bool exclude = true);
642
654 std::vector<Byte> ExportFormXFDFToMemory(std::span<const FormField> fields = std::span<const FormField>(),
655 bool exclude = true);
656
668 std::span<const FormField> fields = std::span<const FormField>(),
669 bool exclude = true);
670
678 void ImportFormXFDF(const std::filesystem::path& path);
679
687 void ImportFormXFDFFromMemory(std::span<const Byte> data);
688
698
708 Object CreateActionFieldsData(std::span<const FormField> fields);
709
721 void ResetForm(std::span<const FormField> fields = std::span<const FormField>(),
722 PDResetFormFlags flags = kPDResetFormFlagExclude);
723
731 bool IsSigned() const;
732
739 void SaveSignedVersion(FormField sigField, const std::filesystem::path& path) const;
740
751 Action CreateActionURI(const std::string& uri);
752
764
773 Action CreateActionGoToR(const FileSpec& fileSpec, size_t pageIndex);
774
784 Action CreateActionJavaScript(const std::wstring& jscode);
785
795 Action CreateActionSubmitForm(const std::string& serverUri);
796
806
816
828
836 void SetOpenAction(Action action);
837
843
857 Dest CreateDestXYZ(size_t pageIndex, const PointF& xy, float zoom, bool isRemote = false);
858
869 Dest CreateDestFit(size_t pageIndex, bool isRemote = false);
870
881 Dest CreateDestFitH(size_t pageIndex, float top, bool isRemote = false);
882
893 Dest CreateDestFitV(size_t pageIndex, float left, bool isRemote = false);
894
905 Dest CreateDestFitR(size_t pageIndex, const RectF& rect, bool isRemote = false);
906
916 Dest CreateDestFitB(size_t pageIndex, bool isRemote = false);
917
928 Dest CreateDestFitBH(size_t pageIndex, float top, bool isRemote = false);
929
940 Dest CreateDestFitBV(size_t pageIndex, float left, bool isRemote = false);
941
947
953
959 template<class EnumProc>
960 void EnumDocLevelJSActions(EnumProc enumProc) const;
961
968 Action GetDocLevelJSAction(std::string_view name) const;
969
974
982 FileSpec GetAttachment(std::string_view name) const;
983
989 template<class EnumProc>
990 void EnumAttachments(EnumProc enumProc) const;
991
998 void AddAttachment(std::string_view name, FileSpec filespec);
999
1005 void RemoveAttachment(std::string_view name);
1006
1011 size_t GetNumAttachments() const;
1012
1018 std::string GetAttachmentNameByIndex(size_t index) const;
1019
1026 FileSpec CreateFileSpec(PDAtom fileSys, const std::wstring& path);
1027
1034 FileSpec CreateEmbeddedFile(const std::wstring& path);
1035
1040 size_t GetNumOutputIntents() const;
1041
1047 OutputIntent GetOutputIntent(size_t index) const;
1048
1054
1060
1070
1079
1104
1120 void SetOCConfig(const OCConfig& config);
1121
1132 size_t GetNumOCAltConfigs() const;
1133
1145 OCConfig GetOCAltConfig(size_t index) const;
1146
1161 OCGroup CreateOCGroup(const std::wstring& name);
1162
1170 size_t GetNumOCGroups() const;
1171
1181 OCGroup GetOCGroup(size_t index) const;
1182
1190
1198
1205
1215
1224 Annot CreateLinkAnnot(const RectF& rect, Action action);
1225
1236 Annot CreateTextMarkupAnnot(PDAtom type, PDColorValue color, const QuadPoints& quads);
1237
1249 Annot CreateInkAnnot(PDColorValue color, float lineWidth, const std::vector<std::vector<PointF>>& points);
1250
1263
1275 Annot CreateStampAnnot(const RectF& rect, const XObject& appearance);
1276
1287 Annot CreateWidgetAnnot(const FormField& field, const RectF& rect);
1288
1297 Annot CreateFileAttachmentAnnot(const FileSpec& fileSpec, const RectF& rect);
1298
1308
1317 Object GetObjectByID(uint32_t id) const;
1318
1329
1340
1350 Object CreateBoolObject(bool value, bool indirect = false);
1351
1361 Object CreateIntObject(int64_t value, bool indirect = false);
1362
1372 Object CreateRealObject(float value, bool indirect = false);
1373
1384 Object CreateStringObjectUnicode(const std::wstring& unicode, bool indirect = false);
1385
1397 Object CreateStringObject(const std::string& bytes, bool hex = false, bool indirect = false);
1398
1410 Object CreateNameObject(PDAtom value, bool indirect = false);
1411
1423
1435 Object CreateDictObject(bool indirect);
1436
1449 Object CreateStreamObject(std::span<const Byte> data, const Object& attributesDict, const Object& encodeParms, bool encodeSource);
1450
1456 Object CopyObject(const Object& source);
1457
1467
1478
1488 void SetStandardSecurityParams(const StdSecurityParams& requestedParams);
1489
1494
1502 bool IsEncrypted() const;
1503
1512 bool RequestPermission(PDPermReqObj object, PDPermReqOp operation, const std::wstring& password = std::wstring()) const;
1513
1529 XObject ImportIcon(const Document& source, size_t pageIndex = 0);
1530
1541 void CreatePageFromIcon(size_t insertAt, const Document& iconDoc, const XObject& icon);
1542
1552 bool IsTaggedPDF() const;
1553
1554 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(Document, PDDoc)
1555};
1556
1557} // namespace PDF
1558
1559#include "document_impl.inl"
1560
1561#endif // PDFSDK_CXX_PDF_DOCUMENT_H_INCLUDED_
Represents an action in a PDF document.
Definition action.h:32
Represents an annotation in a PDF document.
Definition annot.h:24
Represents a bookmark/outline item in a PDF document.
Definition bookmark.h:33
Represents a content array.
Definition content.h:29
Represents a destination in a PDF document.
Definition dest.h:31
Bookmark CreateRootBookmark()
Creates a root bookmark for the document.
Action CreateActionGoTo(Dest dest)
Creates a GoTo action with the specified destination.
Action GetOpenAction() const
Gets the open action of the document.
std::vector< Byte > ExportFormFDFToMemory(std::span< const FormField > fields=std::span< const FormField >(), bool exclude=true)
Exports the form field values to an in-memory Forms Data Format (FDF) buffer.
Dest CreateDestFitV(size_t pageIndex, float left, bool isRemote=false)
Creates a destination that fits the height of the page.
Pattern CreatePatternShading(const Shading &shading)
Creates a pattern object in the document using the specified pattern shading. A shading pattern objec...
OCGroup GetOCGroup(size_t index) const
Gets the optional content group at the specified index.
Action GetDocLevelJSAction(std::string_view name) const
Gets the document-level JavaScript action with the specified name.
void ImportFormXFDFFromMemory(std::span< const Byte > data)
Imports form field values from an in-memory XFDF (XML Forms Data Format) buffer.
std::vector< Byte > ExportFormXFDFToMemory(std::span< const FormField > fields=std::span< const FormField >(), bool exclude=true)
Exports the form field values to an in-memory XFDF (XML Forms Data Format) buffer.
void ImportFormXFDFFromStream(IDataSource &source)
Imports form field values from an XFDF byte source.
void MovePages(size_t insertAt, const std::vector< size_t > &pageIndexes, ProgressMonitor *mon=nullptr)
Moves pages within the document to a new position.
Object CreateStringObjectUnicode(const std::wstring &unicode, bool indirect=false)
Creates a literal string object from a Unicode string.
Annot CreateStampAnnot(const RectF &rect, const XObject &appearance)
Creates a (rubber) stamp annotation with the specified rectangle and appearance.
Object CreateRealObject(float value, bool indirect=false)
Creates a real number object.
void InsertPages(size_t insertAt, const Document &sourceDoc, const std::vector< size_t > &sourcePageIndexes={}, ProgressMonitor *mon=nullptr)
Inserts pages from another document into the current document.
OutputIntent GetOutputIntent(size_t index) const
Gets an Output Intent by index.
FileSpec CreateEmbeddedFile(const std::wstring &path)
Creates an embedded file with the specified path.
void SetInfoString(PDAtom infoDictKey, const std::wstring &infoValue)
Sets the information string associated with the specified info string atom.
void RemoveFormField(FormField field)
Removes the specified form field from the document.
static Document OpenDocument(const std::filesystem::path &path, const std::wstring &password=std::wstring())
Opens a PDF file from the specified path.
uint64_t GetFileSize() const
Gets the file size of the document.
Annot CreateLinkAnnot(const RectF &rect, Action action)
Creates a link annotation with the specified rectangle and action.
bool IsCompressed() const
Checks if the document is compressed.
void ExportFormFDF(const std::filesystem::path &path, std::span< const FormField > fields=std::span< const FormField >(), bool exclude=true)
Exports the form field values to a Forms Data Format (FDF) file.
Object CreateIntObject(int64_t value, bool indirect=false)
Creates an integer value object.
void CreatePages(size_t insertAt, size_t count, const RectF &mediaBox)
Creates multiple pages starting at the specified index with the given media box.
Object CreateDictObject(bool indirect)
Creates a dictionary object.
void RemoveDocLevelJS()
Removes the document-level JavaScript actions.
void ImportFormFDF(const std::filesystem::path &path)
Imports form field values from a Forms Data Format (FDF) file.
void RemoveStructTree()
Removes the document's logical structure tree.
OCConfig GetOCAltConfig(size_t index) const
Gets the alternate optional content configuration at the given index.
Action CreateActionGoToR(const FileSpec &fileSpec, size_t pageIndex)
Creates a GoToR action with the specified file specification and page index.
FormField FindFormField(const std::wstring &fullname) const
Finds a form field with the specified full name.
Dest CreateDestXYZ(size_t pageIndex, const PointF &xy, float zoom, bool isRemote=false)
Creates a destination with XYZ coordinates and zoom level.
Pattern CreatePatternTiling(PDETilingPatternPaintType paintType, PDETilingPatternTilingType tilingType, const RectF &bbox, float xStep, float yStep, const Content &content)
Creates a pattern object in the document using the specified pattern paint type.
FormField CreateFormField(const std::wstring &fullname, PDAtom type, PDFieldFlags flags)
Creates a new form field with the specified name, type, and flags.
Dest CreateDestFitBH(size_t pageIndex, float top, bool isRemote=false)
Creates a destination that fits the width of the bounding box of the page.
void SaveToStream(IWriteSink &sink, PDDocSaveFlags flags=kPDDocSaveFull|kPDDocSaveCompressed, ProgressMonitor *progmon=nullptr, const PDOptSaveSettings *optSettings=nullptr, const PDVersion *version=nullptr)
Saves the document to a caller-supplied sink.
void SetModDate(const PDDateTime &date)
Sets the modification date of the document.
std::filesystem::path GetFilePath() const
Gets the file path of the document.
Dest CreateDestFit(size_t pageIndex, bool isRemote=false)
Creates a destination that fits the entire page.
void AddOutputIntent(const OutputIntent &oi)
Adds an Output Intent to the document.
Action CreateActionJavaScript(const std::wstring &jscode)
Creates a JavaScript action with the specified JavaScript code.
size_t GetNumPages() const
Gets the number of pages in the document.
void SetPageLayout(PDAtom layout)
Sets the page layout of the document.
Dest CreateDestFitH(size_t pageIndex, float top, bool isRemote=false)
Creates a destination that fits the width of the page.
Object CreateBoolObject(bool value, bool indirect=false)
Creates a boolean value object.
PDVersion GetFileVersion() const
Gets the PDF version of the document.
Object GetInfoObject() const
Gets the info object of the document.
size_t GetNumOCAltConfigs() const
Gets the number of alternate optional content configurations.
OCGroup CreateOCGroup(const std::wstring &name)
Creates an optional content group with the specified name.
FormField GetFormField(size_t index) const
Gets the form field at the specified index.
size_t GetNumOCGroups() const
Gets the number of optional content groups in the document.
void ExportFormXFDF(const std::filesystem::path &path, std::span< const FormField > fields=std::span< const FormField >(), bool exclude=true)
Exports the form field values to an XFDF (XML Forms Data Format) file.
bool IsRepaired() const
Allows to check if the document was repaired during the opening process.
void SetOpenDestination(Dest dest)
Sets the open destination for the document.
StdSecurityParams GetStandardSecurityParams() const
Gets the standard security parameters of the document.
Annot CreateTextAnnot(const RectF &rect)
Creates a text annotation with the specified dimensions.
void ImportFormFDFFromStream(IDataSource &source)
Imports form field values from an FDF byte source.
void RemoveSecurity()
Removes any security handler and encryption applied to the document.
bool IsEncrypted() const
Checks if the document is encrypted.
Dest CreateDestFitBV(size_t pageIndex, float left, bool isRemote=false)
Creates a destination that fits the height of the bounding box of the page.
Annot CreateFreeTextAnnot(const RectF &rect)
Creates a free text annotation with the specified rectangle.
std::string GetXmpMetadata() const
Gets full XMP metadata packet for document.
void SetOpenAction(Action action)
Sets the open action for the document.
void EnumDocLevelJSActions(EnumProc enumProc) const
Enumerates the document-level JavaScript actions.
FileSpec GetAttachment(std::string_view name) const
Gets the attachment with the specified name.
void RemoveAttachment(std::string_view name)
Removes the attachment with the specified name.
Object GetRootObject() const
Gets the root object of the document.
Object CreateActionFieldsData(std::span< const FormField > fields)
Creates an action fields-data object referencing the given form fields.
PDPageDirection GetPageDirection() const
Gets the page direction of the document.
static Document OpenDocumentFromMemory(std::span< const Byte > data, bool copy=false, const std::wstring &password=std::wstring())
Opens a PDF file from a memory buffer.
void DeletePage(size_t index)
Deletes the page at the specified index.
void SetOCConfig(const OCConfig &config)
Sets the document's default optional content configuration.
Object CreateNameObject(PDAtom value, bool indirect=false)
Creates a name object.
void ResetForm(std::span< const FormField > fields=std::span< const FormField >(), PDResetFormFlags flags=kPDResetFormFlagExclude)
Resets form fields to their default values.
void DeletePages(const std::vector< size_t > &pageIndexes, ProgressMonitor *mon=nullptr)
Deletes the pages within the specified range.
Action CreateActionHide()
Creates a Hide action.
PDDateTime GetModDate() const
Gets the modification date of the document.
void AddAttachment(std::string_view name, FileSpec filespec)
Adds an attachment to the document.
void EnumFonts(EnumProc enumProc, ProgressMonitor *mon=nullptr) const
Enumerates the fonts used in the document.
bool IsTaggedPDF() const
Checks if the PDF document is a tagged PDF.
Page GetPage(size_t index) const
Gets the page at the specified index.
Font CreateFontFromInfo(const PDFontInfo &fontInfo, bool forceSysFont=true, PDEFontCreateFlags createFlags=kPDEFontCreateFlagsDefault)
Creates a font in the document using the specified font information.
static Document NewDocument(const RectF &mediaBox=RectF(0.0f, 792.0f, 612.0f, 0.0f))
Creates a new PDF document.
XObject ImportIcon(const Document &source, size_t pageIndex=0)
Imports an icon from another document.
Font ConvertFontToType0(const Font &font, PDEFontCreateFlags createFlags=kPDEFontCreateFlagsDefault)
Creates a Type0 (composite) equivalent of the specified font. The result can be used in place of the ...
void ImportFormFDFFromMemory(std::span< const Byte > data)
Imports form field values from an in-memory Forms Data Format (FDF) buffer.
size_t GetNumOutputIntents() const
Gets the number of Output Intents in the document.
PDFAFlavor GetPDFAFlavor() const
Gets the PDF/A flavor of the document according to its XMP metadata.
PDAtom GetPageLayout() const
Gets the page layout of the document.
Dest CreateDestFitR(size_t pageIndex, const RectF &rect, bool isRemote=false)
Creates a destination that fits the specified rectangle on the page.
Action CreateActionResetForm()
Creates a ResetForm action.
void CreatePageFromIcon(size_t insertAt, const Document &iconDoc, const XObject &icon)
Creates a page from an icon.
void SetXmpMetadata(const std::string &xmpPacket)
Sets XMP metadata packet for document.
Action CreateActionNamed(PDAtom name)
Creates a Named action with the specified name.
Dest GetOpenDestination() const
Gets the open destination of the document.
PDAtom GetPageMode() const
Gets the page mode of the document.
size_t GetNumFormFields() const
Gets the number of form fields in the document.
void ExportFormXFDFToStream(IWriteSink &sink, std::span< const FormField > fields=std::span< const FormField >(), bool exclude=true)
Exports the form field values as XFDF to a caller-supplied byte sink.
void ImportFormXFDF(const std::filesystem::path &path)
Imports form field values from an XFDF (XML Forms Data Format) file.
void SetPageMode(PDAtom mode)
Sets the page mode of the document.
Annot CreateTextMarkupAnnot(PDAtom type, PDColorValue color, const QuadPoints &quads)
Creates a text markup annotation with the specified type, color, and quad points.
bool IsSigned() const
Checks if the document is signed.
Font CreateFontEmbeddedCopy(const Font &font, PDEFontCreateFlags createFlags=kPDEFontCreateFlagsDefault)
Creates an embedded copy of the specified font in the document.
void SetStandardSecurityParams(const StdSecurityParams &requestedParams)
Sets the standard security parameters of the document.
Annot CreateInkAnnot(PDColorValue color, float lineWidth, const std::vector< std::vector< PointF > > &points)
Creates an ink annotation with the specified color, line width, and points.
size_t GetNumAttachments() const
Gets the number of attachments in the document.
Object CreateStringObject(const std::string &bytes, bool hex=false, bool indirect=false)
Creates a string object from a byte string.
void SetModified(bool modified)
Sets the state of the document to modified.
void SaveSignedVersion(FormField sigField, const std::filesystem::path &path) const
Writes to a file the version of the document as it was at the time of signing.
void SetCreationDate(const PDDateTime &date)
Sets the creation date of the document.
Page CreatePage(size_t insertAt, const RectF &mediaBox)
Creates a new page at the specified index with the given media box.
FileSpec CreateFileSpec(PDAtom fileSys, const std::wstring &path)
Creates a FileSpec with the specified file system and path.
StructTreeRoot CreateStructTree()
Creates a logical structure tree for the document.
StructTreeRoot GetStructTree() const
Gets the document's logical structure tree.
std::string GetAttachmentNameByIndex(size_t index) const
Gets the name of the attachment at the specified index.
Bookmark GetRootBookmark() const
Gets the root bookmark of the document.
Action CreateActionSubmitForm(const std::string &serverUri)
Creates a SubmitForm action with the specified server URI.
void EnumAttachments(EnumProc enumProc) const
Enumerates the attachments in the document.
void InsertPage(const Page &page, size_t insertAt)
Inserts a page at the specified index.
Annot CreateFileAttachmentAnnot(const FileSpec &fileSpec, const RectF &rect)
Creates a file attachment annotation with the specified file specification and rectangle....
Object GetObjectByID(uint32_t id) const
Gets the indirect object with the specified ID.
void SetPageDirection(PDPageDirection direction)
Sets the page direction of the document.
Action CreateActionURI(const std::string &uri)
Creates a URI action with the specified URI.
PDDateTime GetCreationDate() const
Gets the creation date of the document.
Object CopyObject(const Object &source)
Copies an object.
Annot CreatePopupAnnot(const RectF &rect)
Creates a popup annotation with the specified rectangle.
void AddFormField(FormField field)
Adds a form field to the document.
void RenameFormField(FormField field, const std::wstring &fullname)
Renames a specified form field.
bool IsModified() const
Checks if the document has been modified.
bool RequestPermission(PDPermReqObj object, PDPermReqOp operation, const std::wstring &password=std::wstring()) const
Requests permission to perform an operation on the document. Permissions can be set either by the doc...
void RemoveOutputIntent(const OutputIntent &oi)
Removes an Output Intent from the document.
std::wstring GetInfoString(PDAtom infoDictKey) const
Gets the information string associated with the specified info string atom.
OCConfig GetOCConfig() const
Gets the document's default optional content configuration.
void ExportFormFDFToStream(IWriteSink &sink, std::span< const FormField > fields=std::span< const FormField >(), bool exclude=true)
Exports the form field values as FDF to a caller-supplied byte sink.
static Document OpenDocumentFromStream(std::shared_ptr< IDataSource > source, const std::wstring &password=std::wstring())
Opens a PDF file from a caller-supplied data source.
void Save(const std::filesystem::path &path, PDDocSaveFlags flags=kPDDocSaveFull|kPDDocSaveCompressed, ProgressMonitor *progmon=nullptr, const PDOptSaveSettings *optSettings=nullptr, const PDVersion *version=nullptr)
Saves the document to a file.
Object CreateStreamObject(std::span< const Byte > data, const Object &attributesDict, const Object &encodeParms, bool encodeSource)
Creates a stream object.
Annot CreateWidgetAnnot(const FormField &field, const RectF &rect)
Creates a widget annotation for the specified form field.
XObject CreateFormXObject(const Content &content)
Creates a form XObject from the specified content stream.
Object CreateArrayObject(bool indirect)
Creates an array object.
Dest CreateDestFitB(size_t pageIndex, bool isRemote=false)
Creates a destination that fits the bounding box of the page.
ReadStream OpenXfaStream() const
Opens an XFA (XML Forms Architecture) stream.
Specifies an external file which is referred to inside a PDF document.
Definition filespec.h:29
Represents a font in a PDF document.
Definition font.h:30
Represents a form field in a PDF document.
Definition form_field.h:224
A callback interface for supplying bytes from a random-access source.
Definition io_stream.h:19
A callback interface for receiving bytes written sequentially.
Definition io_stream.h:43
Optional content configuration.
Definition optional_content.h:160
Optional content group (OCG).
Definition optional_content.h:24
Represents a PDF object.
Definition object.h:25
Defines the Output Intent information.
Definition output_intent.h:22
Represents a leaf node (Page Object).
Definition page.h:20
Represents a shading or tiling pattern in a PDF document.
Definition pattern.h:18
Progress monitor for tracking the progress of an operation.
Definition progress_monitor.h:14
Represents a read stream for reading data from PDF objects.
Definition read_stream.h:19
Represents a shading in a PDF document.
Definition shading.h:18
The root of a document's logical structure (tag) tree.
Definition struct_tree.h:400
Represents an XObject in a PDF document.
Definition xobject.h:22
PDETilingPatternTilingType
For a tiling pattern - specifies the type of tiling spacing.
Definition content.h:536
@ kPDEFontCreateFlagsDefault
Definition content.h:811
PDETilingPatternPaintType
Specifies the type of tiling pattern.
Definition content.h:515
PDPageDirection
Specifies the logical content order of text.
Definition document.h:204
@ kPDDocSaveFull
Definition document.h:117
@ kPDDocSaveCompressed
Definition document.h:124
PDPermReqObj
Specifies the type of object to check permissions for.
Definition security.h:33
PDPermReqOp
Specifies the operation to check permissions for.
Definition security.h:61
Standard Security API.
Definition types.h:23
Definition math.h:154
Definition math.h:1200
Definition math.h:752
Helper class that represents the data of the Standard Security Handler.
Definition standard_security.h:34
Specifies the font information.
Definition fonts.h:36
Definition document.h:166
Definition document.h:20
Common types.