litePDF C interface  2.0.5
Macros | Typedefs | Functions | Variables
litePDF.h File Reference

C interface. More...

Macros

#define LITEPDF_BEGIN_DECLS
 
#define LITEPDF_END_DECLS
 
#define LITEPDF_PUBLIC   __declspec(dllimport)
 
#define LITEPDF_UNIT_UNKNOWN   (0)
 
#define LITEPDF_UNIT_MM   (1)
 
#define LITEPDF_UNIT_10TH_MM   (2)
 
#define LITEPDF_UNIT_100TH_MM   (3)
 
#define LITEPDF_UNIT_1000TH_MM   (4)
 
#define LITEPDF_UNIT_INCH   (5)
 
#define LITEPDF_UNIT_10TH_INCH   (6)
 
#define LITEPDF_UNIT_100TH_INCH   (7)
 
#define LITEPDF_UNIT_1000TH_INCH   (8)
 
#define LITEPDF_FONT_FLAG_DEFAULT   0
 
#define LITEPDF_FONT_FLAG_DO_NOT_EMBED   1
 
#define LITEPDF_FONT_FLAG_EMBED_COMPLETE   2
 
#define LITEPDF_FONT_FLAG_EMBED_SUBSET   3
 
#define LITEPDF_FONT_FLAG_SUBSTITUTE   4
 
#define LITEPDF_ENCRYPT_PERMISSION_NONE   0x0
 
#define LITEPDF_ENCRYPT_PERMISSION_PRINT   0x00000004
 
#define LITEPDF_ENCRYPT_PERMISSION_EDIT   0x00000008
 
#define LITEPDF_ENCRYPT_PERMISSION_COPY   0x00000010
 
#define LITEPDF_ENCRYPT_PERMISSION_EDITNOTES   0x00000020
 
#define LITEPDF_ENCRYPT_PERMISSION_FILLANDSIGN   0x00000100
 
#define LITEPDF_ENCRYPT_PERMISSION_ACCESSIBLE   0x00000200
 
#define LITEPDF_ENCRYPT_PERMISSION_DOCASSEMBLY   0x00000400
 
#define LITEPDF_ENCRYPT_PERMISSION_HIGHPRINT   0x00000800
 
#define LITEPDF_ENCRYPT_ALGORITHM_RC4V1   1
 
#define LITEPDF_ENCRYPT_ALGORITHM_RC4V2   2
 
#define LITEPDF_ENCRYPT_ALGORITHM_AESV2   4
 
#define LITEPDF_ENCRYPT_ALGORITHM_AESV3   8
 
#define LITEPDF_DRAW_FLAG_NONE   (0)
 
#define LITEPDF_DRAW_FLAG_EMBED_FONTS_NONE   (1 << 4)
 
#define LITEPDF_DRAW_FLAG_EMBED_FONTS_COMPLETE   (1 << 0)
 
#define LITEPDF_DRAW_FLAG_EMBED_FONTS_SUBSET   (1 << 1)
 
#define LITEPDF_DRAW_FLAG_SUBSTITUTE_FONTS   (1 << 2)
 
#define LITEPDF_DRAW_FLAG_COMPRESS_IMAGES_WITH_JPEG   (1 << 3)
 
#define LITEPDF_DRAW_FLAG_RESET_GRAPHICS_STATE   (1 << 5)
 
#define LITEPDF_DOCUMENT_INFO_AUTHOR   "Author"
 
#define LITEPDF_DOCUMENT_INFO_CREATOR   "Creator"
 
#define LITEPDF_DOCUMENT_INFO_KEYWORDS   "Keywords"
 
#define LITEPDF_DOCUMENT_INFO_SUBJECT   "Subject"
 
#define LITEPDF_DOCUMENT_INFO_TITLE   "Title"
 
#define LITEPDF_DOCUMENT_INFO_PRODUCER   "Producer"
 
#define LITEPDF_DOCUMENT_INFO_TRAPPED   "Trapped"
 
#define LITEPDF_DOCUMENT_INFO_CREATION_DATE   "CreationDate"
 
#define LITEPDF_DOCUMENT_INFO_MODIFICATION_DATE   "ModDate"
 
#define LITEPDF_ANNOTATION_FLAG_NONE   0x0000
 
#define LITEPDF_ANNOTATION_FLAG_INVISIBLE   0x0001
 
#define LITEPDF_ANNOTATION_FLAG_HIDDEN   0x0002
 
#define LITEPDF_ANNOTATION_FLAG_PRINT   0x0004
 
#define LITEPDF_ANNOTATION_FLAG_NOZOOM   0x0008
 
#define LITEPDF_ANNOTATION_FLAG_NOROTATE   0x0010
 
#define LITEPDF_ANNOTATION_FLAG_NOVIEW   0x0020
 
#define LITEPDF_ANNOTATION_FLAG_READONLY   0x0040
 
#define LITEPDF_ANNOTATION_FLAG_LOCKED   0x0080
 
#define LITEPDF_ANNOTATION_FLAG_TOGGLENOVIEW   0x0100
 
#define LITEPDF_ANNOTATION_FLAG_LOCKEDCONTENTS   0x0200
 
#define LITEPDF_APPEARANCE_NORMAL   (0)
 
#define LITEPDF_APPEARANCE_ROLLOVER   (1)
 
#define LITEPDF_APPEARANCE_DOWN   (2)
 
#define LITEPDF_CERTIFICATION_PERMISSION_NO_PERMS   (1)
 
#define LITEPDF_CERTIFICATION_PERMISSION_FORM_FILL   (2)
 
#define LITEPDF_CERTIFICATION_PERMISSION_ANNOTATIONS   (3)
 
#define LITEPDF_SIGNATURE_HASH_SHA1   1
 
#define LITEPDF_SIGNATURE_HASH_SHA256   2
 
#define LITEPDF_SIGNATURE_HASH_SHA384   3
 
#define LITEPDF_SIGNATURE_HASH_SHA512   4
 
#define LITEPDF_BOOKMARK_FLAG_NONE   0x0000
 
#define LITEPDF_BOOKMARK_FLAG_ITALIC   0x0001
 
#define LITEPDF_BOOKMARK_FLAG_BOLD   0x0002
 

Typedefs

typedef unsigned int(__stdcall * litePDFEvalFontFlagCB )(char *inout_faceName, unsigned int faceNameBufferSize, void *user_data)
 
typedef void(__stdcall * litePDF_appendSignatureDataFunc )(const char *bytes, unsigned int bytes_len, void *user_data)
 
typedef void(__stdcall * litePDF_finishSignatureFunc )(char *signature, unsigned int *signature_len, void *user_data)
 

Functions

