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
42typedef struct
43{
44 const size_t* iPages;
46 size_t numPages;
48
49typedef void(PDFSDK_CALLCONV* PDDocPagesChangedProc)(PDPageOperation operation, const PDPageRange* pageRange, void* clientData);
50
82typedef PDErrCode (PDFSDK_CALLCONV* PDDocAuthProc)(void* authProcData, PDAtom securityHandlerName, void* pAuthData);
83typedef PDErrCode (PDFSDK_CALLCONV* PDDocAuthFreeDataProc)(void* authProcData);
84
86 PDDocAuthProc auth;
87 PDDocAuthFreeDataProc free;
88};
89
90typedef PDErrCode (PDFSDK_CALLCONV* PDDocStreamReadAtProc)(void* streamData, uint64_t pos, void* buffer, size_t nbytes, size_t* pRead);
91typedef PDErrCode (PDFSDK_CALLCONV* PDDocStreamGetSizeProc)(void* streamData, uint64_t* pSize);
92typedef PDErrCode (PDFSDK_CALLCONV* PDDocStreamFreeDataProc)(void* streamData);
93
95 PDDocStreamReadAtProc readAt;
96 PDDocStreamGetSizeProc getSize;
97 PDDocStreamFreeDataProc free;
98};
99
100typedef struct
101{
102 const wchar_t* filePath;
103 const PDDocStreamProcs* streamProcs;
104 void* streamData;
105 const PDDocAuthProcs* authProcs;
106 void* authProcData;
108
112typedef enum {
113 kPDDocSaveIncremental = 0x01,
116 kPDDocSaveFull = 0x02,
118 kPDDocSaveCopy = 0x04,
121 kPDDocSaveLinearized = 0x08,
123 kPDDocSaveCompressed = 0x10,
130
131typedef uint32_t PDDocSaveFlags;
132
136enum {
149 kPDOptSaveRemoveInfo = 1 << 11
151typedef uint32_t PDOptSaveFlags;
152
163
164typedef struct
165{
166 PDOptSaveFlags flags;
167 PDOptSaveImageQuality imageQuality;
168 int imageDpi;
170
171typedef struct
172{
174 PDDocSaveFlags flags;
175
177 const wchar_t* filePath;
178
180 PDWriteStream outputStream;
181
184
187
190
193
195
208
209PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocCreate(PDDoc* pDoc);
210PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocOpen(const PDDocOpenParams* params, PDDoc* pDoc);
211PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocIsCompressed(PDDoc doc, bool* pValue);
212PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocIsModified(PDDoc doc, bool* pValue);
213PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSetModified(PDDoc doc, bool value);
214PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSave(PDDoc doc, const PDDocSaveParams* params);
215PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocPurgeCaches(PDDoc doc);
216PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetFilePath(PDDoc doc, wchar_t* buffer, size_t bufSize, size_t* pSize);
217PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetPage(PDDoc doc, size_t index, PDPage* pPage);
218PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetNumPages(PDDoc doc, size_t* pNumPages);
219PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocAttachPagesChangedCallback(PDDoc doc, PDDocPagesChangedProc proc, void* clientData);
220PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocDetachPagesChangedCallback(PDDoc doc, PDDocPagesChangedProc proc, void* clientData);
221PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocNotifyPagesChanged(PDDoc doc, PDPageOperation operation, const PDPageRange* range);
222PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocCreatePage(PDDoc doc, size_t insertAt, const PDRectF* mediaBox, PDPage* pPage);
223PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocCreatePages(PDDoc doc, size_t insertAt, size_t count, const PDRectF* mediaBox);
224PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocDeletePages(PDDoc doc, const PDPageRange* range, const PDProgressMonitor* progress, void* progressData);
225PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocInsertPages(PDDoc doc, size_t insertAt, PDDoc sourceDoc, const PDPageRange* sourceRange, const PDProgressMonitor* progress, void* progressData);
226PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocInsertPage(PDDoc doc, PDPage page, size_t insertAt);
227PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocMovePages(PDDoc doc, size_t insertAt, const PDPageRange* range, const PDProgressMonitor* progress, void* progressData);
228PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocFindPageIndexForLabel(PDDoc doc, const wchar_t* label, size_t labelSize, size_t* pIndex);
229PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetLabelForPageIndex(PDDoc doc, size_t index, wchar_t* buffer, size_t bufferSize, size_t* pSize);
230PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetID(PDDoc doc, const char** pPermaID, size_t* pPermaLen, const char** pInstanceID, size_t* pInstanceLen);
231PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetVersion(PDDoc doc, PDVersion* pVersion);
232PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetFileSize(PDDoc doc, uint64_t* pFileSize);
233
252PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetInfoString(PDDoc doc, PDAtom infoStringAtom, wchar_t* buffer, size_t bufferSize, size_t* pSize);
253
270PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSetInfoString(PDDoc doc, PDAtom infoStringAtom, const wchar_t* buffer, size_t bufferSize);
271PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetCreationDate(PDDoc doc, PDDateTime* creationDate);
272PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSetCreationDate(PDDoc doc, const PDDateTime* creationDate);
273PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetModDate(PDDoc doc, PDDateTime* modDate);
274PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSetModDate(PDDoc doc, const PDDateTime* modDate);
275PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSetPageLayout(PDDoc doc, PDAtom layout);
276
285PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetPageLayout(PDDoc doc, PDAtom* pLayout);
286PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSetPageMode(PDDoc doc, PDAtom mode);
287
296PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetPageMode(PDDoc doc, PDAtom* pMode);
297
298PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSetPageDirection(PDDoc doc, PDPageDirection direction);
299
314PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetPageDirection(PDDoc doc, PDPageDirection* pDirection);
315
316PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDStructTreeRoleMapGetTag(PDDoc doc, PDAtom tag, PDAtom* pValue);
317PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDStructTreeFindStructParent(PDDoc doc, int structParent, int MCID, PDObject* pObj);
318
319PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetDoc(PDPage page, PDDoc* pDoc);
320PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetIndex(PDPage page, size_t* pIndex);
321PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageIsContentModified(PDPage page, bool* pValue);
322PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageSetContentModified(PDPage page, bool value);
323
333PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageFlushModifiedContent(PDPage page);
334
335PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageSetMediaBox(PDPage page, const PDRectF* mediaBox);
336
349PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetMediaBox(PDPage page, PDRectF* pMediaBox);
350PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageSetCropBox(PDPage page, const PDRectF* cropBox);
351
363PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetCropBox(PDPage page, PDRectF* pCropBox);
364PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageSetTrimBox(PDPage page, const PDRectF* trimBox);
365PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetTrimBox(PDPage page, PDRectF* pTrimBox);
366PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageSetArtBox(PDPage page, const PDRectF* artBox);
367PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetArtBox(PDPage page, PDRectF* pArtBox);
368PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageSetBleedBox(PDPage page, const PDRectF* bleedBox);
369PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetBleedBox(PDPage page, PDRectF* pBleedBox);
370PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageSetRotate(PDPage page, PDRotate rotate);
371
378PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetRotate(PDPage page, PDRotate* pRotate);
379PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageSetUserUnitSize(PDPage page, float unitSize);
380
388PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetUserUnitSize(PDPage page, float* pUnitSize);
389PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetPDObject(PDPage page, PDObject* pObj);
390
391#ifdef __cplusplus
392}
393#endif
394
395#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:156
@ kPDOptSaveImageQualityLow
Definition document.h:158
@ kPDOptSaveImageQualityMedium
Definition document.h:159
@ kPDOptSaveImageQualityHigh
Definition document.h:160
@ kPDOptSaveImageQualityMin
Definition document.h:157
@ kPDOptSaveImageQualityMax
Definition document.h:161
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:203
@ kPDPageDirectionL2R
Definition document.h:204
@ kPDPageDirectionR2L
Definition document.h:205
@ kPDOptSaveDownsampleImages
Definition document.h:139
@ kPDOptSaveRemoveInfo
Definition document.h:149
@ kPDOptSaveRemoveBookmarks
Definition document.h:143
@ kPDOptSaveRemoveAcroform
Definition document.h:144
@ kPDOptSaveRemoveAttachments
Definition document.h:142
@ kPDOptSaveRemoveOpenActions
Definition document.h:147
@ kPDOptSaveRemoveOCProperties
Definition document.h:145
@ kPDOptSaveRemoveStructTree
Definition document.h:141
@ kPDOptSaveRemoveMetadata
Definition document.h:140
@ kPDOptSaveRemoveAnnotations
Definition document.h:146
@ kPDOptSaveRemoveHiddenObjects
Definition document.h:137
@ kPDOptSaveRemoveJavaScript
Definition document.h:148
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:112
@ kPDDocSaveXRefCompressed
Definition document.h:127
@ kPDDocSaveFull
Definition document.h:116
@ kPDDocSaveIncremental
Definition document.h:113
@ kPDDocSaveCopy
Definition document.h:118
@ kPDDocSaveLinearized
Definition document.h:121
@ kPDDocSaveCompressed
Definition document.h:123
PDErrCode(PDFSDK_CALLCONV * PDDocAuthProc)(void *authProcData, PDAtom securityHandlerName, void *pAuthData)
Definition document.h:82
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:85
Definition document.h:101
Definition document.h:172
void * progressData
A pointer to pass to progress each time it is called.
Definition document.h:186
PDDocSaveFlags flags
A combination of PDDocSaveFlags.
Definition document.h:174
const PDVersion * version
The version number of the document. Pass null to keep the current version.
Definition document.h:192
const PDProgressMonitor * progress
The progress monitor to receive notifications about the saving process. It may be null.
Definition document.h:183
PDWriteStream outputStream
The stream to write output document to. Used only if filePath is null.
Definition document.h:180
const PDOptSaveSettings * optSettings
The settings to use in "Reduce File Size". Pass null for the regular save.
Definition document.h:189
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:177
Definition document.h:94
Definition objects.h:83
Definition document.h:165
Specifies a structure to define a set of pages.
Definition document.h:43
size_t numPages
Definition document.h:46
const size_t * iPages
Definition document.h:44
Definition progress_monitor.h:15
Definition math_types.h:30
Definition document.h:19
PDRotate
Specifies degrees of rotation.
Definition types.h:38