PDF Base

Definitions for PDF basic and common process.
Definitions and functions in this module are included in fpdf_base_r.h.
Module: PDFBase
License Identifier: PDFBase/All
Available License Right: Unnecessary. More...

Classes

struct  FSPDF_DEFAULTAPPEARANCE
 Structure for default appearance. More...
 
struct  FSPDF_OBJECT
 Handle type to PDF object. More...
 
struct  FSPDF_ATTACHMENT
 Handle type to PDF attachment. More...
 
struct  FSPDF_RENDERCONTEXT
 Handle type to PDF rendering context. More...
 
struct  FSPDF_RENDEROPTIONPARAM_COLORMODE
 Structure for render option parameters of color mode. More...
 
struct  FSPDF_LAYERCONTEXT
 Handle type to PDF layer context. More...
 
struct  FSPDF_DESTDATA
 Structure for a destination data. More...
 
struct  FSPDF_ACTIONDATA
 Structure for an action data. More...
 
struct  FSPDF_ACTIONDATA_GOTO
 Structure for action type FSPDF_ACTION_GOTO. More...
 
struct  FSPDF_ACTIONDATA_REMOTEGOTO
 Structure for action type FSPDF_ACTION_REMOTEGOTO. More...
 
struct  FSPDF_ACTIONDATA_EMBEDDEDGOTO_TARGET
 Structure for target of FSPDF_ACTIONDATA_EMBEDDEDGOTO. More...
 
struct  FSPDF_ACTIONDATA_EMBEDDEDGOTO
 Structure for action type FSPDF_ACTION_EMBEDDEDGOTO. More...
 
struct  FSPDF_ACTIONDATA_URI
 Structure for action type FSPDF_ACTION_URI. More...
 
struct  FSPDF_ACTIONDATA_LAUNCH
 Structure for action type FSPDF_ACTION_LAUNCH. More...
 
struct  FSPDF_ACTIONDATA_JAVASCRIPT
 Structure for action type FSPDF_ACTION_JAVASCRIPT. More...
 
struct  FSPDF_ACTIONDATA_HIDE
 Structure for action type FSPDF_ACTION_HIDE. More...
 
struct  FSPDF_ACTIONDATA_NAMED
 Structure for action type FSPDF_ACTION_NAMED. More...
 
struct  FSPDF_ACTIONDATA_SUBMITFORM
 Structure for action type FSPDF_ACTION_SUBMITFORM. More...
 
struct  FSPDF_ACTIONDATA_RESETFORM
 Structure for action type FSPDF_ACTION_RESETFORM. More...
 
struct  FSPDF_ACTIONDATA_IMPORTDATA
 Structure for action type FSPDF_ACTION_IMPORTDATA. More...
 

Functions

FS_RESULT FSCRT_PDFModule_Initialize ()
 Initialize PDF module. More...
 
FS_RESULT FSCRT_PDFModule_Finalize ()
 Finalize PDF module. More...
 
FS_RESULT FSPDF_RenderContext_Create (FSPDF_RENDERCONTEXT *pdfRenderContext)
 Create a PDF rendering context. More...
 
FS_RESULT FSPDF_RenderContext_Release (FSPDF_RENDERCONTEXT pdfRenderContext)
 Release a PDF rendering context. More...
 
FS_RESULT FSPDF_RenderContext_SetFlags (FSPDF_RENDERCONTEXT pdfRenderContext, FS_DWORD flags)
 Set flags to a rendering context. More...
 
FS_RESULT FSPDF_RenderContext_SetMatrix (FSPDF_RENDERCONTEXT pdfRenderContext, const FSCRT_MATRIX *matrix)
 Set a transformation matrix to a rendering context. More...
 
FS_RESULT FSPDF_RenderContext_SetHalftoneLimit (FSPDF_RENDERCONTEXT pdfRenderContext, FS_INT32 halftoneLimit)
 Set a halftone limit to a rendering context. More...
 
FS_RESULT FSPDF_RenderContext_SetOption (FSPDF_RENDERCONTEXT pdfRenderContext, FS_DWORD option, FS_LPVOID params)
 Set option parameters to a rendering context. More...
 
FS_RESULT FSPDF_RenderContext_SetLayerContext (FSPDF_RENDERCONTEXT pdfRenderContext, FSPDF_LAYERCONTEXT layerContext)
 Set layer context to render context handle. More...
 
FS_RESULT FSPDF_ActionData_Init (FSPDF_ACTIONDATA *actionData)
 Initialize PDF action data. More...
 
FS_RESULT FSPDF_ActionData_Clear (FSPDF_ACTIONDATA *actionData)
 Clear PDF action data. More...
 
FS_RESULT FSPDF_Attachment_Create (FSCRT_DOCUMENT document, FSPDF_ATTACHMENT *attachment)
 Create an attachment object. More...
 
FS_RESULT FSPDF_Attachment_Release (FSCRT_DOCUMENT document, FSPDF_ATTACHMENT attachment)
 Release a attachment object. More...
 
FS_RESULT FSPDF_Attachment_IsEmbedded (FSPDF_ATTACHMENT attachment, FS_BOOL *embedded)
 Check whether an attachment is an embedded file or not. More...
 
FS_RESULT FSPDF_Attachment_GetFileName (FSPDF_ATTACHMENT attachment, FSCRT_BSTR *fileName)
 Get file name of an attachment. More...
 
FS_RESULT FSPDF_Attachment_SetFileName (FSPDF_ATTACHMENT attachment, const FSCRT_BSTR *fileName, FS_BOOL isURL)
 Set the file name of an attachment. More...
 
FS_RESULT FSPDF_Attachment_GetDescription (FSPDF_ATTACHMENT attachment, FSCRT_BSTR *description)
 Get description of an attachment. More...
 
FS_RESULT FSPDF_Attachment_SetDescription (FSPDF_ATTACHMENT attachment, const FSCRT_BSTR *description)
 Set the description of an attachment. More...
 
FS_RESULT FSPDF_Attachment_GetSize (FSPDF_ATTACHMENT attachment, FSCRT_FILESIZE *size)
 Get the size of an attachment. More...
 
