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
10
11#include <pdfsdk/core/objects.h>
13#include <pdfsdk/core/pdfa_flavor.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19typedef struct
20{
21 uint16_t major;
22 uint16_t minor;
23} PDVersion;
24
35
36typedef struct PDPageRec_* PDPage;
37
38#define kPDPageIndexNull ((size_t)(-1))
39
43typedef struct
44{
45 const size_t* iPages;
47 size_t numPages;
49
50typedef void(PDFSDK_CALLCONV* PDDocPagesChangedProc)(PDPageOperation operation, const PDPageRange* pageRange, void* clientData);
51
83typedef PDErrCode (PDFSDK_CALLCONV* PDDocAuthProc)(void* authProcData, PDAtom securityHandlerName, void* pAuthData);
84typedef PDErrCode (PDFSDK_CALLCONV* PDDocAuthFreeDataProc)(void* authProcData);
85
87 PDDocAuthProc auth;
88 PDDocAuthFreeDataProc free;
89};
90
91typedef PDErrCode (PDFSDK_CALLCONV* PDDocStreamReadAtProc)(void* streamData, uint64_t pos, void* buffer, size_t nbytes, size_t* pRead);
92typedef PDErrCode (PDFSDK_CALLCONV* PDDocStreamGetSizeProc)(void* streamData, uint64_t* pSize);
93typedef PDErrCode (PDFSDK_CALLCONV* PDDocStreamFreeDataProc)(void* streamData);
94
96 PDDocStreamReadAtProc readAt;
97 PDDocStreamGetSizeProc getSize;
98 PDDocStreamFreeDataProc free;
99};
100
101typedef struct
102{
103 const wchar_t* filePath;
104 const PDDocStreamProcs* streamProcs;
105 void* streamData;
106 const PDDocAuthProcs* authProcs;
107 void* authProcData;
109
131
132typedef uint32_t PDDocSaveFlags;
133
137enum {
151};
152typedef uint32_t PDOptSaveFlags;
153
164
165typedef struct
166{
167 PDOptSaveFlags flags;
168 PDOptSaveImageQuality imageQuality;
169 int imageDpi;
171
172typedef struct
173{
175 PDDocSaveFlags flags;
176
178 const wchar_t* filePath;
179
181 PDWriteStream outputStream;
182
185
188
191
194
196
209
210PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocCreate(PDDoc* pDoc);
211PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocOpen(const PDDocOpenParams* params, PDDoc* pDoc);
212PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocIsCompressed(PDDoc doc, bool* pValue);
213PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocIsModified(PDDoc doc, bool* pValue);
214PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSetModified(PDDoc doc, bool value);
215PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocIsRepaired(PDDoc doc, bool* pRepaired);
216PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSave(PDDoc doc, const PDDocSaveParams* params);
217PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocPurgeCaches(PDDoc doc);
218PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetFilePath(PDDoc doc, wchar_t* buffer, size_t bufSize, size_t* pSize);
219PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetPage(PDDoc doc, size_t index, PDPage* pPage);
220PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetNumPages(PDDoc doc, size_t* pNumPages);
221PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocAttachPagesChangedCallback(PDDoc doc, PDDocPagesChangedProc proc, void* clientData);
222PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocDetachPagesChangedCallback(PDDoc doc, PDDocPagesChangedProc proc, void* clientData);
223PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocNotifyPagesChanged(PDDoc doc, PDPageOperation operation, const PDPageRange* range);
224PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocCreatePage(PDDoc doc, size_t insertAt, const PDRectF* mediaBox, PDPage* pPage);
225PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocCreatePages(PDDoc doc, size_t insertAt, size_t count, const PDRectF* mediaBox);
226PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocDeletePages(PDDoc doc, const PDPageRange* range, const PDProgressMonitor* progress, void* progressData);
227PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocInsertPages(PDDoc doc, size_t insertAt, PDDoc sourceDoc, const PDPageRange* sourceRange, const PDProgressMonitor* progress, void* progressData);
228PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocInsertPage(PDDoc doc, PDPage page, size_t insertAt);
229PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocMovePages(PDDoc doc, size_t insertAt, const PDPageRange* range, const PDProgressMonitor* progress, void* progressData);
230PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocFindPageIndexForLabel(PDDoc doc, const wchar_t* label, size_t labelSize, size_t* pIndex);
231PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetLabelForPageIndex(PDDoc doc, size_t index, wchar_t* buffer, size_t bufferSize, size_t* pSize);
232PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetID(PDDoc doc, const char** pPermaID, size_t* pPermaLen, const char** pInstanceID, size_t* pInstanceLen);
233PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetVersion(PDDoc doc, PDVersion* pVersion);
234PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetFileSize(PDDoc doc, uint64_t* pFileSize);
235
254PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetInfoString(PDDoc doc, PDAtom infoStringAtom, wchar_t* buffer, size_t bufferSize, size_t* pSize);
255
273PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSetInfoString(PDDoc doc, PDAtom infoStringAtom, const wchar_t* buffer, size_t bufferSize);
274
289PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetXmpMetadata(PDDoc doc, char* buffer, size_t bufSize, size_t* pSize);
290
304PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSetXmpMetadata(PDDoc doc, const char* buffer, size_t bufSize);
305
318PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetPDFAFlavor(PDDoc doc, PDFAFlavor* pFlavor);
319
320PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetCreationDate(PDDoc doc, PDDateTime* creationDate);
321PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSetCreationDate(PDDoc doc, const PDDateTime* creationDate);
322
323PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetModDate(PDDoc doc, PDDateTime* modDate);
324PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSetModDate(PDDoc doc, const PDDateTime* modDate);
325
326PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSetPageLayout(PDDoc doc, PDAtom layout);
327
336PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetPageLayout(PDDoc doc, PDAtom* pLayout);
337PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSetPageMode(PDDoc doc, PDAtom mode);
338
347PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetPageMode(PDDoc doc, PDAtom* pMode);
348
349PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSetPageDirection(PDDoc doc, PDPageDirection direction);
350
365PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetPageDirection(PDDoc doc, PDPageDirection* pDirection);
366
367PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetDoc(PDPage page, PDDoc* pDoc);
368PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetIndex(PDPage page, size_t* pIndex);
369PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageIsContentModified(PDPage page, bool* pValue);
370PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageSetContentModified(PDPage page, bool value);
371
381PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageFlushModifiedContent(PDPage page);
382
383PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageSetMediaBox(PDPage page, const PDRectF* mediaBox);
384
397PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetMediaBox(PDPage page, PDRectF* pMediaBox);
398PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageSetCropBox(PDPage page, const PDRectF* cropBox);
399
411PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetCropBox(PDPage page, PDRectF* pCropBox);
412PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageSetTrimBox(PDPage page, const PDRectF* trimBox);
413PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetTrimBox(PDPage page, PDRectF* pTrimBox);
414PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageSetArtBox(PDPage page, const PDRectF* artBox);
415PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetArtBox(PDPage page, PDRectF* pArtBox);
416PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageSetBleedBox(PDPage page, const PDRectF* bleedBox);
417PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetBleedBox(PDPage page, PDRectF* pBleedBox);
418PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageSetRotate(PDPage page, PDRotate rotate);
419
426PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetRotate(PDPage page, PDRotate* pRotate);
427PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageSetUserUnitSize(PDPage page, float unitSize);
428
436PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetUserUnitSize(PDPage page, float* pUnitSize);
437PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDPageGetPDObject(PDPage page, PDObject* pObj);
438
439#ifdef __cplusplus
440}
441#endif
442
443#endif // PDFSDK_CORE_DOCUMENT_H_INCLUDED_
PDPageOperation
Specifies a page operation.
Definition document.h:28
@ kPDRotatePages
Definition document.h:32
@ kPDMovePages
Definition document.h:31
@ kPDDeletePages
Definition document.h:30
@ kPDInsertPages
Definition document.h:29
@ kPDResizePages
Definition document.h:33
PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetPDFAFlavor(PDDoc doc, PDFAFlavor *pFlavor)
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:157
@ kPDOptSaveImageQualityLow
Definition document.h:159
@ kPDOptSaveImageQualityMedium
Definition document.h:160
@ kPDOptSaveImageQualityHigh
Definition document.h:161
@ kPDOptSaveImageQualityMin
Definition document.h:158
@ kPDOptSaveImageQualityMax
Definition document.h:162
PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocGetXmpMetadata(PDDoc doc, char *buffer, size_t bufSize, size_t *pSize)
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:204
@ kPDPageDirectionL2R
Definition document.h:205
@ kPDPageDirectionR2L
Definition document.h:206
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)
@ kPDOptSaveDownsampleImages
Definition document.h:140
@ kPDOptSaveRemoveInfo
Definition document.h:150
@ kPDOptSaveRemoveBookmarks
Definition document.h:144
@ kPDOptSaveRemoveAcroform
Definition document.h:145
@ kPDOptSaveRemoveAttachments
Definition document.h:143
@ kPDOptSaveRemoveOpenActions
Definition document.h:148
@ kPDOptSaveRemoveOCProperties
Definition document.h:146
@ kPDOptSaveRemoveStructTree
Definition document.h:142
@ kPDOptSaveRemoveMetadata
Definition document.h:141
@ kPDOptSaveRemoveAnnotations
Definition document.h:147
@ kPDOptSaveRemoveHiddenObjects
Definition document.h:138
@ kPDOptSaveRemoveJavaScript
Definition document.h:149
PDDocSaveFlagsBits
Specifies methods or optimizations applied during a saving operation.
Definition document.h:113
@ kPDDocSaveXRefCompressed
Definition document.h:128
@ kPDDocSaveFull
Definition document.h:117
@ kPDDocSaveIncremental
Definition document.h:114
@ kPDDocSaveCopy
Definition document.h:119
@ kPDDocSaveLinearized
Definition document.h:122
@ kPDDocSaveCompressed
Definition document.h:124
PDErrCode(PDFSDK_CALLCONV * PDDocAuthProc)(void *authProcData, PDAtom securityHandlerName, void *pAuthData)
Definition document.h:83
PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDDocSetXmpMetadata(PDDoc doc, const char *buffer, size_t bufSize)
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:86
Definition document.h:102
Definition document.h:173
void * progressData
A pointer to pass to progress each time it is called.
Definition document.h:187
PDDocSaveFlags flags
A combination of PDDocSaveFlags.
Definition document.h:175
const PDVersion * version
The version number of the document. Pass null to keep the current version.
Definition document.h:193
const PDProgressMonitor * progress
The progress monitor to receive notifications about the saving process. It may be null.
Definition document.h:184
PDWriteStream outputStream
The stream to write output document to. Used only if filePath is null.
Definition document.h:181
const PDOptSaveSettings * optSettings
The settings to use in "Reduce File Size". Pass null for the regular save.
Definition document.h:190
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:178
Definition document.h:95
Definition objects.h:83
Definition document.h:166
Specifies a structure to define a set of pages.
Definition document.h:44
size_t numPages
Definition document.h:47
const size_t * iPages
Definition document.h:45
Definition progress_monitor.h:15
Definition math_types.h:30
Definition document.h:20
PDRotate
Specifies degrees of rotation.
Definition types.h:38