LITEPDF_BEGIN_DECLS typedef void (__stdcall *litePDFErrorCB)(unsigned int code
 
void *__stdcall LITEPDF_PUBLIC litePDF_CreateContext (litePDFErrorCB on_error, void *on_error_user_data)
 
void __stdcall LITEPDF_PUBLIC litePDF_FreeContext (void *pctx)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_SetUnit (void *pctx, unsigned int unitValue)
 
unsigned int __stdcall
LITEPDF_PUBLIC 
litePDF_GetUnit (void *pctx)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_SetEvalFontFlagCallback (void *pctx, litePDFEvalFontFlagCB callback, void *callback_user_data)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_PrepareEncryption (void *pctx, const char *userPassword, const char *ownerPassword, unsigned int permissions, unsigned int algorithm)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_CreateFileDocument (void *pctx, const char *fileName)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_CreateFileDocumentW (void *pctx, const wchar_t *fileName)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_CreateMemDocument (void *pctx)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_LoadFromFile (void *pctx, const char *fileName, const char *password, BOOL loadCompletely, BOOL forUpdate)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_LoadFromFileW (void *pctx, const wchar_t *fileName, const char *password, BOOL loadCompletely, BOOL forUpdate)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_LoadFromData (void *pctx, const BYTE *data, unsigned int dataLength, const char *password, BOOL forUpdate)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_SaveToFile (void *pctx, const char *fileName)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_SaveToFileW (void *pctx, const wchar_t *fileName)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_SaveToData (void *pctx, BYTE *data, unsigned int *dataLength)
 
void __stdcall LITEPDF_PUBLIC litePDF_Close (void *pctx)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetPageCount (void *pctx, unsigned int *pageCount)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetPageSize (void *pctx, unsigned int pageIndex, unsigned int *width_u, unsigned int *height_u)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetPageRotation (void *pctx, unsigned int pageIndex, int *out_degrees)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_SetPageRotation (void *pctx, unsigned int pageIndex, int degrees)
 
HDC __stdcall LITEPDF_PUBLIC litePDF_AddPage (void *pctx, unsigned int width_u, unsigned int height_u, unsigned int width_px, unsigned int height_px, unsigned int drawFlags)
 
HDC __stdcall LITEPDF_PUBLIC litePDF_InsertPage (void *pctx, unsigned int pageIndex, unsigned int width_u, unsigned int height_u, unsigned int width_px, unsigned int height_px, unsigned int drawFlags)
 
HDC __stdcall LITEPDF_PUBLIC litePDF_UpdatePage (void *pctx, unsigned int pageIndex, unsigned int width_px, unsigned int height_px, unsigned int drawFlags)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_FinishPage (void *pctx, HDC hDC)
 
HDC __stdcall LITEPDF_PUBLIC litePDF_AddResource (void *pctx, unsigned int width_u, unsigned int height_u, unsigned int width_px, unsigned int height_px, unsigned int drawFlags)
 
unsigned int __stdcall
LITEPDF_PUBLIC 
litePDF_FinishResource (void *pctx, HDC hDC)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_DeletePage (void *pctx, unsigned int pageIndex)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_AddPagesFrom (void *pctx, void *pctx_from, unsigned int pageIndex, unsigned int pageCount)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_InsertPageFrom (void *pctx, unsigned int pageIndexTo, void *pctx_from, unsigned int pageIndexFrom)
 
unsigned int __stdcall
LITEPDF_PUBLIC 
litePDF_AddPageFromAsResource (void *pctx, void *pctx_from, unsigned int pageIndex, BOOL useTrimBox)
 
unsigned int __stdcall
LITEPDF_PUBLIC 
litePDF_PageToResource (void *pctx, unsigned int pageIndex)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetResourceSize (void *pctx, unsigned int resourceID, unsigned int *width_u, unsigned int *height_u)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_DrawResource (void *pctx, unsigned int resourceID, unsigned int pageIndex, unsigned int unitValue, int x, int y, int scaleX, int scaleY)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_DrawResourceWithMatrix (void *pctx, unsigned int resourceID, unsigned int pageIndex, int a, int b, int c, int d, int e, int f)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_SetDocumentInfo (void *pctx, const char *name, const wchar_t *value)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetDocumentInfoExists (void *pctx, const char *name, BOOL *pExists)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetDocumentInfo (void *pctx, const char *name, wchar_t *value, unsigned int *valueLength)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetDocumentIsSigned (void *pctx, BOOL *pIsSigned)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetSignatureCount (void *pctx, unsigned int *pCount)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetSignatureName (void *pctx, unsigned int index, char *name, unsigned int *nameLength)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_CreateSignature (void *pctx, const char *name, unsigned int annotationPageIndex, int annotationX_u, int annotationY_u, int annotationWidth_u, int annotationHeight_u, unsigned int annotationFlags, unsigned int *pAddedIndex)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetSignatureHasData (void *pctx, unsigned int index, BOOL *pHasData)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetSignatureData (void *pctx, unsigned int index, BYTE *data, unsigned int *dataLength)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetSignatureRanges (void *pctx, unsigned int index, unsigned __int64 *pRangesArray, unsigned int *pRangesArrayLength)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_SetSignatureDate (void *pctx, unsigned int index, __int64 dateOfSign)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetSignatureDate (void *pctx, unsigned int index, __int64 *pDateOfSign)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_SetSignatureReason (void *pctx, unsigned int index, const wchar_t *reason)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetSignatureReason (void *pctx, unsigned int index, wchar_t *value, unsigned int *valueLength)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_SetSignatureLocation (void *pctx, unsigned int index, const wchar_t *location)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetSignatureLocation (void *pctx, unsigned int index, wchar_t *value, unsigned int *valueLength)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_SetSignatureCreator (void *pctx, unsigned int index, const char *creator)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetSignatureCreator (void *pctx, unsigned int index, char *value, unsigned int *valueLength)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_SetSignatureAppearance (void *pctx, unsigned int index, unsigned int appearanceType, unsigned int resourceID, int offsetX_u, int offsetY_u)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_SetSignatureCertification (void *pctx, unsigned int index, unsigned int permission)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_SetSignatureSize (void *pctx, unsigned int requestBytes)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_SetSignatureHash (void *pctx, unsigned int signatureHash)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_AddSignerPFX (void *pctx, const BYTE *pfxData, unsigned int pfxDataLength, const char *pfxPassword)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_AddSignerPEM (void *pctx, const BYTE *pemData, unsigned int pemDataLength, const BYTE *pkeyData, unsigned int pkeyDataLength, const char *pkeyPassword)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_SaveToFileWithSign (void *pctx, const char *fileName, unsigned int signatureIndex)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_SaveToFileWithSignW (void *pctx, const wchar_t *fileName, unsigned int signatureIndex)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_SaveToDataWithSign (void *pctx, unsigned int signatureIndex, BYTE *data, unsigned int *dataLength)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_SaveToFileWithSignManual (void *pctx, const char *fileName, unsigned int signatureIndex, litePDF_appendSignatureDataFunc appendSignatureData, void *append_user_data, litePDF_finishSignatureFunc finishSignature, void *finish_user_data)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_SaveToFileWithSignManualW (void *pctx, const wchar_t *fileName, unsigned int signatureIndex, litePDF_appendSignatureDataFunc appendSignatureData, void *append_user_data, litePDF_finishSignatureFunc finishSignature, void *finish_user_data)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_SaveToDataWithSignManual (void *pctx, unsigned int signatureIndex, litePDF_appendSignatureDataFunc appendSignatureData, void *append_user_data, litePDF_finishSignatureFunc finishSignature, void *finish_user_data, BYTE *data, unsigned int *dataLength)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_EmbedFile (void *pctx, const char *fileName)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_EmbedFileW (void *pctx, const wchar_t *fileName)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_EmbedData (void *pctx, const char *fileName, const BYTE *data, unsigned int dataLength)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_EmbedDataW (void *pctx, const wchar_t *fileName, const BYTE *data, unsigned int dataLength)
 
INT __stdcall LITEPDF_PUBLIC litePDF_GetEmbeddedFileCount (void *pctx)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetEmbeddedFileName (void *pctx, unsigned int index, char *fileName, unsigned int *fileNameLength)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetEmbeddedFileNameW (void *pctx, unsigned int index, wchar_t *fileName, unsigned int *fileNameLength)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetEmbeddedFileData (void *pctx, unsigned int index, BYTE *data, unsigned int *dataLength)
 
void *__stdcall LITEPDF_PUBLIC litePDF_GetPoDoFoDocument (void *pctx)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_DrawDebugPage (void *pctx, const char *filename)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_CreateLinkAnnotation (void *pctx, unsigned int annotationPageIndex, int annotationX_u, int annotationY_u, int annotationWidth_u, int annotationHeight_u, unsigned int annotationFlags, unsigned int annotationResourceID, unsigned int destinationPageIndex, unsigned int destinationX_u, unsigned int destinationY_u, const wchar_t *destinationDescription)
 
BOOL __stdcall LITEPDF_PUBLIC litePDF_CreateURIAnnotation (void *pctx, unsigned int annotationPageIndex, int annotationX_u, int annotationY_u, int annotationWidth_u, int annotationHeight_u, unsigned int annotationFlags, unsigned int annotationResourceID, const char *destinationURI, const wchar_t *destinationDescription)
 
unsigned int __stdcall
LITEPDF_PUBLIC 
litePDF_CreateBookmarkRoot (void *pctx, const wchar_t *title, unsigned int flags, unsigned char titleColor_red, unsigned char titleColor_green, unsigned char titleColor_blue, unsigned int destinationPageIndex, unsigned int destinationX_u, unsigned int destinationY_u)
 
unsigned int __stdcall
LITEPDF_PUBLIC 
litePDF_CreateBookmarkChild (void *pctx, unsigned int parentBookmarkID, const wchar_t *title, unsigned int flags, unsigned char titleColor_red, unsigned char titleColor_green, unsigned char titleColor_blue, unsigned int destinationPageIndex, unsigned int destinationX_u, unsigned int destinationY_u)
 
unsigned int __stdcall
LITEPDF_PUBLIC 
litePDF_CreateBookmarkSibling (void *pctx, unsigned int previousBookmarkID, const wchar_t *title, unsigned int flags, unsigned char titleColor_red, unsigned char titleColor_green, unsigned char titleColor_blue, unsigned int destinationPageIndex, unsigned int destinationX_u, unsigned int destinationY_u)
 

Variables

LITEPDF_BEGIN_DECLS typedef
const char * 
msg
 
LITEPDF_BEGIN_DECLS typedef
const char void
user_data
 

Detailed Description

C interface.

This document describes a direct C interface for litePDF.dll API.

Macro Definition Documentation

#define LITEPDF_ANNOTATION_FLAG_HIDDEN   0x0002

Do not allow show, print or interact with the annotation

#define LITEPDF_ANNOTATION_FLAG_INVISIBLE   0x0001

Do not show nonstandard annotation if there is no annotation handler available

#define LITEPDF_ANNOTATION_FLAG_LOCKED   0x0080

Do not allow the annotation to be deleted or its properties (including position and size) to be modified by the user

#define LITEPDF_ANNOTATION_FLAG_LOCKEDCONTENTS   0x0200

Do not allow the contents of the annotation to be modified by the user

#define LITEPDF_ANNOTATION_FLAG_NONE   0x0000

Default annotation flags

#define LITEPDF_ANNOTATION_FLAG_NOROTATE   0x0010

Do not rotate the annotation's appearance to match the rotation of the page

#define LITEPDF_ANNOTATION_FLAG_NOVIEW   0x0020

Do not display the annotation on the screen or allow it to interact with the user

#define LITEPDF_ANNOTATION_FLAG_NOZOOM   0x0008

Do not scale the annotation's appearance to match the magnification of the page

#define LITEPDF_ANNOTATION_FLAG_PRINT   0x0004

Print the annotation

#define LITEPDF_ANNOTATION_FLAG_READONLY   0x0040

Do not allow the annotation to interact with the user

#define LITEPDF_ANNOTATION_FLAG_TOGGLENOVIEW   0x0100

Invert the interpretation of the NoView flag for certain events

#define LITEPDF_APPEARANCE_DOWN   (2)

Down appearance; the default is the normal appearance

#define LITEPDF_APPEARANCE_NORMAL   (0)

Normal appearance

#define LITEPDF_APPEARANCE_ROLLOVER   (1)

Rollover appearance; the default is the normal appearance

#define LITEPDF_BEGIN_DECLS
#define LITEPDF_BOOKMARK_FLAG_BOLD   0x0002

Show bookmark title as a bold text

#define LITEPDF_BOOKMARK_FLAG_ITALIC   0x0001

Show bookmark title as an italic text

#define LITEPDF_BOOKMARK_FLAG_NONE   0x0000

Default bookmark flags

#define LITEPDF_CERTIFICATION_PERMISSION_ANNOTATIONS   (3)

Permitted changes are the same as for LITEPDF_CERTIFICATION_PERMISSION_FORM_FILL, as well as annotation creation, deletion, and modification; other changes invalidate the signature.

#define LITEPDF_CERTIFICATION_PERMISSION_FORM_FILL   (2)

Permitted changes are filling in forms, instantiating page templates, and signing; other changes invalidate the signature.

#define LITEPDF_CERTIFICATION_PERMISSION_NO_PERMS   (1)

No changes to the document are permitted; any change to the document invalidates the signature.

#define LITEPDF_DOCUMENT_INFO_AUTHOR   "Author"

an Author of the document

#define LITEPDF_DOCUMENT_INFO_CREATION_DATE   "CreationDate"

a date of the creation of the document

#define LITEPDF_DOCUMENT_INFO_CREATOR   "Creator"

a Creator of the document

#define LITEPDF_DOCUMENT_INFO_KEYWORDS   "Keywords"

the Keywords of the document

#define LITEPDF_DOCUMENT_INFO_MODIFICATION_DATE   "ModDate"

a date of the last modification of the document

#define LITEPDF_DOCUMENT_INFO_PRODUCER   "Producer"

a Producer of the document; this key is read-only

#define LITEPDF_DOCUMENT_INFO_SUBJECT   "Subject"

a Subject of the document

#define LITEPDF_DOCUMENT_INFO_TITLE   "Title"

a Title of the document

#define LITEPDF_DOCUMENT_INFO_TRAPPED   "Trapped"

a trapping state of the document

#define LITEPDF_DRAW_FLAG_COMPRESS_IMAGES_WITH_JPEG   (1 << 3)

Compress images with JPEG compression, to get smaller PDF document; this is used only for RGB images

#define LITEPDF_DRAW_FLAG_EMBED_FONTS_COMPLETE   (1 << 0)

Embed complete fonts into resulting PDF;

See Also
LITEPDF_DRAW_FLAG_EMBED_FONTS_SUBSET, LITEPDF_DRAW_FLAG_EMBED_FONTS_NONE
#define LITEPDF_DRAW_FLAG_EMBED_FONTS_NONE   (1 << 4)

Do not embed any fonts into resulting PDF.

Note
: Fonts' subset is embeded by default, if none of the LITEPDF_DRAW_FLAG_EMBED_FONTS_NONE, LITEPDF_DRAW_FLAG_EMBED_FONTS_COMPLETE, LITEPDF_DRAW_FLAG_EMBED_FONTS_SUBSET, flags is defined; the LITEPDF_DRAW_FLAG_EMBED_FONTS_NONE is to override default font embedding. The reason for this default embedding is due to PDF readers not showing correct fonts when they are not part of the PDF file.
See Also
LITEPDF_DRAW_FLAG_EMBED_FONTS_COMPLETE, LITEPDF_DRAW_FLAG_EMBED_FONTS_SUBSET
#define LITEPDF_DRAW_FLAG_EMBED_FONTS_SUBSET   (1 << 1)

Embed only subset of the fonts, aka used letters; this flag is used before LITEPDF_DRAW_FLAG_EMBED_FONTS_COMPLETE;

See Also
LITEPDF_DRAW_FLAG_EMBED_FONTS_NONE
#define LITEPDF_DRAW_FLAG_NONE   (0)

None draw flags

#define LITEPDF_DRAW_FLAG_RESET_GRAPHICS_STATE   (1 << 5)

Try to reset graphics state before appending new content to the page. This covers leftover saved states and the transformation matrix

#define LITEPDF_DRAW_FLAG_SUBSTITUTE_FONTS   (1 << 2)

Substitute fonts with base PDF fonts, if possible

#define LITEPDF_ENCRYPT_ALGORITHM_AESV2   4

AES encryption with a 128 bit key (PDF1.6)

#define LITEPDF_ENCRYPT_ALGORITHM_AESV3   8

AES encryption with a 256 bit key (PDF1.7 extension 3)

#define LITEPDF_ENCRYPT_ALGORITHM_RC4V1   1

RC4 Version 1 encryption using a 40bit key

#define LITEPDF_ENCRYPT_ALGORITHM_RC4V2   2

RC4 Version 2 encryption using a 128bit key

#define LITEPDF_ENCRYPT_PERMISSION_ACCESSIBLE   0x00000200

Extract text and graphics to support user with disabilities

#define LITEPDF_ENCRYPT_PERMISSION_COPY   0x00000010

Allow text and graphic extraction

#define LITEPDF_ENCRYPT_PERMISSION_DOCASSEMBLY   0x00000400

Assemble the document: insert, create, rotate delete pages or add bookmarks

#define LITEPDF_ENCRYPT_PERMISSION_EDIT   0x00000008

Allow modifying the document besides annotations, form fields or changing pages

#define LITEPDF_ENCRYPT_PERMISSION_EDITNOTES   0x00000020

Add or modify text annotations or form fields (if ePdfPermissions_Edit is set also allow to create interactive form fields including signature)

#define LITEPDF_ENCRYPT_PERMISSION_FILLANDSIGN   0x00000100

Fill in existing form or signature fields

#define LITEPDF_ENCRYPT_PERMISSION_HIGHPRINT   0x00000800

Print a high resolution version of the document

#define LITEPDF_ENCRYPT_PERMISSION_NONE   0x0

Nothing from the rest is allowed

#define LITEPDF_ENCRYPT_PERMISSION_PRINT   0x00000004

Allow printing the document

#define LITEPDF_END_DECLS
#define LITEPDF_FONT_FLAG_DEFAULT   0

Use the settings as specified by the draw operation

#define LITEPDF_FONT_FLAG_DO_NOT_EMBED   1

Do not embed the font

#define LITEPDF_FONT_FLAG_EMBED_COMPLETE   2

Embed complete font

#define LITEPDF_FONT_FLAG_EMBED_SUBSET   3

Embed the font with used characters only

#define LITEPDF_FONT_FLAG_SUBSTITUTE   4

Substitute the font with one of the base fonts, if possible

#define LITEPDF_PUBLIC   __declspec(dllimport)
#define LITEPDF_SIGNATURE_HASH_SHA1   1

Use SHA1 hash algorithm

#define LITEPDF_SIGNATURE_HASH_SHA256   2

Use SHA256 hash algorithm

#define LITEPDF_SIGNATURE_HASH_SHA384   3

Use SHA384 hash algorithm

#define LITEPDF_SIGNATURE_HASH_SHA512   4

Use SHA512 hash algorithm

#define LITEPDF_UNIT_1000TH_INCH   (8)

1/1000th of an inch unit; 5" is value 5000

#define LITEPDF_UNIT_1000TH_MM   (4)

1/1000th of a millimeter unit; 5 mm is value 5000

#define LITEPDF_UNIT_100TH_INCH   (7)

1/100th of an inch unit; 5" is value 500

#define LITEPDF_UNIT_100TH_MM   (3)

1/100th of a millimeter unit; 5 mm is value 500

#define LITEPDF_UNIT_10TH_INCH   (6)

1/10th of an inch unit; 5" is value 50

#define LITEPDF_UNIT_10TH_MM   (2)

1/10th of a millimeter unit; 5 mm is value 50

#define LITEPDF_UNIT_INCH   (5)

Inch unit

#define LITEPDF_UNIT_MM   (1)

Millimeters unit

#define LITEPDF_UNIT_UNKNOWN   (0)

Unknown unit; usually used to indicate an error

Typedef Documentation

typedef void(__stdcall * litePDF_appendSignatureDataFunc)(const char *bytes, unsigned int bytes_len, void *user_data)

The function is used within litePDF_SaveToFileWithSignManual and litePDF_SaveToDataWithSignManual. It is called called when more data should be added to hash computation.

typedef void(__stdcall * litePDF_finishSignatureFunc)(char *signature, unsigned int *signature_len, void *user_data)

The function is used within litePDF_SaveToFileWithSignManual and litePDF_SaveToDataWithSignManual. It is called when all the data are processed and the signature value is required. The signature_len contains size of the signature buffer. The callback is responsible to populate signature and signature_len with correct values. Set signature_len to zero on any error. Note the callback is called only once.

typedef unsigned int(__stdcall * litePDFEvalFontFlagCB)(char *inout_faceName, unsigned int faceNameBufferSize, void *user_data)

A callback to evaluate what to do with the specified font. The function can be also used to rename the font, without changing the font flag. The size of the inout_faceName buffer is faceNameBufferSize and when renaming it, the written value should not be longer than faceNameBufferSize, including the nul-terminating character.

The returned value for one font name should be consistent. It's not possible to for example once request complete font embedding and the other time to request no embedding at all.

Parameters
inout_faceName[in/out] The font face name to evaluate the flag for.
faceNameBufferSizeSize of the inout_faceName buffer.
user_dataUser data provided in litePDF_SetEvalFontFlagCallback.
Returns
One of LITEPDF_FONT_FLAG_DEFAULT, LITEPDF_FONT_FLAG_DO_NOT_EMBED, LITEPDF_FONT_FLAG_EMBED_COMPLETE, LITEPDF_FONT_FLAG_EMBED_SUBSET, LITEPDF_FONT_FLAG_SUBSTITUTE.

Function Documentation

HDC __stdcall LITEPDF_PUBLIC litePDF_AddPage ( void pctx,
unsigned int  width_u,
unsigned int  height_u,
unsigned int  width_px,
unsigned int  height_px,
unsigned int  drawFlags 
)

Begins drawing into a new page into the PDF context of the given size. Newly created page is added as the last page of the PDF document. This cannot be called when other drawing is in progress.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
width_uWidth of the new page in the current unit.
height_uHeight of the new page in the current unit.
width_pxWidth of the new page in pixels.
height_pxHeight of the new page in pixels.
drawFlagsFlags for drawing functions. This is a bit-or of LITEPDF_DRAW_FLAG values and influences only litePDF_AddPage, litePDF_InsertPage, litePDF_UpdatePage and litePDF_AddResource functions.
Returns
Device context into which can be drawn with standard GDI functions. Finish the drawing, and the page addition, with litePDF_FinishPage.
Note
Larger pixel page size produces more precise font mapping.
See Also
litePDF_GetUnit, litePDF_InsertPage, litePDF_UpdatePage, litePDF_FinishPage, litePDF_AddResource
unsigned int __stdcall LITEPDF_PUBLIC litePDF_AddPageFromAsResource ( void pctx,
void pctx_from,
unsigned int  pageIndex,
BOOL  useTrimBox 
)

Adds an existing page as a resource of a given PDF. This resource can be referenced multiple times by its identifier. Both contexts should hold memory-based documents.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext, to which add the page resource.
pctx_fromlitePDF context, previously created with litePDF_CreateContext, from which add the page.
pageIndexPage index which to add from pctx_from; counts from 0.
useTrimBoxIf TRUE, try to use trimbox for size of the resource (XObject)
Returns
Resource identifier, or 0 on error.
Note
The two contexts cannot be the same.
See Also
litePDF_GetPageCount, litePDF_AddPagesFrom, litePDF_PageToResource, litePDF_GetResourceSize, litePDF_DrawResource
BOOL __stdcall LITEPDF_PUBLIC litePDF_AddPagesFrom ( void pctx,
void pctx_from,
unsigned int  pageIndex,
unsigned int  pageCount 
)

Adds existing pages as the last pages from another PDF. Both contexts should hold memory-based documents.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext, to which add the page.
pctx_fromlitePDF context, previously created with litePDF_CreateContext, from which add the pages.
pageIndexPage index which to add from pctx_from; counts from 0.
pageCountHow many pages to add; 0 means whole document.
Returns
Whether succeeded.
Note
The two contexts cannot be the same.
See Also
litePDF_GetPageCount, litePDF_InsertPageFrom, litePDF_PageToResource
HDC __stdcall LITEPDF_PUBLIC litePDF_AddResource ( void pctx,
unsigned int  width_u,
unsigned int  height_u,
unsigned int  width_px,
unsigned int  height_px,
unsigned int  drawFlags 
)

Begins drawing into a new resource into the PDF context of the given size. This cannot be called when other drawing is in progress.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
width_uWidth of the new page in the current unit.
height_uHeight of the new page in the current unit.
width_pxWidth of the new page in pixels.
height_pxHeight of the new page in pixels.
drawFlagsFlags for drawing functions. This is a bit-or of LITEPDF_DRAW_FLAG values and influences only litePDF_AddPage, litePDF_InsertPage, litePDF_UpdatePage and litePDF_AddResource functions.
Returns
Device context into which can be drawn with standard GDI functions. Finish the drawing, and the resource addition, with litePDF_FinishResource.
Note
Larger pixel resource size produces more precise font mapping.
See Also
litePDF_GetUnit, litePDF_AddPage, litePDF_InsertPage, litePDF_UpdatePage, litePDF_FinishResource, litePDF_DrawResource
BOOL __stdcall LITEPDF_PUBLIC litePDF_AddSignerPEM ( void pctx,
const BYTE *  pemData,
unsigned int  pemDataLength,
const BYTE *  pkeyData,
unsigned int  pkeyDataLength,
const char *  pkeyPassword 
)

Adds a signer to be used when digitally signing the document with litePDF_SaveToFileWithSign or litePDF_SaveToDataWithSign. The passed-in certificate and private key are in the PEM format.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
pemDataA certificate in the PEM format.
pemDataLengthA length of the pemData.
pkeyDataA private key for the certificate, in the PEM format.
pkeyDataLengthA length of the pkeyData.
pkeyPasswordA password to use to open the private key; can be NULL.
Returns
Whether succeeded.
See Also
litePDF_AddSignerPFX
BOOL __stdcall LITEPDF_PUBLIC litePDF_AddSignerPFX ( void pctx,
const BYTE *  pfxData,
unsigned int  pfxDataLength,
const char *  pfxPassword 
)

Adds a signer to be used when digitally signing the document with litePDF_SaveToFileWithSign or litePDF_SaveToDataWithSign. The passed-in certificate is in the PFX format and should include the private key.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
pfxDataA certificate with private key in the PFX format.
pfxDataLengthA length of the pfxData.
pfxPasswordA password to use to open the PFX certificate; can be NULL.
Returns
Whether succeeded.
See Also
litePDF_AddSignerPEM
void __stdcall LITEPDF_PUBLIC litePDF_Close ( void pctx)

Closes PDF data in a litePDF context, thus the context doesn't hold anything afterward, aka it's like a context just created with litePDF_CreateContext. Do not forget to free the context itself with litePDF_FreeContext, when no longer needed. The function does nothing, if the context doesn't hold any data. In case of any drawing in progress, the drawing is discarded, same as any unsaved changes to the memory-based PDF documents. It also unsets any encryption properties, previously set by litePDF_PrepareEncryption.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
See Also
litePDF_AddPage, litePDF_InsertPage, litePDF_UpdatePage, litePDF_FinishPage
unsigned int __stdcall LITEPDF_PUBLIC litePDF_CreateBookmarkChild ( void pctx,
unsigned int  parentBookmarkID,
const wchar_t *  title,
unsigned int  flags,
unsigned char  titleColor_red,
unsigned char  titleColor_green,
unsigned char  titleColor_blue,
unsigned int  destinationPageIndex,
unsigned int  destinationX_u,
unsigned int  destinationY_u 
)

Creates a new child bookmark, which will target the given destination page and the position in it. The context should hold a memory-based document. Note, the bookmarks can be created only when the document is not drawing, to have all the document pages available.

Parameters
pctxA litePDF context, previously created with litePDF_CreateContext, to which add the link annotation.
parentBookmarkIDBookmark ID of the parent bookmark. The child will be created under this bookmark.
titleTitle of the bookmark.
flagsBit-or of LITEPDF_BOOKMARK_FLAG_ flags.
titleColor_redRGB red value of the title text color.
titleColor_greenRGB green value of the title text color.
titleColor_blueRGB blue value of the title text color.
destinationPageIndexPage index where the link points to.
destinationX_uX-origin of the destination on the page, in the current unit.
destinationY_uY-origin of the destination on the page, in the current unit.
Returns
Created bookmark ID or 0, when the bookmark could not be created.
See Also
litePDF_GetUnit, litePDF_CreateBookmarkRoot, litePDF_CreateBookmarkSibling, litePDF_CreateLinkAnnotation
unsigned int __stdcall LITEPDF_PUBLIC litePDF_CreateBookmarkRoot ( void pctx,
const wchar_t *  title,
unsigned int  flags,
unsigned char  titleColor_red,
unsigned char  titleColor_green,
unsigned char  titleColor_blue,
unsigned int  destinationPageIndex,
unsigned int  destinationX_u,
unsigned int  destinationY_u 
)

Creates a new root (top-level) bookmark, which will target the given destination page and the position in it. The context should hold a memory-based document. Note, the bookmarks can be created only when the document is not drawing, to have all the document pages available.

Parameters
pctxA litePDF context, previously created with litePDF_CreateContext, to which add the link annotation.
titleTitle of the bookmark.
flagsBit-or of LITEPDF_BOOKMARK_FLAG_ flags.
titleColor_redRGB red value of the title text color.
titleColor_greenRGB green value of the title text color.
titleColor_blueRGB blue value of the title text color.
destinationPageIndexPage index where the link points to.
destinationX_uX-origin of the destination on the page, in the current unit.
destinationY_uY-origin of the destination on the page, in the current unit.
Returns
Created bookmark ID or 0, when the bookmark could not be created.
See Also
litePDF_GetUnit, litePDF_CreateBookmarkChild, litePDF_CreateBookmarkSibling, litePDF_CreateLinkAnnotation
unsigned int __stdcall LITEPDF_PUBLIC litePDF_CreateBookmarkSibling ( void pctx,
unsigned int  previousBookmarkID,
const wchar_t *  title,
unsigned int  flags,
unsigned char  titleColor_red,
unsigned char  titleColor_green,
unsigned char  titleColor_blue,
unsigned int  destinationPageIndex,
unsigned int  destinationX_u,
unsigned int  destinationY_u 
)

Creates a new sibling (next) bookmark, which will target the given destination page and the position in it. The context should hold a memory-based document. Note, the bookmarks can be created only when the document is not drawing, to have all the document pages available.

Parameters
pctxA litePDF context, previously created with litePDF_CreateContext, to which add the link annotation.
previousBookmarkIDBookmark ID of the previous bookmark. The sibling will be created as the next of this bookmark.
titleTitle of the bookmark.
flagsBit-or of LITEPDF_BOOKMARK_FLAG_ flags.
titleColor_redRGB red value of the title text color.
titleColor_greenRGB green value of the title text color.
titleColor_blueRGB blue value of the title text color.
destinationPageIndexPage index where the link points to.
destinationX_uX-origin of the destination on the page, in the current unit.
destinationY_uY-origin of the destination on the page, in the current unit.
Returns
Created bookmark ID or 0, when the bookmark could not be created.
See Also
litePDF_GetUnit, litePDF_CreateBookmarkRoot, litePDF_CreateBookmarkChild, litePDF_CreateLinkAnnotation
void* __stdcall LITEPDF_PUBLIC litePDF_CreateContext ( litePDFErrorCB  on_error,
void on_error_user_data 
)

Creates a new litePDF context. This is used in other litePDF functions. The returned context should be freed with litePDF_FreeContext when no longer needed.

Parameters
on_errorCallback called on errors. This is used to report litePDF errors and is used during whole life time of the returned context.
on_error_user_dataUser data passed into on_error callback.
Returns
Newly created litePDF context. This should be freed with litePDF_FreeContext.
BOOL __stdcall LITEPDF_PUBLIC litePDF_CreateFileDocument ( void pctx,
const char *  fileName 
)

Makes the litePDF context hold a new PDF, which writes directly to a file. The passed-in litePDF context should not have opened any other PDF data. Call litePDF_Close, to close the file, and possibly save changes to it. Most of the operations require memory-based PDF, which can be created with litePDF_CreateMemDocument.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
fileNameFile name to write the PDF result to.
Returns
Whether succeeded.
Note
PoDoFo doesn't support creation of file-based documents with AES encryption, thus use for it memory-based documents instead (litePDF_CreateMemDocument).
See Also
litePDF_PrepareEncryption, litePDF_CreateFileDocumentW, litePDF_CreateMemDocument, litePDF_LoadFromFile
BOOL __stdcall LITEPDF_PUBLIC litePDF_CreateFileDocumentW ( void pctx,
const wchar_t *  fileName 
)

This is the same as litePDF_CreateFileDocument, the only difference is that the fileName is a wide string.

BOOL __stdcall LITEPDF_PUBLIC litePDF_CreateLinkAnnotation ( void pctx,
unsigned int  annotationPageIndex,
int  annotationX_u,
int  annotationY_u,
int  annotationWidth_u,
int  annotationHeight_u,
unsigned int  annotationFlags,
unsigned int  annotationResourceID,
unsigned int  destinationPageIndex,
unsigned int  destinationX_u,
unsigned int  destinationY_u,
const wchar_t *  destinationDescription 
)

Creates a link annotation at the given page and position, which will target the given destination page and the position in it. The context should hold a memory-based document. Note, the link annotation can be created only when the document is not drawing, to have all the document pages available.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext, to which add the link annotation.
annotationPageIndexPage index where to place the link annotation.
annotationX_uX-origin of the annotation on the page, in the current unit.
annotationY_uY-origin of the annotation on the page, in the current unit.
annotationWidth_uWidth of the annotation on the page, in the current unit.
annotationHeight_uHeight of the annotation on the page, in the current unit.
annotationFlagsBit-or of LITEPDF_ANNOTATION_FLAG_ flags.
annotationResourceIDOptional resource ID of the annotation content, as shown to the user. 0 means do not add additional visualization on the page, but the annotation can be still clicked.
destinationPageIndexPage index where the link points to.
destinationX_uX-origin of the destination on the page, in the current unit.
destinationY_uY-origin of the destination on the page, in the current unit.
destinationDescriptionOptional destination description, which can be used for accessibility reasons by the viewer.
Returns
Whether succeeded.
See Also
litePDF_GetUnit, litePDF_GetPageCount, litePDF_AddResource, litePDF_CreateBookmarkRoot
BOOL __stdcall LITEPDF_PUBLIC litePDF_CreateMemDocument ( void pctx)

Makes the litePDF context hold a memory-based PDF. Such PDF can be saved with litePDF_SaveToFile or litePDF_SaveToData. The PDF should be closed with litePDF_Close.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
Returns
Whether succeeded.
See Also
litePDF_PrepareEncryption, litePDF_CreateFileDocument, litePDF_LoadFromFile
BOOL __stdcall LITEPDF_PUBLIC litePDF_CreateSignature ( void pctx,
const char *  name,
unsigned int  annotationPageIndex,
int  annotationX_u,
int  annotationY_u,
int  annotationWidth_u,
int  annotationHeight_u,
unsigned int  annotationFlags,
unsigned int *  pAddedIndex 
)

Creates a new signature field named name. The field is created completely empty. Use litePDF_SetSignatureDate, litePDF_SetSignatureReason, litePDF_SetSignatureLocation, litePDF_SetSignatureCreator, litePDF_SetSignatureAppearance and such to populate it with required values. Finally, to sign the signature field use litePDF_SaveToFileWithSign family functions.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
nameSignature field name to use. This should be unique.
annotationPageIndexPage index where to place the signature annotation.
annotationX_uX-origin of the annotation on the page, in the current unit.
annotationY_uY-origin of the annotation on the page, in the current unit.
annotationWidth_uWidth of the annotation on the page, in the current unit.
annotationHeight_uHeight of the annotation on the page, in the current unit.
annotationFlagsBit-or of LITEPDF_ANNOTATION_FLAG_ flags.
pAddedIndex[out] Optional parameter, if not NULL, then it's populated with the index of the added signature field.
Returns
Whether succeeded. The call can also fail when a signature field of the same name already exists.
See Also
litePDF_GetSignatureCount, litePDF_GetSignatureName
BOOL __stdcall LITEPDF_PUBLIC litePDF_CreateURIAnnotation ( void pctx,
unsigned int  annotationPageIndex,
int  annotationX_u,
int  annotationY_u,
int  annotationWidth_u,
int  annotationHeight_u,
unsigned int  annotationFlags,
unsigned int  annotationResourceID,
const char *  destinationURI,
const wchar_t *  destinationDescription 
)

Creates a URI annotation at the given page and position, which will reference the given destination URI. The context should hold a memory-based document. Note, the URI annotation can be created only when the document is not drawing, to have all the document pages available.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext, to which add the URI annotation.
annotationPageIndexPage index where to place the URI annotation.
annotationX_uX-origin of the annotation on the page, in the current unit.
annotationY_uY-origin of the annotation on the page, in the current unit.
annotationWidth_uWidth of the annotation on the page, in the current unit.
annotationHeight_uHeight of the annotation on the page, in the current unit.
annotationFlagsBit-or of LITEPDF_ANNOTATION_FLAG_ flags.
annotationResourceIDOptional resource ID of the annotation content, as shown to the user. 0 means do not add additional visualization on the page, but the annotation can be still clicked.
destinationURIThe URI the annotation points to.
destinationDescriptionOptional destination description, which can be used for accessibility reasons by the viewer.
Returns
Whether succeeded.
See Also
litePDF_GetUnit, litePDF_GetPageCount, litePDF_AddResource
BOOL __stdcall LITEPDF_PUBLIC litePDF_DeletePage ( void pctx,
unsigned int  pageIndex 
)

Deletes page at given index. It doesn't delete page resources, because these can be used by other pages.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
pageIndexPage index which to update; counts from 0.
Returns
Whether succeeded.
See Also
litePDF_GetPageCount, litePDF_PageToResource
BOOL __stdcall LITEPDF_PUBLIC litePDF_DrawDebugPage ( void pctx,
const char *  filename 
)

Draws saved debugPage as a new page into the PDF file. There should not be running any drawing when calling this function (like no page can be opened for drawing).

Parameters
pctxlitePDF context, previously created with litePDF_CreateContext.
filenameFile name with full path for litePDF debug page.
BOOL __stdcall LITEPDF_PUBLIC litePDF_DrawResource ( void pctx,
unsigned int  resourceID,
unsigned int  pageIndex,
unsigned int  unitValue,
int  x,
int  y,
int  scaleX,
int  scaleY 
)

Draws an existing resource at the given position. The resource ID was returned from litePDF_AddPageFromAsResource, litePDF_PageToResource or litePDF_FinishResource. The unitValue is used for both the position and the scale. In case of the scale, it defines only the ratio to the base unit. For example, if the unitValue is either LITEPDF_UNIT_1000TH_MM or LITEPDF_UNIT_1000TH_INCH, then the ratio for the scaleX and scaleY is used 1/1000 (where 1000 means the same size as the resource is in this case).

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
resourceIDResource ID to draw.
pageIndexPage index to which draw; counts from 0.
unitValueA unit to use for the x and y, and a ratio for the scaleX and scaleY.
xWhere to draw on the page, X axes, in the given unitValue unit, with left-top corner being [0,0].
yWhere to draw on the page, Y axes, in the given unitValue unit, with left-top corner being [0,0].
scaleXScale factor of the page for the X axes, using the unitValue ratio.
scaleYScale factor of the page for the Y axes, using the unitValue ratio.
Returns
Whether succeeded.
See Also
litePDF_GetPageCount, litePDF_AddPageFromAsResource, litePDF_PageToResource, litePDF_FinishResource, litePDF_GetResourceSize, litePDF_DrawResourceWithMatrix
BOOL __stdcall LITEPDF_PUBLIC litePDF_DrawResourceWithMatrix ( void pctx,
unsigned int  resourceID,
unsigned int  pageIndex,
int  a,
int  b,
int  c,
int  d,
int  e,
int  f 
)

Draws an existing resource with given transformation matrix. All the transformation values are passed into PDF directly, without any conversion. The resource ID was returned from litePDF_AddPageFromAsResource or litePDF_FinishResource. The constructed transformation matrix is a standard 3x3 matrix:
| a b 0 |
| c d 0 |
| e f 1 |

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
resourceIDResource ID to draw.
pageIndexPage index to which draw; counts from 0.
aTransformation matrix [ a b c d e f ] parameter 'a', in 1/1000th of PDF units.
bTransformation matrix [ a b c d e f ] parameter 'b', in 1/1000th of PDF units.
cTransformation matrix [ a b c d e f ] parameter 'c', in 1/1000th of PDF units.
dTransformation matrix [ a b c d e f ] parameter 'd', in 1/1000th of PDF units.
eTransformation matrix [ a b c d e f ] parameter 'e', in 1/1000th of PDF units.
fTransformation matrix [ a b c d e f ] parameter 'f', in 1/1000th of PDF units.
Returns
Whether succeeded.
See Also
litePDF_GetPageCount, litePDF_AddPageFromAsResource, litePDF_FinishResource, litePDF_GetResourceSize, litePDF_DrawResource
BOOL __stdcall LITEPDF_PUBLIC litePDF_EmbedData ( void pctx,
const char *  fileName,
const BYTE *  data,
unsigned int  dataLength 
)

Embeds a data (file) into a PDF document.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
fileNameFile name to be used for the data identification.
dataActual data to be attached.
dataLengthLength of the data.
Returns
Whether succeeded.
Note
Data can be embed only to memory-based documents.
The path is stripped from the fileName. The fileName is used as a key, aka it's not possible to embed two files of the same name into a PDF document.
See Also
litePDF_EmbedDataW, litePDF_EmbedFile, litePDF_CreateMemDocument
BOOL __stdcall LITEPDF_PUBLIC litePDF_EmbedDataW ( void pctx,
const wchar_t *  fileName,
const BYTE *  data,
unsigned int  dataLength 
)

This is the same as litePDF_EmbedData, the only difference is that the fileName is a wide string.

BOOL __stdcall LITEPDF_PUBLIC litePDF_EmbedFile ( void pctx,
const char *  fileName 
)

Embeds a file into a PDF document.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
fileNameFile name of the file to be attached.
Returns
Whether succeeded.
Note
Files can be embed only to memory-based documents.
The path is stripped from the fileName. The fileName is used as a key, aka it's not possible to embed two files of the same name into a PDF document.
See Also
litePDF_EmbedFileW, litePDF_EmbedData, litePDF_CreateMemDocument
BOOL __stdcall LITEPDF_PUBLIC litePDF_EmbedFileW ( void pctx,
const wchar_t *  fileName 
)

This is the same as litePDF_EmbedFile, the only difference is that the fileName is a wide string.

BOOL __stdcall LITEPDF_PUBLIC litePDF_FinishPage ( void pctx,
HDC  hDC 
)

Tells litePDF that drawing into the page is finished and that it can be processed into PDF. The hDC is not valid after this call any more.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
hDCDevice context previously returned by litePDF_AddPage, litePDF_InsertPage or litePDF_UpdatePage.
Returns
Whether succeeded.
unsigned int __stdcall LITEPDF_PUBLIC litePDF_FinishResource ( void pctx,
HDC  hDC 
)

Tells litePDF that drawing into the resource is finished and that it can be processed into PDF. The hDC is not valid after this call any more.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
hDCDevice context previously returned by litePDF_AddResource.
Returns
Newly created resource ID, or 0 on error.
See Also
litePDF_AddResource, litePDF_AddPageFromAsResource, litePDF_DrawResource
void __stdcall LITEPDF_PUBLIC litePDF_FreeContext ( void pctx)

Frees litePDF context previously created with litePDF_CreateContext. If it contains any unsaved data, then these are discarded.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetDocumentInfo ( void pctx,
const char *  name,
wchar_t *  value,
unsigned int *  valueLength 
)

Gets information about the document. The name can be one of the LITEPDF_DOCUMENT_INFO predefined constants.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
nameDocument info property name to get.
value[out] Null-terminated Unicode value. It can be NULL, in which case the valueLength is populated with large-enough value to hold the whole string.
valueLength[in/out] Tells how many characters can be stored in value. If value is NULL, then it is set to large-enough value (not including the Null-termination character). Passing non-NULL value with no enough large buffer results in a failure with no change on valueLength. The valueLength has stored count of characters written, not including the Null-termination character on success.
Returns
Whether succeeded.
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetDocumentInfoExists ( void pctx,
const char *  name,
BOOL *  pExists 
)

Checks whether information about the document of the given name exists. The name can be one of the LITEPDF_DOCUMENT_INFO predefined constants.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
nameDocument info property name to test.
pExists[out] Where to store whether the document information is set.
Returns
Whether succeeded.
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetDocumentIsSigned ( void pctx,
BOOL *  pIsSigned 
)

Checks whether currently opened document is already signed. Signing already signed document can cause breakage of previous signatures, thus it's good to test whether the loaded document is signed, before signing it.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
pIsSigned[out] Where to store the result.
Returns
Whether succeeded.
See Also
litePDF_GetSignatureCount, litePDF_SaveToFileWithSign, litePDF_SaveToDataWithSign
INT __stdcall LITEPDF_PUBLIC litePDF_GetEmbeddedFileCount ( void pctx)

Gets count of embedded files stored in a PDF document.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
Returns
Count of found embedded files, or -1 on error.
See Also
litePDF_EmbedFile, litePDF_EmbedData, litePDF_GetEmbeddedFileName, litePDF_GetEmbeddedFileData
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetEmbeddedFileData ( void pctx,
unsigned int  index,
BYTE *  data,
unsigned int *  dataLength 
)

Gets embedded file's data, as stored in a PDF document. There are no data returned, if the file was not embed.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
indexIndex of the embedded file; returns failure, if out of range.
data[out] Actual embedded file's data, as stored in the PDF. It can be NULL, in which case the dataLength is populated with large-enough value to hold the whole data.
dataLength[in/out] Tells how many bytes can be stored in data. If data is NULL, then it is set to large-enough value. Passing non-NULL data with no enough large buffer results in a failure with no change on dataLength.
Returns
Whether succeeded.
See Also
litePDF_EmbedFile, litePDF_EmbedData, litePDF_GetEmbeddedFileCount, litePDF_GetEmbeddedFileName
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetEmbeddedFileName ( void pctx,
unsigned int  index,
char *  fileName,
unsigned int *  fileNameLength 
)

Gets embedded file's name, as stored in a PDF document.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
indexIndex of the embedded file; returns failure, if out of range.
fileName[out] Buffer to store the embedded file's name to. It can be NULL, in which case the fileNameLength is populated with large-enough value to hold the whole string.
fileNameLength[in/out] Tells how many characters can be stored in fileName. If fileName is NULL, then it is set to large-enough value. Passing non-NULL fileName with no enough large buffer results in a failure with no change on fileNameLength. The set length is without the Null-terminate character.
Returns
Whether succeeded.
See Also
litePDF_GetEmbeddedFileNameW, litePDF_EmbedFile, litePDF_EmbedData, litePDF_GetEmbeddedFileCount, litePDF_GetEmbeddedFileData
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetEmbeddedFileNameW ( void pctx,
unsigned int  index,
wchar_t *  fileName,
unsigned int *  fileNameLength 
)

This is the same as litePDF_GetEmbeddedFileName, the only difference is that the fileName is a wide string.

BOOL __stdcall LITEPDF_PUBLIC litePDF_GetPageCount ( void pctx,
unsigned int *  pageCount 
)

Returns count of pages in a PDF opened in the litePDF context.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
pageCount[out] Count of pages.
Returns
Whether succeeded.
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetPageRotation ( void pctx,
unsigned int  pageIndex,
int *  out_degrees 
)

Gets rotation of an existing page, in degrees. Expected values are 0, 90, 180 and 270.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
pageIndexPage index for which get the page size; counts from 0.
out_degrees[out] Rotation of the page, in degrees.
Returns
Whether succeeded.
See Also
litePDF_SetPageRotation
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetPageSize ( void pctx,
unsigned int  pageIndex,
unsigned int *  width_u,
unsigned int *  height_u 
)

Gets size of an existing page, in the current unit.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
pageIndexPage index for which get the page size; counts from 0.
width_u[out] Width of the page in the current unit.
height_u[out] Height of the page in the current unit.
Returns
Whether succeeded.
See Also
litePDF_GetUnit
void* __stdcall LITEPDF_PUBLIC litePDF_GetPoDoFoDocument ( void pctx)

Gets a pointer to PoDoFo::PdfDocument document, which is currently opened. The returned pointer is owned by litePDF, do not free it. It is valid until the document is closed.

Returns
Pointer to currently opened PoDoFo::PdfDocument.
See Also
litePDF_Close
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetResourceSize ( void pctx,
unsigned int  resourceID,
unsigned int *  width_u,
unsigned int *  height_u 
)

Gets size of an existing resource, in the current unit. The resource ID was returned from litePDF_AddPageFromAsResource or litePDF_FinishResource.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
resourceIDResource ID for which get the size.
width_u[out] Width of the resource, in the current unit.
height_u[out] Height of the resource, in the current unit.
Returns
Whether succeeded.
See Also
litePDF_GetUnit, litePDF_AddPageFromAsResource, litePDF_DrawResource
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetSignatureCount ( void pctx,
unsigned int *  pCount 
)

Provides how many signature fields the currently opened document contains. It returns the count of the all fields, not only those already signed.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
pCount[out] Where to store the result.
Returns
Whether succeeded.
Note
The litePDF caches the list of the existing signature fields for performance reasons and it rebuilds it whenever this function is called or when the litePDF_CreateSignature is called, thus if there are made any changes directly with the PoDoFo API after the cache had been created, then make sure you call this function again to avoid a use-after-free or an outdated information being used. The litePDF will try to keep the cache up to date as needed, but it cannot cover every case, especially not the one when the PoDoFo API is used.
See Also
litePDF_GetDocumentIsSigned, litePDF_GetSignatureHasData, litePDF_GetSignatureData
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetSignatureCreator ( void pctx,
unsigned int  index,
char *  value,
unsigned int *  valueLength 
)

Gets signature creator.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
indexWhich signature to use; counts from 0. This might be less than litePDF_GetSignatureCount.
value[out] Null-terminated ASCII value. It can be NULL, in which case the valueLength is populated with large-enough value to hold the whole string.
valueLength[in/out] Tells how many characters can be stored in value. If value is NULL, then it is set to large-enough value (not including the Null-termination character). Passing non-NULL value with no enough large buffer results in a failure with no change on valueLength. The valueLength has stored count of characters written, not including the Null-termination character on success.
Returns
Whether succeeded.
See Also
litePDF_SetSignatureCreator, litePDF_GetSignatureCount
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetSignatureData ( void pctx,
unsigned int  index,
BYTE *  data,
unsigned int *  dataLength 
)

Gathers raw signature data for the given signature in the currently opened document. Use litePDF_GetSignatureHasData to check whether the given signature field is signed or not.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
indexWhich signature data to get; counts from 0. This might be less than litePDF_GetSignatureCount.
data[out] Actual data to store the signature content to. It can be NULL, in which case the dataLength is populated with large-enough value to hold the whole data.
dataLength[in/out] Tells how many bytes can be stored in data. If data is NULL, then it is set to large-enough value. Passing non-NULL data with no enough large buffer results in a failure with no change on dataLength.
Returns
Whether succeeded.
See Also
litePDF_GetDocumentIsSigned, litePDF_GetSignatureCount, litePDF_GetSignatureRanges
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetSignatureDate ( void pctx,
unsigned int  index,
__int64 *  pDateOfSign 
)

Gets signature field date of sign.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
indexWhich signature to use; counts from 0. This might be less than litePDF_GetSignatureCount.
pDateOfSign[out] A variable where to store the date of sign. It's like Unix time_t, as set by the signature field creator. The value can be clamp on 32-bit systems.
Returns
Whether succeeded.
See Also
litePDF_SetSignatureDate, litePDF_GetSignatureCount
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetSignatureHasData ( void pctx,
unsigned int  index,
BOOL *  pHasData 
)

Checks whether the given signature field contains any data, which means whether the signature field is signed.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
indexWhich signature data to get; counts from 0. This might be less than litePDF_GetSignatureCount.
pHasData[out] Set to TRUE, when the given signature contains any data.
Returns
Whether succeeded.
See Also
litePDF_GetSignatureData
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetSignatureLocation ( void pctx,
unsigned int  index,
wchar_t *  value,
unsigned int *  valueLength 
)

Gets signature location.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
indexWhich signature to use; counts from 0. This might be less than litePDF_GetSignatureCount.
value[out] Null-terminated Unicode value. It can be NULL, in which case the valueLength is populated with large-enough value to hold the whole string.
valueLength[in/out] Tells how many characters can be stored in value. If value is NULL, then it is set to large-enough value (not including the Null-termination character). Passing non-NULL value with no enough large buffer results in a failure with no change on valueLength. The valueLength has stored count of characters written, not including the Null-termination character on success.
Returns
Whether succeeded.
See Also
litePDF_SetSignatureLocation, litePDF_GetSignatureCount
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetSignatureName ( void pctx,
unsigned int  index,
char *  name,
unsigned int *  nameLength 
)

Gets the signature field name at the given index.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
indexWhich signature field name to get; counts from 0. This might be less than litePDF_GetSignatureCount.
name[out] Null-terminated ASCII name. It can be NULL, in which case the nameLength is populated with large-enough value to hold the whole string.
nameLength[in/out] Tells how many characters can be stored in name. If name is NULL, then it is set to large-enough value (not including the Null-termination character). Passing non-NULL name with no enough large buffer results in a failure with no change on nameLength. The nameLength has stored count of characters written, not including the Null-termination character, on success.
Returns
Whether succeeded.
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetSignatureRanges ( void pctx,
unsigned int  index,
unsigned __int64 *  pRangesArray,
unsigned int *  pRangesArrayLength 
)

Gathers signature ranges, that is the actual offsets into the opened file which had been used to create the signature data (litePDF_GetSignatureData). The array is a pair of numbers, where the first number is an offset into the file from its beginning and the second number is the number of bytes being used for the signature from this offset.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
indexWhich signature ranges to get; counts from 0. This might be less than litePDF_GetSignatureCount.
pRangesArray[out] Actual array to store the signature ranges to. It can be NULL, in which case the pRangesArrayLength is populated with large-enough value to hold the whole array.
pRangesArrayLength[in/out] Tells how many items can be stored in pRangesArray. If pRangesArray is NULL, then it is set to large-enough value. Passing non-NULL pRangesArray with no enough large array results in a failure with no change on pRangesArrayLength.
Returns
Whether succeeded.
Note
This function works only for the signatures which use this kind of signature method.
See Also
litePDF_GetDocumentIsSigned, litePDF_GetSignatureCount, litePDF_GetSignatureData
BOOL __stdcall LITEPDF_PUBLIC litePDF_GetSignatureReason ( void pctx,
unsigned int  index,
wchar_t *  value,
unsigned int *  valueLength 
)

Gets signature reason.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
indexWhich signature to use; counts from 0. This might be less than litePDF_GetSignatureCount.
value[out] Null-terminated Unicode value. It can be NULL, in which case the valueLength is populated with large-enough value to hold the whole string.
valueLength[in/out] Tells how many characters can be stored in value. If value is NULL, then it is set to large-enough value (not including the Null-termination character). Passing non-NULL value with no enough large buffer results in a failure with no change on valueLength. The valueLength has stored count of characters written, not including the Null-termination character on success.
Returns
Whether succeeded.
See Also
litePDF_SetSignatureReason, litePDF_GetSignatureCount
unsigned int __stdcall LITEPDF_PUBLIC litePDF_GetUnit ( void pctx)

Gets the currently set unit, which is used in functions which expect non-pixel size and position values. It can be one of LITEPDF_UNIT values. The default is LITEPDF_UNIT_MM.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
Returns
One of LITEPDF_UNIT values, which is set as the current unit for the litePDF context.
See Also
Units, litePDF_SetUnit
HDC __stdcall LITEPDF_PUBLIC litePDF_InsertPage ( void pctx,
unsigned int  pageIndex,
unsigned int  width_u,
unsigned int  height_u,
unsigned int  width_px,
unsigned int  height_px,
unsigned int  drawFlags 
)

Begins drawing into a new page into the PDF context of the given size. Newly created page is inserted at the given position of the PDF document. This cannot be called when other drawing is in progress. If the index is out of bounds, then the page is added ad the end, like with litePDF_AddPage.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
pageIndexPage index where to insert the page; counts from 0.
width_uWidth of the new page in the current unit.
height_uHeight of the new page in the current unit.
width_pxWidth of the new page in pixels.
height_pxHeight of the new page in pixels.
drawFlagsFlags for drawing functions. This is a bit-or of LITEPDF_DRAW_FLAG values and influences only litePDF_AddPage, litePDF_InsertPage, litePDF_UpdatePage and litePDF_AddResource functions.
Returns
Device context into which can be drawn with standard GDI functions. Finish the drawing, and the page insertion, with litePDF_FinishPage.
Note
Larger pixel page size produces more precise font mapping.
See Also
litePDF_GetUnit, litePDF_GetPageCount, litePDF_AddPage, litePDF_UpdatePage, litePDF_FinishPage, litePDF_AddResource
BOOL __stdcall LITEPDF_PUBLIC litePDF_InsertPageFrom ( void pctx,
unsigned int  pageIndexTo,
void pctx_from,
unsigned int  pageIndexFrom 
)

Inserts an existing page at the given index from another PDF. Both contexts should hold memory-based documents.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext, to which add the page.
pageIndexToPage index where to add the page; counts from 0. Adds page at the end, if out of bounds.
pctx_fromlitePDF context, previously created with litePDF_CreateContext, from which add the page.
pageIndexFromPage index which to add from pctx_from; counts from 0.
Returns
Whether succeeded.
Note
The two contexts cannot be the same.
See Also
litePDF_GetPageCount, litePDF_AddPagesFrom, litePDF_PageToResource
BOOL __stdcall LITEPDF_PUBLIC litePDF_LoadFromData ( void pctx,
const BYTE *  data,
unsigned int  dataLength,
const char *  password,
BOOL  forUpdate 
)

Makes the litePDF context hold a memory-based PDF, which is loaded with a PDF data. This should be closed with litePDF_Close. The forUpdate parameter specifies whether the file is being opened for incremental update. In that case saving such document will result in the changes being appended to the end of the original document, instead of resaving whole document.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
dataPDF data to load.
dataLengthLength of PDF data.
passwordPassword to use for encrypted documents.
forUpdateSet to TRUE to open the file for incremental update, or set to FALSE otherwise.
Returns
Whether succeeded.
See Also
litePDF_CreateMemDocument, litePDF_SaveToFile, litePDF_SaveToData
BOOL __stdcall LITEPDF_PUBLIC litePDF_LoadFromFile ( void pctx,
const char *  fileName,
const char *  password,
BOOL  loadCompletely,
BOOL  forUpdate 
)

Makes the litePDF context hold a memory-based PDF, which is loaded from a disk file. This should be closed with litePDF_Close. The loadCompletely parameter is used to determine whether the file should be loaded into memory completely, or when the file can be read on demand. Using complete load requires more memory, but the disk file can be changed freely in the background, while incomplete load requires left the file without changes while being opened. The forUpdate parameter specifies whether the file is being opened for incremental update. In that case saving such document will result in the changes being appended to the end of the original document, instead of resaving whole document.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
fileNameFile name to load the PDF from.
passwordPassword to use for encrypted documents.
loadCompletelySet to TRUE when the file should be loaded completely into memory, or FALSE to keep the disk file in use while working with it.
forUpdateSet to TRUE to open the file for incremental update, or set to FALSE otherwise.
Returns
Whether succeeded.
See Also
litePDF_LoadFromFileW
BOOL __stdcall LITEPDF_PUBLIC litePDF_LoadFromFileW ( void pctx,
const wchar_t *  fileName,
const char *  password,
BOOL  loadCompletely,
BOOL  forUpdate 
)

This is the same as litePDF_LoadFromFile, the only difference is that the fileName is a wide string.

unsigned int __stdcall LITEPDF_PUBLIC litePDF_PageToResource ( void pctx,
unsigned int  pageIndex 
)

Creates a resource, which will reference an existing page. The page itself is not deleted after call of this.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
pageIndexPage index for which create the resource reference; counts from 0.
Returns
Resource identifier, or 0 on error.
See Also
litePDF_GetPageCount, litePDF_AddPagesFrom, litePDF_AddPageFromAsResource, litePDF_GetResourceSize, litePDF_DrawResource
BOOL __stdcall LITEPDF_PUBLIC litePDF_PrepareEncryption ( void pctx,
const char *  userPassword,
const char *  ownerPassword,
unsigned int  permissions,
unsigned int  algorithm 
)

Prepares encryption for newly created documents. The litePDF context should be empty. The encryption is used only with litePDF_CreateFileDocument and litePDF_CreateMemDocument, other functions ignore it. Use NULL or an empty ownerPassword to unset any previously set encryption properties. Loading an encrypted document lefts it encrypted on save too.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
userPasswordUser's password, can be an empty string, then the user doesn't have to write a password.
ownerPasswordOwner's password. Can be NULL or an empty string, to unset encryption properties.
permissionsBit-or of LITEPDF_ENCRYPT_PERMISSION flags, to set user's permissions for the document.
algorithmOne of LITEPDF_ENCRYPT_ALGORITHM constants, an algorithm to be used to encrypt the document.
Returns
Whether was able to prepare encryption within the litePDF context.
See Also
litePDF_CreateFileDocument, litePDF_CreateMemDocument
BOOL __stdcall LITEPDF_PUBLIC litePDF_SaveToData ( void pctx,
BYTE *  data,
unsigned int *  dataLength 
)

Saves memory-based PDF into a data. The context should hold PDF created only with litePDF_CreateMemDocument, litePDF_LoadFromFile or litePDF_LoadFromData. Passing any other context results in an error.

In case the PDF document had been loaded with litePDF_LoadFromFile, litePDF_LoadFromFileW or litePDF_LoadFromData with its forUpdate parameter being TRUE, the resulting document will contain the changes as an incremental update (appended at the end of the original document), otherwise the whole document is completely rewritten.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
data[out] Actual data to store the PDF content to. It can be NULL, in which case the dataLength is populated with large-enough value to hold the whole data.
dataLength[in/out] Tells how many bytes can be stored in data. If data is NULL, then it is set to large-enough value. Passing non-NULL data with no enough large buffer results in a failure with no change on dataLength.
Returns
Whether succeeded.
Note
The only valid operation after this is either call of litePDF_SaveToData again, to get information about necessary buffer size or data itself, close the document with litePDF_Close, or free the context with litePDF_FreeContext.
See Also
litePDF_SaveToFile, litePDF_SaveToDataWithSign, litePDF_Close
BOOL __stdcall LITEPDF_PUBLIC litePDF_SaveToDataWithSign ( void pctx,
unsigned int  signatureIndex,
BYTE *  data,
unsigned int *  dataLength 
)

Digitally signs a PDF document opened at the litePDF context. The caller is responsible to set at least one signer with either litePDF_AddSignerPFX or litePDF_AddSignerPEM first. An alternative litePDF_SaveToDataWithSignManual is provided when it's required to compute the signature hash manually by the caller.

In case the document had been loaded with litePDF_LoadFromFile, litePDF_LoadFromFileW or litePDF_LoadFromData with its forUpdate parameter being TRUE, the resulting document will contain the changes as an incremental update (appended at the end of the original document), otherwise the whole document is completely rewritten.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
signatureIndexWhich signature to use; counts from 0. This might be less than litePDF_GetSignatureCount.
data[out] Actual data to store the PDF content to. It can be NULL, in which case the dataLength is populated with large-enough value to hold the whole data.
dataLength[in/out] Tells how many bytes can be stored in data. If data is NULL, then it is set to large-enough value. Passing non-NULL data with no enough large buffer results in a failure with no change on dataLength.
Returns
Whether succeeded.
Note
The only valid operation after this is either call of litePDF_SaveToDataWithSign again, to get information about necessary buffer size or data itself, close the document with litePDF_Close, or free the context with litePDF_FreeContext.
Signing already signed document can cause breakage of previous signatures, thus check whether the loaded document is already signed with litePDF_GetDocumentIsSigned. Load the document with its forUpdate parameter set to TRUE, to sign an existing document.
See Also
litePDF_SaveToFileWithSign
BOOL __stdcall LITEPDF_PUBLIC litePDF_SaveToDataWithSignManual ( void pctx,
unsigned int  signatureIndex,
litePDF_appendSignatureDataFunc  appendSignatureData,
void append_user_data,
litePDF_finishSignatureFunc  finishSignature,
void finish_user_data,
BYTE *  data,
unsigned int *  dataLength 
)

Digitally signs a PDF document opened at the litePDF context. The caller is responsible for a detached hash computations and related certificate management.

In case the document had been loaded with litePDF_LoadFromFile, litePDF_LoadFromFileW or litePDF_LoadFromData with its forUpdate parameter being TRUE, the resulting document will contain the changes as an incremental update (appended at the end of the original document), otherwise the whole document is completely rewritten.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
signatureIndexWhich signature to use; counts from 0. This might be less than litePDF_GetSignatureCount.
appendSignatureDataCalled when more data should be added to hash computation. The function cannot be NULL, even when called the second time, to get actual data.
append_user_dataUser data value for the appendSignatureData callback.
finishSignatureCalled when all the data are processed, and the signature value is required. The signature_len contains size of the signature buffer. The callback is responsible to populate signature and signature_len with correct values. Set signature_len to zero on any error. Note the callback is called only once. The function cannot be NULL, even when called the second time, to get actual data.
finish_user_dataUser data value for the finishSignature callback.
data[out] Actual data to store the PDF content to. It can be NULL, in which case the dataLength is populated with large-enough value to hold the whole data.
dataLength[in/out] Tells how many bytes can be stored in data. If data is NULL, then it is set to large-enough value. Passing non-NULL data with no enough large buffer results in a failure with no change on dataLength.
Returns
Whether succeeded.
Note
The only valid operation after this is either call of litePDF_SaveToDataWithSignManual again, to get information about necessary buffer size or data itself, close the document with litePDF_Close, or free the context with litePDF_FreeContext.
Signing already signed document can cause breakage of previous signatures, thus check whether the loaded document is already signed with litePDF_GetDocumentIsSigned. Load the document with its forUpdate parameter set to TRUE, to sign an existing document.
See Also
litePDF_SaveToFileWithSignManual, litePDF_SaveToFileWithSign
BOOL __stdcall LITEPDF_PUBLIC litePDF_SaveToFile ( void pctx,
const char *  fileName 
)

Saves memory-based PDF into a file. The context should hold PDF created only with litePDF_CreateMemDocument, litePDF_LoadFromFile or litePDF_LoadFromData. Passing any other context results in an error.

In case the PDF document had been loaded with litePDF_LoadFromFile, litePDF_LoadFromFileW or litePDF_LoadFromData with its forUpdate parameter being TRUE, the resulting document will contain the changes as an incremental update (appended at the end of the original document), otherwise the whole document is completely rewritten.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
fileNameFile name to which save the memory-based PDF.
Returns
Whether succeeded.
Note
The only valid operation after this is either close the document with litePDF_Close, or free the context with litePDF_FreeContext.
See Also
litePDF_SaveToFileW, litePDF_SaveToData, litePDF_SaveToFileWithSign, litePDF_Close
BOOL __stdcall LITEPDF_PUBLIC litePDF_SaveToFileW ( void pctx,
const wchar_t *  fileName 
)

This is the same as litePDF_SaveToFile, the only difference is that the fileName is a wide string.

BOOL __stdcall LITEPDF_PUBLIC litePDF_SaveToFileWithSign ( void pctx,
const char *  fileName,
unsigned int  signatureIndex 
)

Digitally signs a PDF document opened at the litePDF context. The caller is responsible to set at least one signer with either litePDF_AddSignerPFX or litePDF_AddSignerPEM first. An alternative litePDF_SaveToFileWithSignManual is provided when it's required to compute the signature hash manually by the caller.

In case the document had been loaded with litePDF_LoadFromFile, litePDF_LoadFromFileW or litePDF_LoadFromData with its forUpdate parameter being TRUE, the resulting document will contain the changes as an incremental update (appended at the end of the original document), otherwise the whole document is completely rewritten.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
fileNameA file name where to save signed PDF document.
signatureIndexWhich signature to use; counts from 0. This might be less than litePDF_GetSignatureCount.
Returns
Whether succeeded.
Note
The only valid operation after this is either close the document with litePDF_Close, or free the context with litePDF_FreeContext.
Signing already signed document can cause breakage of previous signatures, thus check whether the loaded document is already signed with litePDF_GetDocumentIsSigned. Load the document with its forUpdate parameter set to TRUE, to sign an existing document.
See Also
litePDF_SaveToFileWithSignW, litePDF_SaveToDataWithSign
BOOL __stdcall LITEPDF_PUBLIC litePDF_SaveToFileWithSignManual ( void pctx,
const char *  fileName,
unsigned int  signatureIndex,
litePDF_appendSignatureDataFunc  appendSignatureData,
void append_user_data,
litePDF_finishSignatureFunc  finishSignature,
void finish_user_data 
)

Digitally signs a PDF document opened at the litePDF context. The caller is responsible for a detached hash computations and related certificate management.

In case the document had been loaded with litePDF_LoadFromFile, litePDF_LoadFromFileW or litePDF_LoadFromData with its forUpdate parameter being TRUE, the resulting document will contain the changes as an incremental update (appended at the end of the original document), otherwise the whole document is completely rewritten.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
fileNameA file name where to save signed PDF document.
signatureIndexWhich signature to use; counts from 0. This might be less than litePDF_GetSignatureCount.
appendSignatureDataCalled when more data should be added to hash computation. The function cannot be NULL, even when called the second time, to get actual data.
append_user_dataUser data value for the appendSignatureData callback.
finishSignatureCalled when all the data are processed, and the signature value is required. The signature_len contains size of the signature buffer. The callback is responsible to populate signature and signature_len with correct values. Set signature_len to zero on any error. Note the callback is called only once. The function cannot be NULL, even when called the second time, to get actual data.
finish_user_dataUser data value for the finishSignature callback.
Returns
Whether succeeded.
Note
The only valid operation after this is either close the document with litePDF_Close, or free the context with litePDF_FreeContext.
Signing already signed document can cause breakage of previous signatures, thus check whether the loaded document is already signed with litePDF_GetDocumentIsSigned. Load the document with its forUpdate parameter set to TRUE, to sign an existing document.
See Also
litePDF_SaveToFileWithSign, litePDF_SaveToFileWithSignManualW, litePDF_SaveToDataWithSignManual
BOOL __stdcall LITEPDF_PUBLIC litePDF_SaveToFileWithSignManualW ( void pctx,
const wchar_t *  fileName,
unsigned int  signatureIndex,
litePDF_appendSignatureDataFunc  appendSignatureData,
void append_user_data,
litePDF_finishSignatureFunc  finishSignature,
void finish_user_data 
)

This is the same as litePDF_SaveToFileWithSignManual, the only difference is that the fileName is a wide string.

BOOL __stdcall LITEPDF_PUBLIC litePDF_SaveToFileWithSignW ( void pctx,
const wchar_t *  fileName,
unsigned int  signatureIndex 
)

This is the same as litePDF_SaveToFileWithSign, the only difference is that the fileName is a wide string.

BOOL __stdcall LITEPDF_PUBLIC litePDF_SetDocumentInfo ( void pctx,
const char *  name,
const wchar_t *  value 
)

Sets information about the document. The name can be one of the LITEPDF_DOCUMENT_INFO predefined constants.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
nameDocument info property name to set.
valueNull-terminated Unicode value to set.
Returns
Whether succeeded.
BOOL __stdcall LITEPDF_PUBLIC litePDF_SetEvalFontFlagCallback ( void pctx,
litePDFEvalFontFlagCB  callback,
void callback_user_data 
)

Sets a callback to evaluate what to do with a font. The callback can be NULL, to unset any previously set value. See litePDFEvalFontFlagCB for more information about the callback parameters and what it can do.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
callbackA litePDFEvalFontFlagCB callback to set, or NULL.
callback_user_dataA user data to pass to callback when called.
Returns
Whether succeeded.
BOOL __stdcall LITEPDF_PUBLIC litePDF_SetPageRotation ( void pctx,
unsigned int  pageIndex,
int  degrees 
)

Sets rotation of an existing page, in degrees. Expected values are 0, 90, 180 and 270.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
pageIndexPage index for which get the page size; counts from 0.
degreesRotation of the page to set, in degrees.
Returns
Whether succeeded.
See Also
litePDF_GetPageRotation
BOOL __stdcall LITEPDF_PUBLIC litePDF_SetSignatureAppearance ( void pctx,
unsigned int  index,
unsigned int  appearanceType,
unsigned int  resourceID,
int  offsetX_u,
int  offsetY_u 
)

Sets the signature appearance.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
indexWhich signature to use; counts from 0. This might be less than litePDF_GetSignatureCount.
appearanceTypeOne of the LITEPDF_APPEARANCE_NORMAL, LITEPDF_APPEARANCE_ROLLOVER and LITEPDF_APPEARANCE_DOWN constants. At least the LITEPDF_APPEARANCE_NORMAL type should be set, if the appearance of the signature is requested.
resourceIDAn existing resource ID of the annotation content, as shown to the user.
offsetX_uX-offset of the resource inside the annotation of the signature, in the current unit.
offsetY_uY-offset of the resource inside the annotation of the signature, in the current unit.
Returns
Whether succeeded.
Note
The resource position offset is from [left, top] corner of the annotation rectangle.
See Also
litePDF_GetUnit, litePDF_AddResource, litePDF_GetSignatureCount, litePDF_CreateSignature
BOOL __stdcall LITEPDF_PUBLIC litePDF_SetSignatureCertification ( void pctx,
unsigned int  index,
unsigned int  permission 
)

Sets the signature certification. This is used to detect modifications relative to a signature field that is signed by the author of a document (the person applying the first signature). A document can contain only one signature field that contains the access permissions; it should be the first signed field in the document. It enables the author to specify what changes are permitted to be made the document and what changes invalidate the author’s signature.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
indexWhich signature to use; counts from 0. This might be less than litePDF_GetSignatureCount.
permissionOne of the LITEPDF_CERTIFICATION_PERMISSION_NO_PERMS, LITEPDF_CERTIFICATION_PERMISSION_FORM_FILL and LITEPDF_CERTIFICATION_PERMISSION_ANNOTATIONS constants.
See Also
litePDF_CreateSignature
BOOL __stdcall LITEPDF_PUBLIC litePDF_SetSignatureCreator ( void pctx,
unsigned int  index,
const char *  creator 
)

Sets signature creator. This can be left unset.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
indexWhich signature to use; counts from 0. This might be less than litePDF_GetSignatureCount.
creatorThe value to set.
Returns
Whether succeeded.
See Also
litePDF_GetSignatureCreator, litePDF_GetSignatureCount
BOOL __stdcall LITEPDF_PUBLIC litePDF_SetSignatureDate ( void pctx,
unsigned int  index,
__int64  dateOfSign 
)

Sets signature field date of sign.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
indexWhich signature to use; counts from 0. This might be less than litePDF_GetSignatureCount.
dateOfSignDate of sign, like Unix time_t, when the signature was created; less than or equal to 0 means today. The value can be clamp on 32-bit systems.
Returns
Whether succeeded.
See Also
litePDF_GetSignatureDate, litePDF_GetSignatureCount
BOOL __stdcall LITEPDF_PUBLIC litePDF_SetSignatureHash ( void pctx,
unsigned int  signatureHash 
)

Sets the signature hash algorithm to be used. The default value is LITEPDF_SIGNATURE_HASH_SHA512. It is used only when the litePDF_SaveToFileWithSign or litePDF_SaveToDataWithSign are used. The supported values are LITEPDF_SIGNATURE_HASH_SHA1, LITEPDF_SIGNATURE_HASH_SHA256, LITEPDF_SIGNATURE_HASH_SHA384 and LITEPDF_SIGNATURE_HASH_SHA512.

This value is remembered in general, not for any signature in particular.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
signatureHashThe hash algorithm to use.
Returns
Whether succeeded.
See Also
litePDF_SetSignatureSize, litePDF_SaveToFileWithSignManual, litePDF_SaveToFileWithSignManualW, litePDF_SaveToDataWithSignManual
BOOL __stdcall LITEPDF_PUBLIC litePDF_SetSignatureLocation ( void pctx,
unsigned int  index,
const wchar_t *  location 
)

Sets signature location, aka where the signature had been made. This can be left unset.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
indexWhich signature to use; counts from 0. This might be less than litePDF_GetSignatureCount.
locationThe value to set.
Returns
Whether succeeded.
See Also
litePDF_GetSignatureLocation, litePDF_GetSignatureCount
BOOL __stdcall LITEPDF_PUBLIC litePDF_SetSignatureReason ( void pctx,
unsigned int  index,
const wchar_t *  reason 
)

Sets signature reason.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
indexWhich signature to use; counts from 0. This might be less than litePDF_GetSignatureCount.
reasonThe value to set.
Returns
Whether succeeded.
See Also
litePDF_GetSignatureReason, litePDF_GetSignatureCount
BOOL __stdcall LITEPDF_PUBLIC litePDF_SetSignatureSize ( void pctx,
unsigned int  requestBytes 
)

Sets how many bytes the signature may require. The default value is 4096 bytes and it is automatically adjusted when the litePDF_SaveToFileWithSign or litePDF_SaveToDataWithSign are used. The manual signing functions require this value to be set before signing, if the final hash with the certificate exceeds the default size.

This value is remembered in general, not for any signature in particular.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
requestBytesHow many bytes the signature will require.
Returns
Whether succeeded.
See Also
litePDF_SetSignatureHash, litePDF_SaveToFileWithSignManual, litePDF_SaveToFileWithSignManualW, litePDF_SaveToDataWithSignManual
BOOL __stdcall LITEPDF_PUBLIC litePDF_SetUnit ( void pctx,
unsigned int  unitValue 
)

Sets a unit to use in functions which expect non-pixel size and position values. It can be one of LITEPDF_UNIT values. The default is LITEPDF_UNIT_MM.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
unitValueOne of LITEPDF_UNIT values, to set as a unit for the litePDF context.
See Also
Units, litePDF_GetUnit
HDC __stdcall LITEPDF_PUBLIC litePDF_UpdatePage ( void pctx,
unsigned int  pageIndex,
unsigned int  width_px,
unsigned int  height_px,
unsigned int  drawFlags 
)

Begins drawing into an already existing page. The page size in the current unit can be found by litePDF_GetPageSize. The function fails, and returns NULL, if the pageIndex is out of bounds.

Parameters
pctxa litePDF context, previously created with litePDF_CreateContext.
pageIndexPage index which to update; counts from 0.
width_pxWidth of the new page in pixels.
height_pxHeight of the new page in pixels.
drawFlagsFlags for drawing functions. This is a bit-or of LITEPDF_DRAW_FLAG values and influences only litePDF_AddPage, litePDF_InsertPage, litePDF_UpdatePage and litePDF_AddResource functions.
Returns
Device context into which can be drawn with standard GDI functions. Finish the drawing, and the page update, with litePDF_FinishPage.
See Also
litePDF_GetPageCount, litePDF_AddPage, litePDF_InsertPage, litePDF_FinishPage, litePDF_AddResource
LITEPDF_BEGIN_DECLS typedef void ( __stdcall *  litePDFErrorCB)

Variable Documentation

LITEPDF_BEGIN_DECLS typedef const char* msg
LITEPDF_BEGIN_DECLS typedef const char void* user_data

Error callback.

Parameters
codeError code, same as GetLastError().
msgDetailed error message.
user_dataUser data provided in litePDF_CreateMemDocument.