FS_RESULT FSPDF_Attachment_GetCreationDateTime (FSPDF_ATTACHMENT attachment, FSCRT_DATETIMEZONE *dt)
 Get creation date and time of an attachment. More...
 
FS_RESULT FSPDF_Attachment_SetCreationDateTime (FSPDF_ATTACHMENT attachment, const FSCRT_DATETIMEZONE *dt)
 Set the creation date and time of an attachment. More...
 
FS_RESULT FSPDF_Attachment_GetModifiedDateTime (FSPDF_ATTACHMENT attachment, FSCRT_DATETIMEZONE *dt)
 Get the last modification date and time of an attachment. More...
 
FS_RESULT FSPDF_Attachment_SetModifiedDateTime (FSPDF_ATTACHMENT attachment, const FSCRT_DATETIMEZONE *dt)
 Set the modification date of an attachment. More...
 
FS_RESULT FSPDF_Attachment_GetCheckSum (FSPDF_ATTACHMENT attachment, FSCRT_BSTR *checksum)
 Get an attachment's checksum. More...
 
FS_RESULT FSPDF_Attachment_SetCheckSum (FSPDF_ATTACHMENT attachment, const FSCRT_BSTR *checksum)
 Set the checksum of an attachment. More...
 
FS_RESULT FSPDF_Attachment_WriteToFile (FSPDF_ATTACHMENT attachment, FSCRT_FILE file)
 Write the attachment data directly into a file. More...
 
FS_RESULT FSPDF_Attachment_GetData (FSPDF_ATTACHMENT attachment, FS_BOOL isRawData, FSCRT_FILE *file)
 Get the attachment data with an asynchronous way. More...
 
FS_RESULT FSPDF_Attachment_SetFile (FSPDF_ATTACHMENT attachment, FSCRT_FILE file)
 Set the file of an attachment. More...
 
FS_RESULT FSPDF_Attachment_GetDocument (FSPDF_ATTACHMENT attachment, FSCRT_DOCUMENT *document)
 Get a document handle related to an attachment. More...
 
FS_RESULT FSPDF_Font_IsEmbedded (FSCRT_DOCUMENT document, FSCRT_FONT font, FS_BOOL *isEmbedded)
 Check whether a font is embedded in a PDF document. More...
 
FS_RESULT FSPDF_Font_GetDict (FSCRT_DOCUMENT document, FSCRT_FONT font, FSPDF_OBJECT *fontDictionary)
 Get the dictionary of a font in a PDF document. More...
 
FS_RESULT FSPDF_Font_IsSupportEmbedded (FSCRT_DOCUMENT document, FSCRT_FONT font, FS_BOOL *isSupported)
 Check whether all features of the font can be embedded to a specific PDF document or not. More...
 

Macro Definitions for PDF Document Permissions

Note
According to PDF Reference, a 32-bit integer is used to represent permissions.
Bits in permission value, 1-2 bits must be zero, 7-8, 13-32 bits must be 1, and leave other unused bits to 0.
#define FSPDF_PERMISSION_PRINT   0x0004
 Bit 3. Print PDF document with normal mode. More...
 
#define FSPDF_PERMISSION_MODIFY   0x0008
 Bit 4. Modify PDF contents. More...
 
#define FSPDF_PERMISSION_EXTRACT   0x0010
 Bit 5. Extract PDF contents. More...
 
#define FSPDF_PERMISSION_ANNOTFORM   0x0020
 Bit 6. Operate text annotations and fill in interactive form fields. More...
 
#define FSPDF_PERMISSION_FILLFORM   0x0100
 Bit 9. Fill PDF form. More...
 
#define FSPDF_PERMISSION_EXTRACTACCESS   0x0200
 Bit 10. Disabilities support. More...
 
#define FSPDF_PERMISSION_ASSEMBLE   0x0400
 Bit 11. Assemble PDF document. More...
 
#define FSPDF_PERMISSION_PRINT_HIGH   0x0800
 Bit 12. Print PDF document with higher qualities. More...
 

Macro Definitions for Page Boundary Box

Note
For some purposes, PDF defines a set of page boxes.
User can select a proper page box according to application intentions.
#define FSPDF_PAGEBOX_MEDIABOX   0
 Media Box for page boundary. More...
 
#define FSPDF_PAGEBOX_CROPBOX   1
 Crop Box for page boundary. More...
 
#define FSPDF_PAGEBOX_TRIMBOX   2
 Trim Box for page boundary. More...
 
#define FSPDF_PAGEBOX_ARTBOX   3
 Art Box for page boundary. More...
 
#define FSPDF_PAGEBOX_BLEEDBOX   4
 Bleed Box for page boundary. More...
 

Macro Definitions for Alignments (horizontal).

#define FSPDF_ALIGNMENT_LEFT   0
 Left alignment.
 
#define FSPDF_ALIGNMENT_CENTER   1
 Center alignment.
 
#define FSPDF_ALIGNMENT_RIGHT   2
 Right alignment.
 

Macro Definitions for Settings of Default Appearance

#define FSPDF_DEFAULTAPPEARANCE_FONT   0x0001
 The font flag of default appearance.
 
#define FSPDF_DEFAULTAPPEARANCE_TEXTCOLOR   0x0002
 The text color flag of default appearance.
 
#define FSPDF_DEFAULTAPPEARANCE_TEXTMATRIX   0x0004
 The text matrix flag of default appearance flag.
 

Macro Definitions for Rendering Options

Note
Currently, only one rendering option is defined.
#define FSPDF_RENDEROPTION_COLORMODE   0
 Rendering option of color mode.
 

Macro Definitions for Rendering Option of Color Mode

#define FSPDF_COLORMODE_NORMAL   0
 Normal color mode.
 
#define FSPDF_COLORMODE_GRAY   1
 Gray color mode: map colors to background/foreground.
 
#define FSPDF_COLORMODE_TWOCOLOR   2
 Two color mode: map white/black to background/foreground, other unchanged.
 

Macro Definitions for Render Flags

Note
Pass one or a combination of the following flags to parameter flags when call function FSPDF_RenderContext_SetFlags.
#define FSPDF_RENDERCONTEXTFLAG_ANNOT   0x0001
 Set if page annotations are to be rendered together.
 
