PDF SDK Documentation

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

Loading...
Searching...
No Matches
document.h
Go to the documentation of this file.
1// Copyright (c) 2009-2025 Avanquest Software. All rights reserved.
2
3#ifndef PDFSDK_CORE_DOCUMENT_H_INCLUDED_
4#define PDFSDK_CORE_DOCUMENT_H_INCLUDED_
5
11#include <pdfsdk/core/objects.h>
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18typedef struct
19{
20 uint16_t major;
21 uint16_t minor;
22} PDVersion;
23
34
35typedef struct PDPageRec_* PDPage;
36
37#define kPDPageIndexNull ((size_t)(-1))
38
39typedef struct
40{
41 const size_t* iPages;
42 size_t numPages;
44
45typedef void(PDFSDK_CALLCONV* PDDocPagesChangedProc)(PDPageOperation operation, const PDPageRange* pageRange, void* clientData);
46
78typedef PDErrCode (PDFSDK_CALLCONV* PDDocAuthProc)(void* authProcData, PDAtom securityHandlerName, void* pAuthData);
79typedef PDErrCode (PDFSDK_CALLCONV* PDDocAuthFreeDataProc)(void* authProcData);
80
82 PDDocAuthProc auth;
83 PDDocAuthFreeDataProc free;
84};
85
86typedef PDErrCode (PDFSDK_CALLCONV* PDDocStreamReadAtProc)(void* streamData, uint64_t pos, void* buffer, size_t nbytes, size_t* pRead);
87typedef PDErrCode (PDFSDK_CALLCONV* PDDocStreamGetSizeProc)(void* streamData, uint64_t* pSize);
88typedef PDErrCode (PDFSDK_CALLCONV* PDDocStreamFreeDataProc)(void* streamData);
89
91 PDDocStreamReadAtProc readAt;
92 PDDocStreamGetSizeProc getSize;
93 PDDocStreamFreeDataProc free;
94};
95
96typedef struct
97{
98 const wchar_t* filePath;
99 const PDDocStreamProcs* streamProcs;
100 void* streamData;
101 const PDDocAuthProcs* authProcs;
102 void* authProcData;
104
108typedef enum {
109 kPDDocSaveIncremental = 0x01,
112 kPDDocSaveFull = 0x02,
114 kPDDocSaveCopy = 0x04,
117 kPDDocSaveLinearized = 0x08,
119 kPDDocSaveCompressed = 0x10,
126
127typedef uint32_t PDDocSaveFlags;
128
132enum {
145 kPDOptSaveRemoveInfo = 1 << 11
147typedef uint32_t PDOptSaveFlags;
148
159
160typedef struct
161{
162 PDOptSaveFlags flags;
163 PDOptSaveImageQuality imageQuality;
164 int imageDpi;
166
167typedef struct
168{
170 PDDocSaveFlags flags;
171
173 const wchar_t* filePath;
174
176 PDWriteStream outputStream;
177
180
183
186
189
191
204
205PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocCreate(PDDoc* pDoc);
206PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocOpen(const PDDocOpenParams* params, PDDoc* pDoc);
207PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocIsCompressed(PDDoc doc, bool* pValue);
208PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocIsModified(PDDoc doc, bool* pValue);
209PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSetModified(PDDoc doc, bool value);
210PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSave(PDDoc doc, const PDDocSaveParams* params);
211PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocPurgeCaches(PDDoc doc);
212PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetFilePath(PDDoc doc, wchar_t* buffer, size_t bufSize, size_t* pSize);
213PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetPage(PDDoc doc, size_t index, PDPage* pPage);
214PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetNumPages(PDDoc doc, size_t* pNumPages);
215PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocAttachPagesChangedCallback(PDDoc doc, PDDocPagesChangedProc proc, void* clientData);
216PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocDetachPagesChangedCallback(PDDoc doc, PDDocPagesChangedProc proc, void* clientData);
217PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocNotifyPagesChanged(PDDoc doc, PDPageOperation operation, const PDPageRange* range);
218PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocCreatePage(PDDoc doc, size_t insertAt, const PDRectF* mediaBox, PDPage* pPage);
219PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocCreatePages(PDDoc doc, size_t insertAt, size_t count, const PDRectF* mediaBox);
220PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocDeletePages(PDDoc doc, const PDPageRange* range, const PDProgressMonitor* progress, void* progressData);
221PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocInsertPages(PDDoc doc, size_t insertAt, PDDoc sourceDoc, const PDPageRange* sourceRange, const PDProgressMonitor* progress, void* progressData);
222PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocInsertPage(PDDoc doc, PDPage page, size_t insertAt);
223PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocMovePages(PDDoc doc, size_t insertAt, const PDPageRange* range, const PDProgressMonitor* progress, void* progressData);
224PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocFindPageIndexForLabel(PDDoc doc, const wchar_t* label, size_t labelSize, size_t* pIndex);
225PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetLabelForPageIndex(PDDoc doc, size_t index, wchar_t* buffer, size_t bufferSize, size_t* pSize);
226PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetID(PDDoc doc, const char** pPermaID, size_t* pPermaLen, const char** pInstanceID, size_t* pInstanceLen);
227PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetVersion(PDDoc doc, PDVersion* pVersion);
228PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetFileSize(PDDoc doc, uint64_t* pFileSize);
229
248PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetInfoString(PDDoc doc, PDAtom infoStringAtom, wchar_t* buffer, size_t bufferSize, size_t* pSize);
249
266PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSetInfoString(PDDoc doc, PDAtom infoStringAtom, const wchar_t* buffer, size_t bufferSize);
267PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetCreationDate(PDDoc doc, PDDateTime* creationDate);
268PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSetCreationDate(PDDoc doc, const PDDateTime* creationDate);
269PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetModDate(PDDoc doc, PDDateTime* modDate);
270PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSetModDate(PDDoc doc, const PDDateTime* modDate);
271PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSetPageLayout(PDDoc doc, PDAtom layout);
272
281PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetPageLayout(PDDoc doc, PDAtom* pLayout);
282PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSetPageMode(PDDoc doc, PDAtom mode);
283
292PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetPageMode(PDDoc doc, PDAtom* pMode);
293
294PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSetPageDirection(PDDoc doc, PDPageDirection direction);
295
310PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetPageDirection(PDDoc doc, PDPageDirection* pDirection);
311
312PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDStructTreeRoleMapGetTag(PDDoc doc, PDAtom tag, PDAtom* pValue);
313PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDStructTreeFindStructParent(PDDoc doc, int structParent, int MCID, PDObject* pObj);
314
315PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetDoc(PDPage page, PDDoc* pDoc);
316PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetIndex(PDPage page, size_t* pIndex);
317PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageIsContentModified(PDPage page, bool* pValue);
318PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageSetContentModified(PDPage page, bool value);
319
329PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageFlushModifiedContent(PDPage page);
330
331PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageSetMediaBox(PDPage page, const PDRectF* mediaBox);
332
345PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetMediaBox(PDPage page, PDRectF* pMediaBox);
346PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageSetCropBox(PDPage page, const PDRectF* cropBox);
347
359PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetCropBox(PDPage page, PDRectF* pCropBox);
360PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageSetTrimBox(PDPage page, const PDRectF* trimBox);
361PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetTrimBox(PDPage page, PDRectF* pTrimBox);
362PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageSetArtBox(PDPage page, const PDRectF* artBox);
363PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetArtBox(PDPage page, PDRectF* pArtBox);
364PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageSetBleedBox(PDPage page, const PDRectF* bleedBox);
365PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetBleedBox(PDPage page, PDRectF* pBleedBox);
366PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageSetRotate(PDPage page, PDRotate rotate);
367
374PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetRotate(PDPage page, PDRotate* pRotate);
375PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageSetUserUnitSize(PDPage page, float unitSize);
376
384PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetUserUnitSize(PDPage page, float* pUnitSize);
385PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetPDObject(PDPage page, PDObject* pObj);
386
387#ifdef __cplusplus
388}
389#endif
390
391#endif // PDFSDK_CORE_DOCUMENT_H_INCLUDED_
PDPageOperation
Specifies a page operation.
Definition document.h:27
@ kPDRotatePages
Definition document.h:31
@ kPDMovePages
Definition document.h:30
@ kPDDeletePages
Definition document.h:29
@ kPDInsertPages
Definition document.h:28
@ kPDResizePages
Definition document.h:32
PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetPageMode(PDDoc doc, PDAtom *pMode)
PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetMediaBox(PDPage page, PDRectF *pMediaBox)
PDOptSaveImageQuality
Specifies image quality before a save operation.
Definition document.h:152
@ kPDOptSaveImageQualityLow
Definition document.h:154
@ kPDOptSaveImageQualityMedium
Definition document.h:155
@ kPDOptSaveImageQualityHigh
Definition document.h:156
@ kPDOptSaveImageQualityMin
Definition document.h:153
@ kPDOptSaveImageQualityMax
Definition document.h:157
PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageFlushModifiedContent(PDPage page)
PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSetInfoString(PDDoc doc, PDAtom infoStringAtom, const wchar_t *buffer, size_t bufferSize)
PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetCropBox(PDPage page, PDRectF *pCropBox)
PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetRotate(PDPage page, PDRotate *pRotate)
PDPageDirection
Specifies the logical content order of text.
Definition document.h:199
@ kPDPageDirectionL2R
Definition document.h:200
@ kPDPageDirectionR2L
Definition document.h:201
@ kPDOptSaveDownsampleImages
Definition document.h:135
@ kPDOptSaveRemoveInfo
Definition document.h:145
@ kPDOptSaveRemoveBookmarks
Definition document.h:139
@ kPDOptSaveRemoveAcroform
Definition document.h:140
@ kPDOptSaveRemoveAttachments
Definition document.h:138
@ kPDOptSaveRemoveOpenActions
Definition document.h:143
@ kPDOptSaveRemoveOCProperties
Definition document.h:141
@ kPDOptSaveRemoveStructTree
Definition document.h:137
@ kPDOptSaveRemoveMetadata
Definition document.h:136
@ kPDOptSaveRemoveAnnotations
Definition document.h:142
@ kPDOptSaveRemoveHiddenObjects
Definition document.h:133
@ kPDOptSaveRemoveJavaScript
Definition document.h:144
PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetInfoString(PDDoc doc, PDAtom infoStringAtom, wchar_t *buffer, size_t bufferSize, size_t *pSize)
PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetUserUnitSize(PDPage page, float *pUnitSize)
PDDocSaveFlagsBits
Specifies methods or optimizations applied during a saving operation.
Definition document.h:108
@ kPDDocSaveXRefCompressed
Definition document.h:123
@ kPDDocSaveFull
Definition document.h:112
@ kPDDocSaveIncremental
Definition document.h:109
@ kPDDocSaveCopy
Definition document.h:114
@ kPDDocSaveLinearized
Definition document.h:117
@ kPDDocSaveCompressed
Definition document.h:119
PDErrCode(PDFSDK_CALLCONV * PDDocAuthProc)(void *authProcData, PDAtom securityHandlerName, void *pAuthData)
Definition document.h:78
PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetPageLayout(PDDoc doc, PDAtom *pLayout)
PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetPageDirection(PDDoc doc, PDPageDirection *pDirection)
int32_t PDErrCode
Definition errors.h:44
Objects API.
Progress Monitor API.
Definition types.h:23
Definition document.h:81
Definition document.h:97
Definition document.h:168
void * progressData
A pointer to pass to progress each time it is called.
Definition document.h:182
PDDocSaveFlags flags
A combination of PDDocSaveFlags.
Definition document.h:170
const PDVersion * version
The version number of the document. Pass null to keep the current version.
Definition document.h:188
const PDProgressMonitor * progress
The progress monitor to receive notifications about the saving process. It may be null.
Definition document.h:179
PDWriteStream outputStream
The stream to write output document to. Used only if filePath is null.
Definition document.h:176
const PDOptSaveSettings * optSettings
The settings to use in "Reduce File Size". Pass null for the regular save.
Definition document.h:185
const wchar_t * filePath
The path to which the document is saved. If both this and outputStream are null, the current document...
Definition document.h:173
Definition document.h:90
Definition objects.h:83
Definition document.h:161
Definition document.h:40
Definition progress_monitor.h:15
Definition math_types.h:30
Definition document.h:19
PDRotate
Specifies degrees of rotation.
Definition types.h:38