Foxit PDF SDK
<FSActionCallback> Protocol Reference

Inherits <NSObject>.

Instance Methods

(int) - alert:title:type:icon:
 A callback function used to pop up a dialog to show warnings or hints. More...
 
(BOOL) - beep:
 A callback function to cause the system to play a sound. More...
 
(NSString *) - browseFile
 A callback function to show a file selection dialog, and the selected file path should be returned. More...
 
(NSString *) - browseFile:file_format:file_filter:
 A callback function to show a file selection dialog. More...
 
(FSPDFDoc *) - createBlankDoc
 A callback function to create a blank PDF document object. More...
 
(BOOL) - executeNamedAction:named_action:
 A callback function to execute a named action. More...
 
(NSString *) - getAppInfo:
 A callback function to get application information. More...
 
(FSPDFDoc *) - getCurrentDoc
 A callback function to receive current PDF document object. More...
 
(int) - getCurrentPage:
 A callback function used to receive current page index. More...
 
(BOOL) - getDocChangeMark:
 A callback function to receive the change mark which indicates whether the content of document is changed or not. More...
 
(NSString *) - getFilePath:
 A callback function to get the file path of current PDF document. More...
 
(FSIdentityProperties *) - getIdentityProperties
 A callback function used to get identity properties of current user. More...
 