#define FSPDF_RENDERCONTEXTFLAG_DROPOBJECTS   0x0002
 Drop page content objects while rendering page automatically. More...
 
#define FSPDF_RENDERCONTEXTFLAG_NOWIDGET   0x0004
 Set if the form fields(widgets) are not to be rendered together.
 
#define FSPDF_RENDERCONTEXTFLAG_NOTTRANSFORMICON   0x0008
 Set if no need to rotate or scale annotation icon. More...
 
#define FSPDF_RENDERCONTEXTFLAG_NOSIGNATURE   0x0020
 This flag indicates not to render signatures.
 
#define FSPDF_RENDERCONTEXTFLAG_OCGPRINT   0x0100
 If this flag is set, only apply those content objects which allow to output to printer.
 
#define FSPDF_RENDERCONTEXTFLAG_OCGDESIGN   0x0200
 If this flag is set, only apply those content objects which allow to output for design mode.
 
#define FSPDF_RENDERCONTEXTFLAG_OCGEXPORT   0x0400
 If this flag is set, only apply those content objects which allow to output for exportation.
 

Macro Definitions for Zoom Mode for The Destination

#define FSPDF_ZOOM_FACTOR   1
 A specific zoom factor is used.
 
#define FSPDF_ZOOM_FITPAGE   2
 Fit the whole page on the screen.
 
#define FSPDF_ZOOM_FITWIDTH   3
 Fit the width of the page on the screen.
 
#define FSPDF_ZOOM_FITHEIGHT   4
 Fit the height of the page on the screen.
 
#define FSPDF_ZOOM_FITRECT   5
 Fit a particular rectangle on the screen.
 
#define FSPDF_ZOOM_FITCONTENT   6
 Fit the whole content of page on the screen.
 
#define FSPDF_ZOOM_FITCONTENTWIDTH   7
 Fit the content width of page on the screen.
 
#define FSPDF_ZOOM_FITCONTENTHEIGHT   8
 Fit the content height of page on the screen.
 

Macro Definitions for Action Type

#define FSPDF_ACTION_UNSUPPORTED   0
 Unsupported action type.
 
#define FSPDF_ACTION_GOTO   1
 Go to a destination within current document.
 
#define FSPDF_ACTION_REMOTEGOTO   2
 Go to a destination within another document.
 
#define FSPDF_ACTION_EMBEDDEDGOTO   3
 Go to a destination within embedded another document.
 
#define FSPDF_ACTION_URI   4
 Universal Resource Identifier, including web pages and other Internet based resources.
 
#define FSPDF_ACTION_LAUNCH   5
 Launch an application or open a file.
 
#define FSPDF_ACTION_JAVASCRIPT   6
 Run a javascript.
 
#define FSPDF_ACTION_HIDE   7
 Hide or show one or more annotations.
 
#define FSPDF_ACTION_NAMED   8
 Run a named action.
 
#define FSPDF_ACTION_SUBMITFORM   9
 Transmit the names and values of selected interactive form fields.
 
#define FSPDF_ACTION_RESETFORM   10
 Reset selected interactive form fields to their default values.
 
#define FSPDF_ACTION_IMPORTDATA   11
 Import Forms Data Format (FDF) data into the document's interactive form.
 
#define FSPDF_ACTION_RENDITION   12
 Play a multimedia.
 

Macro Definitions for Trigger Actions of Document

#define FSPDF_TRIGGER_DOC_DO   0
 A JavaScript action to be performed after opening a document.
 
#define FSPDF_TRIGGER_DOC_WC   1
 A JavaScript action to be performed before closing a document.
 
#define FSPDF_TRIGGER_DOC_WS   2
 A JavaScript action to be performed before saving a document.
 
#define FSPDF_TRIGGER_DOC_DS   3
 A JavaScript action to be performed after saving a document.
 
#define FSPDF_TRIGGER_DOC_WP   4
 A JavaScript action to be performed before printing a document.
 
#define FSPDF_TRIGGER_DOC_DP   5
 A JavaScript action to be performed after printing a document.
 

Macro Definitions for Trigger Actions of Form Field

#define FSPDF_TRIGGER_FORMFIELD_KS   0
 A JavaScript action to be performed when the user types a keystroke into a text field or combo box or modifies the selection in a scrollable list box. More...
 
#define FSPDF_TRIGGER_FORMFIELD_WF   1
 A JavaScript action to be performed before the field is formatted to display its current value. More...
 
#define FSPDF_TRIGGER_FORMFIELD_WV   2
 A JavaScript action to be performed when the field's value is changed. More...
 
#define FSPDF_TRIGGER_FORMFIELD_FC   3
 A JavaScript action to be performed to recalculate the value of this field when that of another field changes.
 

Macro Definitions for Trigger Actions of Page

#define FSPDF_TRIGGER_PAGE_PO   0
 An action to be performed when the page is opened.
 
#define FSPDF_TRIGGER_PAGE_PC   1
 An action to be performed when the page is closed.
 

Macro Definitions for Trigger Actions of Annotation

#define FSPDF_TRIGGER_ANNOT_CE   0
 
#define FSPDF_TRIGGER_ANNOT_CX   1
 
#define FSPDF_TRIGGER_ANNOT_MD   2
 
#define FSPDF_TRIGGER_ANNOT_MU   3
 
#define FSPDF_TRIGGER_ANNOT_FO   4
 
#define FSPDF_TRIGGER_ANNOT_FL   5
 
#define FSPDF_TRIGGER_ANNOT_PO   6
 
#define FSPDF_TRIGGER_ANNOT_PC   7
 
#define FSPDF_TRIGGER_ANNOT_PV   8
 
#define FSPDF_TRIGGER_ANNOT_PI   9
 

Macro Definitions for Submit-Form Action Flags

Note
According to PDF Reference, a 32-bit integer is used to represent submit-form action flags.
Bits in flags value, leave unused bits to be 0.
#define FSPDF_SUBMITFORMFLAGS_INCLUDE   0x0001
 Bit 1. Include fields to submit.
 
