struct pdf_doc_event
{
int type;
}
Document events: the objects via which MuPDF informs the calling app of occurrences emanating from the document, possibly from user interaction or javascript execution. MuPDF informs the app of document events via a callback.
enum pdf_document_event_type
{
PDF_DOCUMENT_EVENT_ALERT,
PDF_DOCUMENT_EVENT_PRINT,
PDF_DOCUMENT_EVENT_LAUNCH_URL,
PDF_DOCUMENT_EVENT_MAIL_DOC,
PDF_DOCUMENT_EVENT_SUBMIT,
PDF_DOCUMENT_EVENT_EXEC_MENU_ITEM,
}
void
pdf_set_doc_event_callback (
fz_context *ctx,
pdf_document *doc,
pdf_doc_event_cb *event_cb,
pdf_free_doc_event_data_cb *free_event_data_cb,
void *data
)
set the function via which to receive document events.
void *
pdf_get_doc_event_callback_data (
fz_context *ctx,
pdf_document *doc
)
The various types of document events
struct pdf_alert_event
{
pdf_document *doc;
const char *message;
int icon_type;
int button_group_type;
const char *title;
int has_check_box;
const char *check_box_message;
int initially_checked;
int finally_checked;
int button_pressed;
}
details of an alert event. In response the app should display an alert dialog with the buttons specified by “button_type_group”. If “check_box_message” is non-NULL, a checkbox should be displayed in the lower-left corned along with the message.
“finally_checked” and “button_pressed” should be set by the app before returning from the callback. “finally_checked” need be set only if “check_box_message” is non-NULL.
enum pdf_alert_icon_type
{
PDF_ALERT_ICON_ERROR,
PDF_ALERT_ICON_WARNING,
PDF_ALERT_ICON_QUESTION,
PDF_ALERT_ICON_STATUS
}
Possible values of icon_type
enum pdf_alert_button_group_type
{
PDF_ALERT_BUTTON_GROUP_OK,
PDF_ALERT_BUTTON_GROUP_OK_CANCEL,
PDF_ALERT_BUTTON_GROUP_YES_NO,
PDF_ALERT_BUTTON_GROUP_YES_NO_CANCEL
}
Possible values of button_group_type
enum pdf_alert_button_pressed
{
PDF_ALERT_BUTTON_NONE,
PDF_ALERT_BUTTON_OK,
PDF_ALERT_BUTTON_CANCEL,
PDF_ALERT_BUTTON_NO,
PDF_ALERT_BUTTON_YES
}
Possible values of button_pressed
pdf_alert_event *
pdf_access_alert_event (
fz_context *ctx,
pdf_doc_event *evt
)
Access the details of an alert event. The returned pointer and all the data referred to by the structure are owned by mupdf and need not be freed by the caller.
const char *
pdf_access_exec_menu_item_event (
fz_context *ctx,
pdf_doc_event *evt
)
Access the details of am execMenuItem event, which consists of just the name of the menu item.
struct pdf_launch_url_event
{
const char *url;
int new_frame;
}
Details of a launch-url event. The app should open the url, either in a new frame or in the current window.
pdf_launch_url_event *
pdf_access_launch_url_event (
fz_context *ctx,
pdf_doc_event *evt
)
Access the details of a launch-url event. The returned pointer and all data referred to by the structure are owned by mupdf and need not be freed by the caller.
struct pdf_mail_doc_event
{
int ask_user;
const char *to;
const char *cc;
const char *bcc;
const char *subject;
const char *message;
}
Details of a mail_doc event. The app should save the current state of the document and email it using the specified parameters.
pdf_mail_doc_event *
pdf_access_mail_doc_event (
fz_context *ctx,
pdf_doc_event *evt
)
void
pdf_event_issue_alert (
fz_context *ctx,
pdf_document *doc,
pdf_alert_event *evt
)
void
pdf_event_issue_print (
fz_context *ctx,
pdf_document *doc
)
void
pdf_event_issue_exec_menu_item (
fz_context *ctx,
pdf_document *doc,
const char *item
)
void
pdf_event_issue_launch_url (
fz_context *ctx,
pdf_document *doc,
const char *url,
int new_frame
)
void
pdf_event_issue_mail_doc (
fz_context *ctx,
pdf_document *doc,
pdf_mail_doc_event *evt
)