(FSActionCallbackLanguage- getLanguage
 A callback function to get the language of the running viewer application. More...
 
(FSPDFDoc *) - getOpenedDoc:
 A callback function to receive an opened PDF document object by index. More...
 
(int) - getOpenedDocCount
 A callback function to receive the count of opened documents. More...
 
(FSRotation- getPageRotation:page_index:
 A callback function used to receive current displaying rotation of a page on PDF viewer. More...
 
(BOOL) - invalidateRect:page_index:pdf_rect:
 A callback function to invalidate the client area within the specified rectangle. More...
 
(BOOL) - launchURL:
 A callback function to launch to a specified URL. More...
 
(BOOL) - mailData:data_type:is_ui:to:subject:cc:bcc:message:
 A callback function to mail data or message, with or without user interaction. More...
 
(BOOL) - openDoc:password:
 A callback function to open a PDF file. More...
 
(NSString *) - popupMenu:is_selected_item:
 A callback function to pop up a menu window. More...
 
(FSMenuItemEx *) - popupMenuEx:is_selected_item:
 A callback function to pop up a menu window. More...
 
(BOOL) - print:is_ui:page_range:is_silent:is_shrunk_to_fit:is_printed_as_image:is_reversed:is_to_print_annots:
 A callback function to print pages within a specified index range. More...
 
(NSString *) - response:title:default_value:label:is_password:
 A callback function to display a dialog box containing a question and an entry field for the user to reply to the question. More...
 
(void) - setCurrentPage:page_index:
 A callback function used to set the current page by index. More...
 
(BOOL) - setDocChangeMark:change_mark:
 A callback function to set the change mark which indicates whether the content of document is changed or not. More...
 
(BOOL) - setIdentityProperties:
 A callback function used to set identity properties of current user. More...
 
(BOOL) - setPageRotation:page_index:rotation:
 A callback function used to set the rotation value of a page on PDF viewer. More...
 
(BOOL) - submitForm:form_data:url:file_format_type:
 A callback function to submit the form data to a specified URL. More...
 
(unsigned int) - verifySignature:pdf_signature:
 A callback function to verify specified signature. More...
 

Detailed Description

This class represents a callback object for performing PDF actions. All the pure virtual functions in this class are used as callback functions and should be implemented by user, to perform PDF actions, such as javascript actions.

Method Documentation

◆ alert:title:type:icon:()

- (int) alert: (NSString *)  msg
title: (NSString *)  title
type: (int)  type
icon: (int)  icon 
required

A callback function used to pop up a dialog to show warnings or hints.

This callback function is optional, so it can be implemented to do nothing and just return a useless value.

Parameters
[in]msgThe message string to be displayed in the dialog.
[in]titleThe title of the dialog.
[in]typeType of button group. It would be one of following values:
  • 0: OK;(default value.)
  • 1: OK, Cancel;
  • 2: Yes, NO;
  • 3: Yes, NO, Cancel.
[in]iconIcon type. It would be one of following values:
  • 0: Error;(default value.)
  • 1: Warning;
  • 2: Question;
  • 3: Status.
Returns
The return value should be one of following values:
  • 1: OK;
  • 2: Cancel;
  • 3: NO;
  • 4: Yes;

◆ beep:()

- (BOOL) beep: (int)  type
required

A callback function to cause the system to play a sound.

This callback function is optional, so it can be implemented to do nothing and just return a useless value.

Parameters
[in]typeSound type. The value would be on of following values:
  • 0: Error
  • 1: Warning
  • 2: Question
  • 3: Status
  • 4: Default (default value)
Returns
YES means success, while NO means failure.

◆ browseFile()

- (NSString*) browseFile
required

A callback function to show a file selection dialog, and the selected file path should be returned.

This callback function is optional, so it can be implemented to do nothing and just return a useless value.

Returns
The file path. It can be an empty string.

◆ browseFile:file_format:file_filter:()

- (NSString*) browseFile: (BOOL)  is_open_dialog
file_format: (NSString *)  file_format
file_filter: (NSString *)  file_filter 
required

A callback function to show a file selection dialog.

This callback function is optional, so it can be implemented to do nothing and just return a useless value.

Parameters
[in]is_open_dialogWhether is open or saving dialog, true means open dialog and false means saving dialog.
[in]file_formatThe file format string.
[in]file_filterThe file filter string.
Returns
The file path. It can be an empty string.

◆ createBlankDoc()

- (FSPDFDoc*) createBlankDoc
required

A callback function to create a blank PDF document object.

This callback function is optional, so it can be implemented to do nothing and just return a useless value.

Returns
The newly created blank PDF document object.

◆ executeNamedAction:named_action:()

- (BOOL) executeNamedAction: (FSPDFDoc *)  document
named_action: (NSString *)  named_action 
required

A callback function to execute a named action.

Please refer to description of "Named Actions" in Section 8.5.3 of <PDF Reference 1.7> for more details. This callback function is optional, so it can be implemented to do nothing and just return a useless value.

Parameters
[in]documentA PDF document object. It would be valid.
[in]named_actionA string to specify a named action.
Returns
YES means success, while NO means failure.

◆ getAppInfo:()

- (NSString*) getAppInfo: (FSActionCallbackAppInfoType type
required

A callback function to get application information.

This callback function is optional, so it can be implemented to do nothing and just return a useless value.
For the digital information like FSActionCallbackAppInfoTypeViewerVersion, FSActionCallbackAppInfoTypeAppVersion and FSActionCallbackAppInfoTypeFormsVersion, please use string to represent it.

Parameters
[in]typeType of information. Please refer to values starting from FSActionCallbackAppInfoTypeFormsVersion and this would be one of these macros.
Returns
The application information.

◆ getCurrentDoc()

- (FSPDFDoc*) getCurrentDoc
required

A callback function to receive current PDF document object.

This callback function is optional, so it can be implemented to do nothing and just return a useless value.

Returns
Current PDF document object.

◆ getCurrentPage:()

- (int) getCurrentPage: (FSPDFDoc *)  document
required

A callback function used to receive current page index.

This callback function is optional, so it can be implemented to do nothing and just return a useless value.

Parameters
[in]documentA PDF document object. It would be valid.
Returns
Current page index. The value should be stared from 0 and less than page count of the specified document.

◆ getDocChangeMark:()

- (BOOL) getDocChangeMark: (FSPDFDoc *)  document
required

A callback function to receive the change mark which indicates whether the content of document is changed or not.

This callback function is optional, so it can be implemented to do nothing and just return a useless value.

Parameters
[in]documentA PDF document object. It would be valid.
Returns
YES means the PDF document is changed, while NO means not.

◆ getFilePath:()

- (NSString*) getFilePath: (FSPDFDoc *)  document
required

A callback function to get the file path of current PDF document.

This callback function is optional, so it can be implemented to do nothing and just return a useless value.

Parameters
[in]documentA PDF document object. It would be valid.
Returns
The file path.

◆ getIdentityProperties()

- (FSIdentityProperties*) getIdentityProperties
required

A callback function used to get identity properties of current user.

This callback function is optional, so it can be implemented to do nothing and just return a useless value.

Returns
An IdentityProperties object that specifies the identity properties of current user.

◆ getLanguage()

- (FSActionCallbackLanguage) getLanguage
required

A callback function to get the language of the running viewer application.

This callback function is optional, so it can be implemented to do nothing and just return a useless value.

Returns
The language type. Please refer to values starting from FSActionCallbackLanguageUnknown and this should be one of these values.

◆ getOpenedDoc:()

- (FSPDFDoc*) getOpenedDoc: (int)  index
required

A callback function to receive an opened PDF document object by index.

This callback function is optional, so it can be implemented to do nothing and just return a useless value.

Parameters
[in]indexThe index of an opened PDF documents. Valid range: from 0 to count-1. count is returned by callback function FSActionCallback::getOpenedDocCount
Returns
A opened PDF document object.

◆ getOpenedDocCount()

- (int) getOpenedDocCount
required

A callback function to receive the count of opened documents.

This callback function is optional, so it can be implemented to do nothing and just return a useless value.

Returns
The count of opened documents.

◆ getPageRotation:page_index:()

- (FSRotation) getPageRotation: (FSPDFDoc *)  document
page_index: (int)  page_index 
required

A callback function used to receive current displaying rotation of a page on PDF viewer.

This callback function is optional, so it can be implemented to do nothing and just return a useless value.

Parameters
[in]documentA PDF document object. It would be valid.
[in]page_indexA page index, used to specify which page's rotation is to be retrieved. The index would start from 0 and less than page count of the specified document.
Returns
The rotation of specified page. Please refer to values starting from FSRotation0 and this should be one of these values.

◆ invalidateRect:page_index:pdf_rect:()

- (BOOL) invalidateRect: (FSPDFDoc *)  document
page_index: (int)  page_index
pdf_rect: (FSRectF *)  pdf_rect 
required

A callback function to invalidate the client area within the specified rectangle.

All positions are measured in PDF "user space". Implementation should call function FSRenderer::startRender:matrix:pause: for repainting a specified page area.

Parameters
[in]documentA PDF document object. It would be valid.
[in]page_indexA page index. It would start from 0 and less than page count of the specified document.
[in]pdf_rectA rectangle that specifies the page area in PDF coordinate system.
Returns
YES means success, while NO means failure.

◆ launchURL:()

- (BOOL) launchURL: (NSString *)  url
required

A callback function to launch to a specified URL.

This callback function is optional, so it can be implemented to do nothing and just return a useless value.

Parameters
[in]urlA URL.
Returns
YES means success, while NO means failure.

◆ mailData:data_type:is_ui:to:subject:cc:bcc:message:()

- (BOOL) mailData: (void *)  data
data_type: (FSActionCallbackMailType data_type
is_ui: (BOOL)  is_ui
to: (NSString *)  to
subject: (NSString *)  subject
cc: (NSString *)  cc
bcc: (NSString *)  bcc
message: (NSString *)  message 
required

A callback function to mail data or message, with or without user interaction.

This callback function is optional, so it can be implemented to do nothing and just return a useless value.

Parameters
[in]dataPointer to a data which is to be mailed. The value and type of the data depends on parameter data_type:
[in]data_typeMail type. Please refer to values starting from FSActionCallbackMailTypeDoc and this would be one of these values.
[in]is_uiYES means that the remaining parameters are used to seed the compose-new-message window which is displayed to the user.
NO means that the parameter to is required and all other parameters are optional.
[in]toA string that specifies a semicolon-delimited list of recipients for the message.
[in]subjectA string that specifies the subject of the message. The limit of this string's length is 64 KB.
[in]ccA string that specifies a semicolon-delimited list of CC recipients for the message.
[in]bccA string that specifies a semicolon-delimited list of BCC recipients for the message.
[in]messageA string that specifies the content of the message. The limit of this string's length is 64 KB.
Returns
YES means success, while NO means failure.

◆ openDoc:password:()

- (BOOL) openDoc: (NSString *)  file_path
password: (NSString *)  password 
required

A callback function to open a PDF file.

This callback function is optional, so it can be implemented to do nothing and just return a useless value.

Parameters
[in]file_pathA full path of an existing PDF file.
[in]passwordPassword for input PDF file. This may be an empty string.
Returns
YES means success, while NO means failure.

◆ popupMenu:is_selected_item:()

- (NSString*) popupMenu: (FSMenuListArray *)  menus
is_selected_item: (NSNumber **)  is_selected_item 
required

A callback function to pop up a menu window.

The position of menu window is the same as cursor's. This callback function is optional, so it can be implemented to do nothing and just return a useless value.

Parameters
[in]menusAn array of menu list objects.
[out]is_selected_itemOutput parameter that receives the value of whether this menu item is selected or not. true means that the menu item is selected, while false means that the menu item is not selected.
Returns
The name of the menu item that was selected.

◆ popupMenuEx:is_selected_item:()

- (FSMenuItemEx*) popupMenuEx: (FSMenuItemExArray *)  menus
is_selected_item: (NSNumber **)  is_selected_item 
required

A callback function to pop up a menu window.

The position of menu window is the same as cursor's. This callback function is optional, so it can be implemented to do nothing and just return a useless value.

Parameters
[in]menusAn array of FSMenuItemEx objects.
[out]is_selected_itemOutput parameter that receives the value of whether a menu item is selected or not. true means that the menu item is selected, while false means that the menu item is not selected.
Returns
The MenuItemEx object of the menu item that was selected.

◆ print:is_ui:page_range:is_silent:is_shrunk_to_fit:is_printed_as_image:is_reversed:is_to_print_annots:()

- (BOOL) print: (FSPDFDoc *)  document
is_ui: (BOOL)  is_ui
page_range: (FSRange *)  page_range
is_silent: (BOOL)  is_silent
is_shrunk_to_fit: (BOOL)  is_shrunk_to_fit
is_printed_as_image: (BOOL)  is_printed_as_image
is_reversed: (BOOL)  is_reversed
is_to_print_annots: (BOOL)  is_to_print_annots 
required

A callback function to print pages within a specified index range.

This callback function is optional, so it can be implemented to do nothing and just return a useless value.

Parameters
[in]documentA PDF document object. It would be valid.
[in]is_uiYES means that a UI should be presented to the user to obtain printing information and confirm the action.
[in]page_rangeA range object to specify the page range for printing. All the indexes represented in this range would start from 0 and less than page count of the specified document.
[in]is_silentYES means that the cancel dialog box should be suppressed while the document is printing.
[in]is_shrunk_to_fitYES means that the page should be shrunk (if necessary) to fit within the area of the printed page.
[in]is_printed_as_imageYES means that pages should be printed as image.
[in]is_reversedYES means that the printing order should be from parameter end to parameter start.
[in]is_to_print_annotsYES means that annotations should be printed with page.
Returns
YES means success, while NO means failure.

◆ response:title:default_value:label:is_password:()

- (NSString*) response: (NSString *)  question
title: (NSString *)  title
default_value: (NSString *)  default_value
label: (NSString *)  label
is_password: (BOOL)  is_password 
required

A callback function to display a dialog box containing a question and an entry field for the user to reply to the question.

This callback function is optional, so it can be implemented to do nothing and just return a useless value.

Parameters
[in]questionA string that specifies the question to be posed to the user.
[in]titleA string that specifies the title of the dialog box.
[in]default_valueA string that specifies a default value as the answer to the question. If the answer is not specified, no default value is presented.
[in]labelA string that specifies a short string to appear in front of the edit text field.
[in]is_passwordA boolean value that indicates whether user's response should be masked to show:
YES means that the user's response should show as asterisks (*) or bullets (?) to mask the response, which might be sensitive information.
Returns
User's response. It can be an empty string.

◆ setCurrentPage:page_index:()

- (void) setCurrentPage: (FSPDFDoc *)  document
page_index: (int)  page_index 
required

A callback function used to set the current page by index.

This callback function is optional, so it can be implemented to do nothing.

Parameters
[in]documentA PDF document object. It would be valid.
[in]page_indexA page index which is used to change current page. The index would start from 0 and less than page count of the specified document.
Returns
None.

◆ setDocChangeMark:change_mark:()

- (BOOL) setDocChangeMark: (FSPDFDoc *)  document
change_mark: (BOOL)  change_mark 
required

A callback function to set the change mark which indicates whether the content of document is changed or not.

This callback function is optional, so it can be implemented to do nothing and just return a useless value.

Parameters
[in]documentA PDF document object. It would be valid.
[in]change_markA boolean value that indicates whether the content of document is changed or not.
Returns
YES means success, while NO means failure.

◆ setIdentityProperties:()

- (BOOL) setIdentityProperties: (FSIdentityProperties *)  identity_properties
required

A callback function used to set identity properties of current user.

This callback function is optional, so it can be implemented to do nothing.

Returns
YES means success, while NO means failure.

◆ setPageRotation:page_index:rotation:()

- (BOOL) setPageRotation: (FSPDFDoc *)  document
page_index: (int)  page_index
rotation: (FSRotation rotation 
required

A callback function used to set the rotation value of a page on PDF viewer.

This callback function is optional, so it can be implemented to do nothing.

Parameters
[in]documentA PDF document object. It would be valid.
[in]page_indexA page index, used to specify which page's rotation is to be changed. The index would start from 0 and less than page count of the specified document.
[in]rotationNew rotation value. Please refer to values starting from FSRotation0 and this would be one of these values except FSRotationUnknown.
Returns
YES means success, while NO means failure.

◆ submitForm:form_data:url:file_format_type:()

- (BOOL) submitForm: (FSPDFDoc *)  document
form_data: (NSData *)  form_data
url: (NSString *)  url
file_format_type: (FSFileFormatType file_format_type 
required

A callback function to submit the form data to a specified URL.

This callback function is optional, so it can be implemented to do nothing and just return a useless value.

Parameters
[in]documentA PDF document object. It would be valid.
[in]form_dataPointer to a form data buffer which is to be submit.
[in]urlA URL, to which the form data will be submit.
[in]file_format_typeFile format type for submission form. Please refer to values starting from foxit::common::e_FileFormatTypeFDF and this would be one of these values.
Returns
YES means success, while NO means failure.

◆ verifySignature:pdf_signature:()

- (unsigned int) verifySignature: (FSPDFDoc *)  document
pdf_signature: (FSSignature *)  pdf_signature 
required

A callback function to verify specified signature.

This callback function will be triggered when a signature is to be verified by an action. If user does not want to verify the signature, just implement this function to do nothing and just return FSSignatureStateUnknown. User is recommended to use class FSLTVVerifier to verify if a signed signature is valid or not.

Parameters
[in]documentA PDF document object. It would be valid.
[in]pdf_signatureA PDF signature which is signed. This signature belongs to input paramter document.
Returns
The signature verified state. Please refer to values starting from FSSignatureStateUnknown and this would be one or combination of them.