#define FSPDF_SUBMITFORMFLAGS_INCLUDENOVALUEFIELDS   0x0002
 Bit 2. Submit fields regardless of whether they have a value. More...
 
#define FSPDF_SUBMITFORMFLAGS_EXPORTFORMAT   0x0004
 Bit 3. Field names and values are submitted in HTML Form format. More...
 
#define FSPDF_SUBMITFORMFLAGS_GETMETHOD   0x0008
 Bit 4. Field names and values are submitted using an HTTP GET request. More...
 
#define FSPDF_SUBMITFORMFLAGS_SUBMITCOORDINATES   0x0010
 Bit 5. Coordinates of the mouse are transmitted as part of the form data.
 
#define FSPDF_SUBMITFORMFLAGS_XFDF   0x0020
 Bit 6. Field names and values are submitted as XFDF.
 
#define FSPDF_SUBMITFORMFLAGS_INCLUDEAPPENDSAVES   0x0040
 Bit 7. Submitted FDF file includes contents as contained in differences entry in the FDF dictionary. More...
 
#define FSPDF_SUBMITFORMFLAGS_INCLUDEANNOTATIONS   0x0080
 Bit 8. Submitted FDF file includes all markup annotations in underlying PDF document. More...
 
#define FSPDF_SUBMITFORMFLAGS_SUBMITPDF   0x0100
 Bit 9. The document is submitted as PDF.
 
#define FSPDF_SUBMITFORMFLAGS_CANONICALFORMAT   0x0200
 Bit 10. Any submitted field values representing dates are converted to the standard format.
 
#define FSPDF_SUBMITFORMFLAGS_EXCLNONUSERANNOTS   0x0400
 Bit 11. Only those markup annotations whose T entry matches the name of the current user are being submitted.
 
#define FSPDF_SUBMITFORMFLAGS_EXCLFKEY   0x0800
 Bit 12. Submitted FDF excludes F entry.
 
#define FSPDF_SUBMITFORMFLAGS_EMBEDFORM   0x2000
 Bit 14. F entry of submitted FDF is an embedded file stream.
 

Detailed Description

Definitions for PDF basic and common process.
Definitions and functions in this module are included in fpdf_base_r.h.
Module: PDFBase
License Identifier: PDFBase/All
Available License Right: Unnecessary.

This module contains following features:

Macro Definition Documentation

#define FSPDF_PAGEBOX_ARTBOX   3

Art Box for page boundary.

The intended dimensions of a finished page after trimming.

#define FSPDF_PAGEBOX_BLEEDBOX   4

Bleed Box for page boundary.

The extent of page's meaningful content (including potential white space) as intended by page's creator.

#define FSPDF_PAGEBOX_CROPBOX   1

Crop Box for page boundary.

The region to which the contents of page are to be clipped (cropped) while displaying or printing.

#define FSPDF_PAGEBOX_MEDIABOX   0

Media Box for page boundary.

The boundary of the physical medium on which page is to be displayed or printed.

#define FSPDF_PAGEBOX_TRIMBOX   2

Trim Box for page boundary.

The region to which the contents of page should be clipped while outputting in a production environment.

#define FSPDF_PERMISSION_ANNOTFORM   0x0020

Bit 6. Operate text annotations and fill in interactive form fields.

If bit 4 is also set, user can create or modify interactive form fields (including signature fields).

#define FSPDF_PERMISSION_ASSEMBLE   0x0400

Bit 11. Assemble PDF document.

This bit enables to assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images), regardless if bit 4 is set or not.

#define FSPDF_PERMISSION_EXTRACT   0x0010

Bit 5. Extract PDF contents.

if this bit is set, the user can copy or otherwise extract text and graphics from the document by operations other than that controlled by bit 10.

#define FSPDF_PERMISSION_EXTRACTACCESS   0x0200

Bit 10. Disabilities support.

If this bit set, user can extract text and graphics in support of accessibility to users with disabilities or for other purposes.

#define FSPDF_PERMISSION_FILLFORM   0x0100

Bit 9. Fill PDF form.

if this bit is set, user can fill in interactive form fields (including signature fields), even if bit 6 is clear.

#define FSPDF_PERMISSION_MODIFY   0x0008

Bit 4. Modify PDF contents.

if this bit is set, the user can modify contents of PDF document by operations other than those controlled by bits 6, 9, and 11.

#define FSPDF_PERMISSION_PRINT   0x0004

Bit 3. Print PDF document with normal mode.

If the user wants to print a higher quality level of PDF document, set it with bit 12 together.
Please refer to macro FSPDF_PERMISSION_PRINT_HIGH.

#define FSPDF_PERMISSION_PRINT_HIGH   0x0800

Bit 12. Print PDF document with higher qualities.

If this bit is clear (and bit 3 is set), printing is limited to a low-level representation of the appearance, possibly of degraded quality.

#define FSPDF_RENDERCONTEXTFLAG_DROPOBJECTS   0x0002

Drop page content objects while rendering page automatically.

This will make the most complicated pages renderable within very limited memory.
HOWEVER, after rendering a page, page content objects will not be used any more, and user has to re-parse page for any process on page contents.

Note
Do not use this flag when caller shares one rendering context object between multi-threads.
#define FSPDF_RENDERCONTEXTFLAG_NOTTRANSFORMICON   0x0008

Set if no need to rotate or scale annotation icon.

In PDF, "<b>Text</b>" and "<b>FileAttachment</b>" annotations show as icons.

#define FSPDF_SUBMITFORMFLAGS_EXPORTFORMAT   0x0004

Bit 3. Field names and values are submitted in HTML Form format.

Note
Meaningful only if the SubmitPDF and XFDF flags are clear.
If clear, they are submitted in Forms Data Format (FDF).
#define FSPDF_SUBMITFORMFLAGS_GETMETHOD   0x0008

Bit 4. Field names and values are submitted using an HTTP GET request.

Note
If clear, they are submitted using a POST request.
This flag is meaningful only when the ExportFormat flag is set.
#define FSPDF_SUBMITFORMFLAGS_INCLUDEANNOTATIONS   0x0080

Bit 8. Submitted FDF file includes all markup annotations in underlying PDF document.

Note
Meaningful only when the form is being submitted in Forms Data Format.
#define FSPDF_SUBMITFORMFLAGS_INCLUDEAPPENDSAVES   0x0040

Bit 7. Submitted FDF file includes contents as contained in differences entry in the FDF dictionary.

Note
Meaningful only when the form is being submitted in Forms Data Format.
#define FSPDF_SUBMITFORMFLAGS_INCLUDENOVALUEFIELDS   0x0002

Bit 2. Submit fields regardless of whether they have a value.

Note
For fields without a value, only the field name is transmitted.
#define FSPDF_TRIGGER_ANNOT_CE   0

brief An action to be performed when the cursor enters the annotation's active area.

#define FSPDF_TRIGGER_ANNOT_CX   1

brief An action to be performed when the cursor exits the annotation's active area.

#define FSPDF_TRIGGER_ANNOT_FL   5

brief An action to be performed when the annotation loses the input focus.

#define FSPDF_TRIGGER_ANNOT_FO   4

brief An action to be performed when the annotation receives the input focus.

#define FSPDF_TRIGGER_ANNOT_MD   2

brief An action to be performed when the mouse button is pressed inside the annotation's active area.

#define FSPDF_TRIGGER_ANNOT_MU   3

brief An action to be performed when the mouse button is released inside the annotation's active area.

#define FSPDF_TRIGGER_ANNOT_PC   7

brief An action to be performed when the page containing the annotation is closed.

#define FSPDF_TRIGGER_ANNOT_PI   9

brief An action to be performed when the page containing the annotation is no longer visible in the viewer application's user interface.

#define FSPDF_TRIGGER_ANNOT_PO   6

brief An action to be performed when the page containing the annotation is opened.

#define FSPDF_TRIGGER_ANNOT_PV   8

brief An action to be performed when the page containing the annotation becomes visible in the viewer application's user interface.

#define FSPDF_TRIGGER_FORMFIELD_KS   0

A JavaScript action to be performed when the user types a keystroke into a text field or combo box or modifies the selection in a scrollable list box.

This action can check the keystroke for validity and reject or modify it.

#define FSPDF_TRIGGER_FORMFIELD_WF   1

A JavaScript action to be performed before the field is formatted to display its current value.

This action can modify the field's value before formatting.

#define FSPDF_TRIGGER_FORMFIELD_WV   2

A JavaScript action to be performed when the field's value is changed.

This action can check the new value for validity.

Function Documentation

FS_RESULT FSCRT_PDFModule_Finalize ( )

Finalize PDF module.

Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_INVALIDMANAGER if Foxit PDF SDK manager is not initialized.
FSCRT_ERRCODE_INVALIDMODULE if PDF module is not initialized.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
Function FSCRT_PDFModule_Initialize should be called to initialize PDF module, and when there is no need to use PDF module anymore, this function should be called.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_PDFModule_Initialize ( )

Initialize PDF module.

This is the first function that should be called if the user needs any PDF process.

Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_INVALIDMANAGER if Foxit PDF SDK manager is not initialized.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if the function cannot initialize PDF module for any reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
Call function FSCRT_PDFModule_Finalize to destroy PDF module if there is no need to use any process of PDF.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_ActionData_Clear ( FSPDF_ACTIONDATA actionData)

Clear PDF action data.

Parameters
[in]actionDataPointer to a FSPDF_ACTIONDATA structure which to be cleared.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter actionData is a NULL pointer.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is not thread safe. Do not call it to process same objects between multi-threads, or the application should maintain thread safety when it needs to process same objects under multi-threaded environments.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_ActionData_Init ( FSPDF_ACTIONDATA actionData)

Initialize PDF action data.

Parameters
[in]actionDataPointer to a FSPDF_ACTIONDATA structure which to be set.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter actionData is a NULL pointer.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is not thread safe. Do not call it to process same objects between multi-threads, or the application should maintain thread safety when it needs to process same objects under multi-threaded environments.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Attachment_Create ( FSCRT_DOCUMENT  document,
FSPDF_ATTACHMENT *  attachment 
)

Create an attachment object.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]attachmentPointer to a FSPDF_ATTACHMENT handle to receive the newly created PDF attachment. If there is any error, it will be NULL
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid type of PDF document.
FSCRT_ERRCODE_PARAM if the parameter attachment or document is a NULL pointer.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
When create a new attachment object, function FSPDF_Attachment_SetFile or FSPDF_Attachment_SetFileName should be called first to initialize attachment object before setting other properties of it.
Attention
Thread Safety: this function is not thread safe. Do not call it to process same objects between multi-threads, or the application should maintain thread safety when it needs to process same objects under multi-threaded environments.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
  • attachment: this handle is short-term.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Attachment_GetCheckSum ( FSPDF_ATTACHMENT  attachment,
FSCRT_BSTR checksum 
)

Get an attachment's checksum.

The checksum refers to checksum of the bytes of an uncompressed embedded file.
The checksum is calculated by applying the standard MD5 message-digest algorithm (described in Internet RFC 1321, the MD5 Message-Digest Algorithm; see the Bibliography) to the bytes of the embedded file stream.

Parameters
[in]attachmentHandle to a FSPDF_ATTACHMENT object returned by function FSPDF_Attachments_GetAttachment.
[out]checksumPointer to a FSCRT_BSTR structure that receives the checksum of the attachment.
If there is any error, FSCRT_BSTR::str will be set empty if it is not NULL while calling this function, and FSCRT_BSTR::len will be set 0.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter attachment or checksum is a NULL pointer.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if the function cannot get checksum of attachment because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is short-term.
  • attachment: this handle is short-term.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Attachment_GetCreationDateTime ( FSPDF_ATTACHMENT  attachment,
FSCRT_DATETIMEZONE dt 
)

Get creation date and time of an attachment.

Parameters
[in]attachmentHandle to a FSPDF_ATTACHMENT object returned by function FSPDF_Attachments_GetAttachment.
[out]dtPointer to FSCRT_DATETIMEZONE structure that receives creation date and time.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter attachment or dt is a NULL pointer.
FSCRT_ERRCODE_FORMAT if the creation date and time of parameter attachment has a wrong format.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_ERROR if the function cannot get creation date of attachment because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is short-term.
  • attachment: this handle is short-term.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Attachment_GetData ( FSPDF_ATTACHMENT  attachment,
FS_BOOL  isRawData,
FSCRT_FILE *  file 
)

Get the attachment data with an asynchronous way.

This function provides an asynchronous way to get the attachment data. This function is usually used to get a large size of attachment data in a progressive way. When this function returns, the application need to invoke function FSCRT_File_Read by passing the returned FSCRT_FILE to extract the needed data.

Parameters
[in]attachmentHandle to a valid FSPDF_ATTACHMENT object which is a PDF attachment object.
[in]isRawDataA boolean value indicates to get raw data if it is TRUE, or to get decoded data (original data) if it is FALSE.
[out]filePointer to a FSCRT_FILE handle that receives the handle of file object.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter attachment or file is a NULL pointer.
FSCRT_ERRCODE_FILE if the function cannot access parameter file.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_ERROR if the function cannot get data of attachment because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is short-term.
  • attachment: this handle is short-term.
  • file: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Attachment_GetDescription ( FSPDF_ATTACHMENT  attachment,
FSCRT_BSTR description 
)

Get description of an attachment.

Descriptive text associated with the attachment. It is used for files in the EmbeddedFiles name tree.

Parameters
[in]attachmentHandle to a FSPDF_ATTACHMENT object returned by function FSPDF_Attachments_GetAttachment.
[out]descriptionPointer to a FSCRT_BSTR structure that receives the description of attachment. It would be in UTF-8 format.
If there is any error, FSCRT_BSTR::str will be set empty if it is not NULL while calling this function, and FSCRT_BSTR::len will be set 0.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter attachment or description is a NULL pointer.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is short-term.
  • attachment: this handle is short-term.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Attachment_GetDocument ( FSPDF_ATTACHMENT  attachment,
FSCRT_DOCUMENT *  document 
)

Get a document handle related to an attachment.

Parameters
[in]attachmentHandle to a FSPDF_ATTACHMENT object which is an attachment object.
[out]documentPointer to a FSCRT_DOCUMENT handle that receives a handle of document object associated with the parameter attachment.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or attachment is NULL.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is short-term.
  • attachment: this handle is short-term.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Attachment_GetFileName ( FSPDF_ATTACHMENT  attachment,
FSCRT_BSTR fileName 
)

Get file name of an attachment.

Parameters
[in]attachmentHandle to a FSPDF_ATTACHMENT object returned by function FSPDF_Attachments_GetAttachment.
[out]fileNamePointer to a FSCRT_BSTR structure that receives file name of the attachment. It would be in UTF-8 format.
If there is any error, FSCRT_BSTR::str will be set empty if it is not NULL while calling this function, and FSCRT_BSTR::len will be set 0.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter attachment or fileName is a NULL pointer.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if the function cannot get file name of attachment because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is short-term.
  • attachment: this handle is short-term.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Attachment_GetModifiedDateTime ( FSPDF_ATTACHMENT  attachment,
FSCRT_DATETIMEZONE dt 
)

Get the last modification date and time of an attachment.

Parameters
[in]attachmentHandle to a FSPDF_ATTACHMENT object returned by function FSPDF_Attachments_GetAttachment.
[out]dtPointer to FSCRT_DATETIMEZONE structure that receives the last modification date and time.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter attachment or dt is a NULL pointer.
FSCRT_ERRCODE_FORMAT if last modification date and time of parameter attachment has a wrong format.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_ERROR if the function cannot get modified date of attachment because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is short-term.
  • attachment: this handle is short-term.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Attachment_GetSize ( FSPDF_ATTACHMENT  attachment,
FSCRT_FILESIZE size 
)

Get the size of an attachment.

The size of an embedded attachment is in bytes.

Parameters
[in]attachmentHandle to a FSPDF_ATTACHMENT object returned by function FSPDF_Attachments_GetAttachment.
[out]sizePointer to a FSCRT_FILESIZE object that receives the size of attachment. In order to keep forward compatibilities, use 64-bits here.
If there is any error, it will be set 0.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter attachment or size is a NULL pointer.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_ERROR if the function cannot get size of attachment because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is short-term.
  • attachment: this handle is short-term.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Attachment_IsEmbedded ( FSPDF_ATTACHMENT  attachment,
FS_BOOL embedded 
)

Check whether an attachment is an embedded file or not.

The PDF attachment can take either of two forms.

  • A simple file specification gives just the name of the target file in a standard format, independent of the naming conventions of any particular file system.
    It can take the form of either a string or a dictionary.
  • A full file specification includes information related to one or more specific file systems.
    It can only be represented as a dictionary.
Parameters
[in]attachmentHandle to a FSPDF_ATTACHMENT object returned by function FSPDF_Attachments_GetAttachment.
[out]embeddedPointer to a FS_BOOL object that receives whether the attachment is an embedded file or not. If there is any error, it will be FALSE.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter attachment or embedded is a NULL pointer.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is short-term.
  • attachment: this handle is short-term.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Attachment_Release ( FSCRT_DOCUMENT  document,
FSPDF_ATTACHMENT  attachment 
)

Release a attachment object.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[in]attachmentHandle to a FSPDF_ATTACHMENT object which is to be released, but this cannot be returned by function FSPDF_Attachments_GetAttachment.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter attachment is a NULL pointer.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
This function cannot be used to release the attachment object returned by function FSPDF_Attachments_GetAttachment.
Attention
Thread Safety: this function is not thread safe. Do not call it to process same objects between multi-threads, or the application should maintain thread safety when it needs to process same objects under multi-threaded environments.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is short-term.
  • document: this handle is long-term partially recoverable.
  • attachment: this handle is short-term.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Attachment_SetCheckSum ( FSPDF_ATTACHMENT  attachment,
const FSCRT_BSTR checksum 
)

Set the checksum of an attachment.

The checksum refers to checksum of the bytes of the uncompressed embedded file.
The checksum is calculated by applying the standard MD5 message-digest algorithm
(described in Internet RFC 1321, the MD5 Message-Digest Algorithm; see the Bibliography) to the bytes of the embedded file stream.

Parameters
[in]attachmentHandle to a valid FSPDF_ATTACHMENT object which is a PDF attachment object.
[in]checksumPointer to a FSCRT_BSTR structure which specifies the checksum of the attachment.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter attachment or checksum is a NULL pointer.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or setting checksum of attachment is not allowed.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if the function cannot set checksum of the attachment because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is short-term.
  • attachment: this handle is short-term.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Attachment_SetCreationDateTime ( FSPDF_ATTACHMENT  attachment,
const FSCRT_DATETIMEZONE dt 
)

Set the creation date and time of an attachment.

The creation date represents when the attachment was created.

Parameters
[in]attachmentHandle to a valid FSPDF_ATTACHMENT object which is a PDF attachment object.
[in]dtPointer to FSCRT_DATETIMEZONE structure which specifies the creation date.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter attachment or dt is a NULL pointer, or parameter dt is invalid.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or setting creating date of attachment is not allowed.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_ERROR if the function cannot set creation date of the attachment because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is short-term.
  • attachment: this handle is short-term.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Attachment_SetDescription ( FSPDF_ATTACHMENT  attachment,
const FSCRT_BSTR description 
)

Set the description of an attachment.

Descriptive text associated with the attachment. It is used for files in the EmbeddedFiles name tree.

Parameters
[in]attachmentHandle to a valid FSPDF_ATTACHMENT object which is a PDF attachment object.
[in]descriptionPointer to a FSCRT_BSTR structure which specifies the description of the attachment. It should be in UTF-8 format.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter attachment or description is a NULL pointer.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or setting description of attachment is not allowed.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if the function cannot set the description of the attachment because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
For "FileAttachment" annotation, viewer applications should call function FSPDF_Annot_SetContents to set the descriptive text which relates to the attached file.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is short-term.
  • attachment: this handle is short-term.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Attachment_SetFile ( FSPDF_ATTACHMENT  attachment,
FSCRT_FILE  file 
)

Set the file of an attachment.

For attachment created by function FSPDF_Attachment_Create, this function is used to initialize the newly created attachment object before setting other properties of it.
For attachment got from PDF document, this function is used to set new file handle to this attachment.
ATTENTION: for initializing newly created attachment, only need to call one of functions FSPDF_Attachment_SetFileName or FSPDF_Attachment_SetFile.

Parameters
[in]attachmentHandle to a valid FSPDF_ATTACHMENT object which is a PDF attachment object.
[in]fileHandle to a FSCRT_FILE object which specifies the embedded file.
This object cannot be released until attachment has been released for no use or attachment has been inserted to other object and document has been saved.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter attachment or file is a NULL pointer.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or setting file to attachment is not allowed.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if the function cannot set file of the attachment because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is short-term.
  • attachment: this handle is short-term.
  • file: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Attachment_SetFileName ( FSPDF_ATTACHMENT  attachment,
const FSCRT_BSTR fileName,
FS_BOOL  isURL 
)

Set the file name of an attachment.

For attachment created by function FSPDF_Attachment_Create, this function is used to initialize the newly created attachment object before setting other properties of it.
For attachment got from PDF document, this function is used to set new file name to this attachment.
ATTENTION: for initializing newly created attachment, only need to call one of funcions FSPDF_Attachment_SetFileName or FSPDF_Attachment_SetFile.

Parameters
[in]attachmentHandle to a valid FSPDF_ATTACHMENT object which is a PDF attachment object.
[in]fileNamePointer to a FSCRT_BSTR structure which specifies file name of the attachment. It should be in UTF-8 format.
[in]isURLA FS_BOOL that specifies whether the set file is a remote file.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter attachment or fileName is a NULL pointer.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or setting file name of attachment is not allowed.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if the function cannot set file name of the attachment because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is short-term.
  • attachment: this handle is short-term.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Attachment_SetModifiedDateTime ( FSPDF_ATTACHMENT  attachment,
const FSCRT_DATETIMEZONE dt 
)

Set the modification date of an attachment.

The modification date represents when the attachment was last modified.

Parameters
[in]attachmentHandle to a valid FSPDF_ATTACHMENT object which is a PDF attachment object.
[in]dtPointer to FSCRT_DATETIMEZONE structure which specifies the modification date.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter attachment or dt is a NULL pointer, or parameter dt is invalid.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or setting modification date of attachment is not allowed.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_ERROR if the function cannot set modified date of the attachment because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is short-term.
  • attachment: this handle is short-term.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Attachment_WriteToFile ( FSPDF_ATTACHMENT  attachment,
FSCRT_FILE  file 
)

Write the attachment data directly into a file.

Parameters
[in]attachmentHandle to a valid FSPDF_ATTACHMENT object which is a PDF attachment object.
[in]fileHandle to a FSCRT_FILE object.
When this function is called, it indicates the file that the attachment to be saved to.
When this function returns, it indicates to save the attachment to a file.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter attachment or file is a NULL pointer.
FSCRT_ERRCODE_FILE if the function cannot access parameter file.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_ERROR if the function cannot save attachment to file because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is short-term.
  • attachment: this handle is short-term.
  • file: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Font_GetDict ( FSCRT_DOCUMENT  document,
FSCRT_FONT  font,
FSPDF_OBJECT *  fontDictionary 
)

Get the dictionary of a font in a PDF document.

Parameters
[in]fontHandle to a FSCRT_FONT object which should be a PDF font.A PDF font is the font actually used in the PDF document.
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]fontDictionaryPointer to a FSPDF_OBJECT object that receives the dictionary of the font.
If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter font, document or fontDictionary is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR for the other errors.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Font_IsEmbedded ( FSCRT_DOCUMENT  document,
FSCRT_FONT  font,
FS_BOOL isEmbedded 
)

Check whether a font is embedded in a PDF document.

Parameters
[in]fontHandle to a FSCRT_FONT object which is a PDF or non-PDF font.
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]isEmbeddedPointer to a FS_BOOL object which indicates whether parameter font is embedded in PDF document or not. TRUE means parameter font is embedded in PDF document, otherwise it will be FALSE.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter font, document or isEmbedded is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
:FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Font_IsSupportEmbedded ( FSCRT_DOCUMENT  document,
FSCRT_FONT  font,
FS_BOOL isSupported 
)

Check whether all features of the font can be embedded to a specific PDF document or not.

Due to various reasons, it is hard to always ensure the appearance of characters will stay the same after its font is embedded to PDF document. So this function can be used to check whether the font can be fully embedded or not before calling function FSPDF_Doc_EmbedFont.
Specially,

  • If parameter font is got from another PDF document (different from parameter document), not support to embed this font to current specific PDF document.
  • If parameter font has been embedded, it cannot be embedded again.
  • If parameter font is one of the 14 standard fonts, it cannot be embedded.
Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[in]fontHandle to a FSCRT_FONT object.
[out]isSupportedPointer to a FS_BOOL object that receives the result:
  • TRUE means parameter font can be embedded to parameter document;
  • FALSE means parameter font cannot be embedded to parameter document.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if document, font or isSupported is NULL.
FSCRT_ERRCODE_UNRECOVERABLE if an unrecoverable error occurs.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or invalid memory access.
FSCRT_ERRCODE_ERROR if fail to judge font object for other reasons.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
  • font: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_RenderContext_Create ( FSPDF_RENDERCONTEXT *  pdfRenderContext)

Create a PDF rendering context.

Parameters
[out]pdfRenderContextPointer to a FSPDF_RENDERCONTEXT handle that receives a new PDF rendering context object. If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter pdfRenderContext is a NULL pointer.
FSCRT_ERRCODE_INVALIDMODULE if PDF module is not initialized.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if the function cannot create the PDF render context for any reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
PDF rendering context is designed specially to ensure rendering PDF contents on rendering engine.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • pdfRenderContext: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_RenderContext_Release ( FSPDF_RENDERCONTEXT  pdfRenderContext)

Release a PDF rendering context.

Parameters
[in]pdfRenderContextHandle to a FSPDF_RENDERCONTEXT object which is a PDF rendering context object.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter pdfRenderContext is a NULL pointer.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is not thread safe. Do not call it to process same objects between multi-threads, or the application should maintain thread safety when it needs to process same objects under multi-threaded environments.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • pdfRenderContext: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_RenderContext_SetFlags ( FSPDF_RENDERCONTEXT  pdfRenderContext,
FS_DWORD  flags 
)

Set flags to a rendering context.

Parameters
[in]pdfRenderContextHandle to a FSPDF_RENDERCONTEXT object which is a PDF rendering context object.
[in]flagsRendering flags value. All undefined bits are omitted.
Please refer to macro definitions FSPDF_RENDERCONTEXTFLAG_XXX and this can be one or a combination of these macros.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter pdfRenderContext is a NULL pointer.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • pdfRenderContext: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_RenderContext_SetHalftoneLimit ( FSPDF_RENDERCONTEXT  pdfRenderContext,
FS_INT32  halftoneLimit 
)

Set a halftone limit to a rendering context.

By default, Foxit PDF SDK displays all bitmaps using down-sampling, which means if an image is shrink onto the screen, only part of pixels will be picked and displayed. This saves a lot of calculation, especially for big images with millions of pixels. However the display quality will be bad.
In order to reach a balance between performance and quality, application can use this function to set a limit:
if the count of pixels in an image is more than this limit, then Foxit PDF SDK will use down-sampling for quick drawing;
otherwise, if the image has less pixels, Foxit PDF SDK will use halftone for better quality.

Parameters
[in]pdfRenderContextHandle to a FSPDF_RENDERCONTEXT object which is a PDF rendering context object.
[in]halftoneLimitA halftone limit to a FS_INT32 value.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter pdfRenderContext is a NULL pointer.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_ERROR if the function cannot set the halftone limit into PDF render context for any reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
By default, halftone limit is 60M in the desktop platform.
If halftoneLimit which set by users is less than 60M, halftone limit is still 60M in the desktop platform.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • pdfRenderContext: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_RenderContext_SetLayerContext ( FSPDF_RENDERCONTEXT  pdfRenderContext,
FSPDF_LAYERCONTEXT  layerContext 
)

Set layer context to render context handle.

Parameters
[in]pdfRenderContextHandle to a FSPDF_RENDERCONTEXT object which is a PDF rendering context object.
[in]layerContextHandle to a FSPDF_LAYERCONTEXT object which is a PDF layer context object.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter pdfRenderContext or layerContext is a NULL pointer.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_ERROR if the function cannot set the layer context into PDF render context for any reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
In order to render one layer when to render PDF contents on a rendering context, user should call this function to set the layer context to render context.
Attention
Thread Safety: this function is thread safe. OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • pdfRenderContext: this handle is long-term recoverable.
  • layerContext: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_RenderContext_SetMatrix ( FSPDF_RENDERCONTEXT  pdfRenderContext,
const FSCRT_MATRIX matrix 
)

Set a transformation matrix to a rendering context.

Parameters
[in]pdfRenderContextHandle to a FSPDF_RENDERCONTEXT object which is a PDF rendering context object.
[in]matrixPointer to a FSCRT_MATRIX structure which gives a transformation matrix while rendering PDF contents.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter pdfRenderContext or matrix is a NULL pointer.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • pdfRenderContext: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_RenderContext_SetOption ( FSPDF_RENDERCONTEXT  pdfRenderContext,
FS_DWORD  option,
FS_LPVOID  params 
)

Set option parameters to a rendering context.

Parameters
[in]pdfRenderContextHandle to a FSPDF_RENDERCONTEXT object which is a PDF rendering context object.
[in]optionA rendering option identity code to a FS_DWORD value. Please refer to macro definitions FSPDF_RENDEROPTION_XXX and this should be one of these macros.
[in]paramsPointer to FS_LPVOID object which indicates rendering parameters for parameter option.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter pdfRenderContext or params is a NULL pointer.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
Only structure FSPDF_RENDEROPTION_COLORMODE option can be used at present, and parameter params should point to a structure FSPDF_RENDEROPTIONPARAM_COLORMODE.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • pdfRenderContext: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.

Foxit Corporation