// Copyright 2014 The PDFium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #ifndef PUBLIC_FPDF_FORMFILL_H_ #define PUBLIC_FPDF_FORMFILL_H_ // clang-format off // NOLINTNEXTLINE(build/include_directory) #include "fpdfview.h" // These values are return values for a public API, so should not be changed // other than the count when adding new values. #define FORMTYPE_NONE … #define FORMTYPE_ACRO_FORM … #define FORMTYPE_XFA_FULL … #define FORMTYPE_XFA_FOREGROUND … // of XFA spec #define FORMTYPE_COUNT … #define JSPLATFORM_ALERT_BUTTON_OK … #define JSPLATFORM_ALERT_BUTTON_OKCANCEL … #define JSPLATFORM_ALERT_BUTTON_YESNO … #define JSPLATFORM_ALERT_BUTTON_YESNOCANCEL … #define JSPLATFORM_ALERT_BUTTON_DEFAULT … #define JSPLATFORM_ALERT_ICON_ERROR … #define JSPLATFORM_ALERT_ICON_WARNING … #define JSPLATFORM_ALERT_ICON_QUESTION … #define JSPLATFORM_ALERT_ICON_STATUS … #define JSPLATFORM_ALERT_ICON_ASTERISK … #define JSPLATFORM_ALERT_ICON_DEFAULT … #define JSPLATFORM_ALERT_RETURN_OK … #define JSPLATFORM_ALERT_RETURN_CANCEL … #define JSPLATFORM_ALERT_RETURN_NO … #define JSPLATFORM_ALERT_RETURN_YES … #define JSPLATFORM_BEEP_ERROR … #define JSPLATFORM_BEEP_WARNING … #define JSPLATFORM_BEEP_QUESTION … #define JSPLATFORM_BEEP_STATUS … #define JSPLATFORM_BEEP_DEFAULT … // Exported Functions #ifdef __cplusplus extern "C" { #endif IPDF_JSPLATFORM; // Flags for Cursor type #define FXCT_ARROW … #define FXCT_NESW … #define FXCT_NWSE … #define FXCT_VBEAM … #define FXCT_HBEAM … #define FXCT_HAND … // Function signature for the callback function passed to the FFI_SetTimer // method. // Parameters: // idEvent - Identifier of the timer. // Return value: // None. TimerCallback; // Declares of a struct type to the local system time. FPDF_SYSTEMTIME; #ifdef PDF_ENABLE_XFA // Pageview event flags #define FXFA_PAGEVIEWEVENT_POSTADDED … #define FXFA_PAGEVIEWEVENT_POSTREMOVED … // Definitions for Right Context Menu Features Of XFA Fields #define FXFA_MENU_COPY … #define FXFA_MENU_CUT … #define FXFA_MENU_SELECTALL … #define FXFA_MENU_UNDO … #define FXFA_MENU_REDO … #define FXFA_MENU_PASTE … // Definitions for File Type. #define FXFA_SAVEAS_XML … #define FXFA_SAVEAS_XDP … #endif // PDF_ENABLE_XFA FPDF_FORMFILLINFO; // Function: FPDFDOC_InitFormFillEnvironment // Initialize form fill environment. // Parameters: // document - Handle to document from FPDF_LoadDocument(). // formInfo - Pointer to a FPDF_FORMFILLINFO structure. // Return Value: // Handle to the form fill module, or NULL on failure. // Comments: // This function should be called before any form fill operation. // The FPDF_FORMFILLINFO passed in via |formInfo| must remain valid until // the returned FPDF_FORMHANDLE is closed. FPDF_EXPORT FPDF_FORMHANDLE FPDF_CALLCONV FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document, FPDF_FORMFILLINFO* formInfo); // Function: FPDFDOC_ExitFormFillEnvironment // Take ownership of |hHandle| and exit form fill environment. // Parameters: // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // Return Value: // None. // Comments: // This function is a no-op when |hHandle| is null. FPDF_EXPORT void FPDF_CALLCONV FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle); // Function: FORM_OnAfterLoadPage // This method is required for implementing all the form related // functions. Should be invoked after user successfully loaded a // PDF page, and FPDFDOC_InitFormFillEnvironment() has been invoked. // Parameters: // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // Return Value: // None. FPDF_EXPORT void FPDF_CALLCONV FORM_OnAfterLoadPage(FPDF_PAGE page, FPDF_FORMHANDLE hHandle); // Function: FORM_OnBeforeClosePage // This method is required for implementing all the form related // functions. Should be invoked before user closes the PDF page. // Parameters: // page - Handle to the page, as returned by FPDF_LoadPage(). // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // Return Value: // None. FPDF_EXPORT void FPDF_CALLCONV FORM_OnBeforeClosePage(FPDF_PAGE page, FPDF_FORMHANDLE hHandle); // Function: FORM_DoDocumentJSAction // This method is required for performing document-level JavaScript // actions. It should be invoked after the PDF document has been loaded. // Parameters: // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // Return Value: // None. // Comments: // If there is document-level JavaScript action embedded in the // document, this method will execute the JavaScript action. Otherwise, // the method will do nothing. FPDF_EXPORT void FPDF_CALLCONV FORM_DoDocumentJSAction(FPDF_FORMHANDLE hHandle); // Function: FORM_DoDocumentOpenAction // This method is required for performing open-action when the document // is opened. // Parameters: // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // Return Value: // None. // Comments: // This method will do nothing if there are no open-actions embedded // in the document. FPDF_EXPORT void FPDF_CALLCONV FORM_DoDocumentOpenAction(FPDF_FORMHANDLE hHandle); // Additional actions type of document: // WC, before closing document, JavaScript action. // WS, before saving document, JavaScript action. // DS, after saving document, JavaScript action. // WP, before printing document, JavaScript action. // DP, after printing document, JavaScript action. #define FPDFDOC_AACTION_WC … #define FPDFDOC_AACTION_WS … #define FPDFDOC_AACTION_DS … #define FPDFDOC_AACTION_WP … #define FPDFDOC_AACTION_DP … // Function: FORM_DoDocumentAAction // This method is required for performing the document's // additional-action. // Parameters: // hHandle - Handle to the form fill module. Returned by // FPDFDOC_InitFormFillEnvironment. // aaType - The type of the additional-actions which defined // above. // Return Value: // None. // Comments: // This method will do nothing if there is no document // additional-action corresponding to the specified |aaType|. FPDF_EXPORT void FPDF_CALLCONV FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle, int aaType); // Additional-action types of page object: // OPEN (/O) -- An action to be performed when the page is opened // CLOSE (/C) -- An action to be performed when the page is closed #define FPDFPAGE_AACTION_OPEN … #define FPDFPAGE_AACTION_CLOSE … // Function: FORM_DoPageAAction // This method is required for performing the page object's // additional-action when opened or closed. // Parameters: // page - Handle to the page, as returned by FPDF_LoadPage(). // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // aaType - The type of the page object's additional-actions // which defined above. // Return Value: // None. // Comments: // This method will do nothing if no additional-action corresponding // to the specified |aaType| exists. FPDF_EXPORT void FPDF_CALLCONV FORM_DoPageAAction(FPDF_PAGE page, FPDF_FORMHANDLE hHandle, int aaType); // Function: FORM_OnMouseMove // Call this member function when the mouse cursor moves. // Parameters: // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // page - Handle to the page, as returned by FPDF_LoadPage(). // modifier - Indicates whether various virtual keys are down. // page_x - Specifies the x-coordinate of the cursor in PDF user // space. // page_y - Specifies the y-coordinate of the cursor in PDF user // space. // Return Value: // True indicates success; otherwise false. FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnMouseMove(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, int modifier, double page_x, double page_y); // Experimental API // Function: FORM_OnMouseWheel // Call this member function when the user scrolls the mouse wheel. // Parameters: // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // page - Handle to the page, as returned by FPDF_LoadPage(). // modifier - Indicates whether various virtual keys are down. // page_coord - Specifies the coordinates of the cursor in PDF user // space. // delta_x - Specifies the amount of wheel movement on the x-axis, // in units of platform-agnostic wheel deltas. Negative // values mean left. // delta_y - Specifies the amount of wheel movement on the y-axis, // in units of platform-agnostic wheel deltas. Negative // values mean down. // Return Value: // True indicates success; otherwise false. // Comments: // For |delta_x| and |delta_y|, the caller must normalize // platform-specific wheel deltas. e.g. On Windows, a delta value of 240 // for a WM_MOUSEWHEEL event normalizes to 2, since Windows defines // WHEEL_DELTA as 120. FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnMouseWheel( FPDF_FORMHANDLE hHandle, FPDF_PAGE page, int modifier, const FS_POINTF* page_coord, int delta_x, int delta_y); // Function: FORM_OnFocus // This function focuses the form annotation at a given point. If the // annotation at the point already has focus, nothing happens. If there // is no annotation at the point, removes form focus. // Parameters: // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // page - Handle to the page, as returned by FPDF_LoadPage(). // modifier - Indicates whether various virtual keys are down. // page_x - Specifies the x-coordinate of the cursor in PDF user // space. // page_y - Specifies the y-coordinate of the cursor in PDF user // space. // Return Value: // True if there is an annotation at the given point and it has focus. FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnFocus(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, int modifier, double page_x, double page_y); // Function: FORM_OnLButtonDown // Call this member function when the user presses the left // mouse button. // Parameters: // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // page - Handle to the page, as returned by FPDF_LoadPage(). // modifier - Indicates whether various virtual keys are down. // page_x - Specifies the x-coordinate of the cursor in PDF user // space. // page_y - Specifies the y-coordinate of the cursor in PDF user // space. // Return Value: // True indicates success; otherwise false. FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnLButtonDown(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, int modifier, double page_x, double page_y); // Function: FORM_OnRButtonDown // Same as above, execpt for the right mouse button. // Comments: // At the present time, has no effect except in XFA builds, but is // included for the sake of symmetry. FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnRButtonDown(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, int modifier, double page_x, double page_y); // Function: FORM_OnLButtonUp // Call this member function when the user releases the left // mouse button. // Parameters: // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // page - Handle to the page, as returned by FPDF_LoadPage(). // modifier - Indicates whether various virtual keys are down. // page_x - Specifies the x-coordinate of the cursor in device. // page_y - Specifies the y-coordinate of the cursor in device. // Return Value: // True indicates success; otherwise false. FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnLButtonUp(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, int modifier, double page_x, double page_y); // Function: FORM_OnRButtonUp // Same as above, execpt for the right mouse button. // Comments: // At the present time, has no effect except in XFA builds, but is // included for the sake of symmetry. FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnRButtonUp(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, int modifier, double page_x, double page_y); // Function: FORM_OnLButtonDoubleClick // Call this member function when the user double clicks the // left mouse button. // Parameters: // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // page - Handle to the page, as returned by FPDF_LoadPage(). // modifier - Indicates whether various virtual keys are down. // page_x - Specifies the x-coordinate of the cursor in PDF user // space. // page_y - Specifies the y-coordinate of the cursor in PDF user // space. // Return Value: // True indicates success; otherwise false. FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnLButtonDoubleClick(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, int modifier, double page_x, double page_y); // Function: FORM_OnKeyDown // Call this member function when a nonsystem key is pressed. // Parameters: // hHandle - Handle to the form fill module, aseturned by // FPDFDOC_InitFormFillEnvironment(). // page - Handle to the page, as returned by FPDF_LoadPage(). // nKeyCode - The virtual-key code of the given key (see // fpdf_fwlevent.h for virtual key codes). // modifier - Mask of key flags (see fpdf_fwlevent.h for key // flag values). // Return Value: // True indicates success; otherwise false. FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnKeyDown(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, int nKeyCode, int modifier); // Function: FORM_OnKeyUp // Call this member function when a nonsystem key is released. // Parameters: // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // page - Handle to the page, as returned by FPDF_LoadPage(). // nKeyCode - The virtual-key code of the given key (see // fpdf_fwlevent.h for virtual key codes). // modifier - Mask of key flags (see fpdf_fwlevent.h for key // flag values). // Return Value: // True indicates success; otherwise false. // Comments: // Currently unimplemented and always returns false. PDFium reserves this // API and may implement it in the future on an as-needed basis. FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnKeyUp(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, int nKeyCode, int modifier); // Function: FORM_OnChar // Call this member function when a keystroke translates to a // nonsystem character. // Parameters: // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // page - Handle to the page, as returned by FPDF_LoadPage(). // nChar - The character code value itself. // modifier - Mask of key flags (see fpdf_fwlevent.h for key // flag values). // Return Value: // True indicates success; otherwise false. FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnChar(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, int nChar, int modifier); // Experimental API // Function: FORM_GetFocusedText // Call this function to obtain the text within the current focused // field, if any. // Parameters: // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // page - Handle to the page, as returned by FPDF_LoadPage(). // buffer - Buffer for holding the form text, encoded in // UTF-16LE. If NULL, |buffer| is not modified. // buflen - Length of |buffer| in bytes. If |buflen| is less // than the length of the form text string, |buffer| is // not modified. // Return Value: // Length in bytes for the text in the focused field. FPDF_EXPORT unsigned long FPDF_CALLCONV FORM_GetFocusedText(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, void* buffer, unsigned long buflen); // Function: FORM_GetSelectedText // Call this function to obtain selected text within a form text // field or form combobox text field. // Parameters: // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // page - Handle to the page, as returned by FPDF_LoadPage(). // buffer - Buffer for holding the selected text, encoded in // UTF-16LE. If NULL, |buffer| is not modified. // buflen - Length of |buffer| in bytes. If |buflen| is less // than the length of the selected text string, // |buffer| is not modified. // Return Value: // Length in bytes of selected text in form text field or form combobox // text field. FPDF_EXPORT unsigned long FPDF_CALLCONV FORM_GetSelectedText(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, void* buffer, unsigned long buflen); // Experimental API // Function: FORM_ReplaceAndKeepSelection // Call this function to replace the selected text in a form // text field or user-editable form combobox text field with another // text string (which can be empty or non-empty). If there is no // selected text, this function will append the replacement text after // the current caret position. After the insertion, the inserted text // will be selected. // Parameters: // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // page - Handle to the page, as Returned by FPDF_LoadPage(). // wsText - The text to be inserted, in UTF-16LE format. // Return Value: // None. FPDF_EXPORT void FPDF_CALLCONV FORM_ReplaceAndKeepSelection(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, FPDF_WIDESTRING wsText); // Function: FORM_ReplaceSelection // Call this function to replace the selected text in a form // text field or user-editable form combobox text field with another // text string (which can be empty or non-empty). If there is no // selected text, this function will append the replacement text after // the current caret position. After the insertion, the selection range // will be set to empty. // Parameters: // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // page - Handle to the page, as Returned by FPDF_LoadPage(). // wsText - The text to be inserted, in UTF-16LE format. // Return Value: // None. FPDF_EXPORT void FPDF_CALLCONV FORM_ReplaceSelection(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, FPDF_WIDESTRING wsText); // Experimental API // Function: FORM_SelectAllText // Call this function to select all the text within the currently focused // form text field or form combobox text field. // Parameters: // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // page - Handle to the page, as returned by FPDF_LoadPage(). // Return Value: // Whether the operation succeeded or not. FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_SelectAllText(FPDF_FORMHANDLE hHandle, FPDF_PAGE page); // Function: FORM_CanUndo // Find out if it is possible for the current focused widget in a given // form to perform an undo operation. // Parameters: // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // page - Handle to the page, as returned by FPDF_LoadPage(). // Return Value: // True if it is possible to undo. FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_CanUndo(FPDF_FORMHANDLE hHandle, FPDF_PAGE page); // Function: FORM_CanRedo // Find out if it is possible for the current focused widget in a given // form to perform a redo operation. // Parameters: // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // page - Handle to the page, as returned by FPDF_LoadPage(). // Return Value: // True if it is possible to redo. FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_CanRedo(FPDF_FORMHANDLE hHandle, FPDF_PAGE page); // Function: FORM_Undo // Make the current focused widget perform an undo operation. // Parameters: // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // page - Handle to the page, as returned by FPDF_LoadPage(). // Return Value: // True if the undo operation succeeded. FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_Undo(FPDF_FORMHANDLE hHandle, FPDF_PAGE page); // Function: FORM_Redo // Make the current focused widget perform a redo operation. // Parameters: // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // page - Handle to the page, as returned by FPDF_LoadPage(). // Return Value: // True if the redo operation succeeded. FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_Redo(FPDF_FORMHANDLE hHandle, FPDF_PAGE page); // Function: FORM_ForceToKillFocus. // Call this member function to force to kill the focus of the form // field which has focus. If it would kill the focus of a form field, // save the value of form field if was changed by theuser. // Parameters: // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // Return Value: // True indicates success; otherwise false. FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle); // Experimental API. // Function: FORM_GetFocusedAnnot. // Call this member function to get the currently focused annotation. // Parameters: // handle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // page_index - Buffer to hold the index number of the page which // contains the focused annotation. 0 for the first page. // Can't be NULL. // annot - Buffer to hold the focused annotation. Can't be NULL. // Return Value: // On success, return true and write to the out parameters. Otherwise // return false and leave the out parameters unmodified. // Comments: // Not currently supported for XFA forms - will report no focused // annotation. // Must call FPDFPage_CloseAnnot() when the annotation returned in |annot| // by this function is no longer needed. // This will return true and set |page_index| to -1 and |annot| to NULL, // if there is no focused annotation. FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_GetFocusedAnnot(FPDF_FORMHANDLE handle, int* page_index, FPDF_ANNOTATION* annot); // Experimental API. // Function: FORM_SetFocusedAnnot. // Call this member function to set the currently focused annotation. // Parameters: // handle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // annot - Handle to an annotation. // Return Value: // True indicates success; otherwise false. // Comments: // |annot| can't be NULL. To kill focus, use FORM_ForceToKillFocus() // instead. FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_SetFocusedAnnot(FPDF_FORMHANDLE handle, FPDF_ANNOTATION annot); // Form Field Types // The names of the defines are stable, but the specific values associated with // them are not, so do not hardcode their values. #define FPDF_FORMFIELD_UNKNOWN … #define FPDF_FORMFIELD_PUSHBUTTON … #define FPDF_FORMFIELD_CHECKBOX … #define FPDF_FORMFIELD_RADIOBUTTON … #define FPDF_FORMFIELD_COMBOBOX … #define FPDF_FORMFIELD_LISTBOX … #define FPDF_FORMFIELD_TEXTFIELD … #define FPDF_FORMFIELD_SIGNATURE … #ifdef PDF_ENABLE_XFA #define FPDF_FORMFIELD_XFA … #define FPDF_FORMFIELD_XFA_CHECKBOX … #define FPDF_FORMFIELD_XFA_COMBOBOX … #define FPDF_FORMFIELD_XFA_IMAGEFIELD … #define FPDF_FORMFIELD_XFA_LISTBOX … #define FPDF_FORMFIELD_XFA_PUSHBUTTON … #define FPDF_FORMFIELD_XFA_SIGNATURE … #define FPDF_FORMFIELD_XFA_TEXTFIELD … #endif // PDF_ENABLE_XFA #ifdef PDF_ENABLE_XFA #define FPDF_FORMFIELD_COUNT … #else // PDF_ENABLE_XFA #define FPDF_FORMFIELD_COUNT … #endif // PDF_ENABLE_XFA #ifdef PDF_ENABLE_XFA #define IS_XFA_FORMFIELD … #endif // PDF_ENABLE_XFA // Function: FPDFPage_HasFormFieldAtPoint // Get the form field type by point. // Parameters: // hHandle - Handle to the form fill module. Returned by // FPDFDOC_InitFormFillEnvironment(). // page - Handle to the page. Returned by FPDF_LoadPage(). // page_x - X position in PDF "user space". // page_y - Y position in PDF "user space". // Return Value: // Return the type of the form field; -1 indicates no field. // See field types above. FPDF_EXPORT int FPDF_CALLCONV FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, double page_x, double page_y); // Function: FPDFPage_FormFieldZOrderAtPoint // Get the form field z-order by point. // Parameters: // hHandle - Handle to the form fill module. Returned by // FPDFDOC_InitFormFillEnvironment(). // page - Handle to the page. Returned by FPDF_LoadPage(). // page_x - X position in PDF "user space". // page_y - Y position in PDF "user space". // Return Value: // Return the z-order of the form field; -1 indicates no field. // Higher numbers are closer to the front. FPDF_EXPORT int FPDF_CALLCONV FPDFPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, double page_x, double page_y); // Function: FPDF_SetFormFieldHighlightColor // Set the highlight color of the specified (or all) form fields // in the document. // Parameters: // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // doc - Handle to the document, as returned by // FPDF_LoadDocument(). // fieldType - A 32-bit integer indicating the type of a form // field (defined above). // color - The highlight color of the form field. Constructed by // 0xxxrrggbb. // Return Value: // None. // Comments: // When the parameter fieldType is set to FPDF_FORMFIELD_UNKNOWN, the // highlight color will be applied to all the form fields in the // document. // Please refresh the client window to show the highlight immediately // if necessary. FPDF_EXPORT void FPDF_CALLCONV FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle, int fieldType, unsigned long color); // Function: FPDF_SetFormFieldHighlightAlpha // Set the transparency of the form field highlight color in the // document. // Parameters: // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // doc - Handle to the document, as returaned by // FPDF_LoadDocument(). // alpha - The transparency of the form field highlight color, // between 0-255. // Return Value: // None. FPDF_EXPORT void FPDF_CALLCONV FPDF_SetFormFieldHighlightAlpha(FPDF_FORMHANDLE hHandle, unsigned char alpha); // Function: FPDF_RemoveFormFieldHighlight // Remove the form field highlight color in the document. // Parameters: // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // Return Value: // None. // Comments: // Please refresh the client window to remove the highlight immediately // if necessary. FPDF_EXPORT void FPDF_CALLCONV FPDF_RemoveFormFieldHighlight(FPDF_FORMHANDLE hHandle); // Function: FPDF_FFLDraw // Render FormFields and popup window on a page to a device independent // bitmap. // Parameters: // hHandle - Handle to the form fill module, as returned by // FPDFDOC_InitFormFillEnvironment(). // bitmap - Handle to the device independent bitmap (as the // output buffer). Bitmap handles can be created by // FPDFBitmap_Create(). // page - Handle to the page, as returned by FPDF_LoadPage(). // start_x - Left pixel position of the display area in the // device coordinates. // start_y - Top pixel position of the display area in the device // coordinates. // size_x - Horizontal size (in pixels) for displaying the page. // size_y - Vertical size (in pixels) for displaying the page. // rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees // clockwise), 2 (rotated 180 degrees), 3 (rotated 90 // degrees counter-clockwise). // flags - 0 for normal display, or combination of flags // defined above. // Return Value: // None. // Comments: // This function is designed to render annotations that are // user-interactive, which are widget annotations (for FormFields) and // popup annotations. // With the FPDF_ANNOT flag, this function will render a popup annotation // when users mouse-hover on a non-widget annotation. Regardless of // FPDF_ANNOT flag, this function will always render widget annotations // for FormFields. // In order to implement the FormFill functions, implementation should // call this function after rendering functions, such as // FPDF_RenderPageBitmap() or FPDF_RenderPageBitmap_Start(), have // finished rendering the page contents. FPDF_EXPORT void FPDF_CALLCONV FPDF_FFLDraw(FPDF_FORMHANDLE hHandle, FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y, int rotate, int flags); #if defined(PDF_USE_SKIA) FPDF_EXPORT void FPDF_CALLCONV FPDF_FFLDrawSkia(FPDF_FORMHANDLE hHandle, FPDF_SKIA_CANVAS canvas, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y, int rotate, int flags); #endif // Experimental API // Function: FPDF_GetFormType // Returns the type of form contained in the PDF document. // Parameters: // document - Handle to document. // Return Value: // Integer value representing one of the FORMTYPE_ values. // Comments: // If |document| is NULL, then the return value is FORMTYPE_NONE. FPDF_EXPORT int FPDF_CALLCONV FPDF_GetFormType(FPDF_DOCUMENT document); // Experimental API // Function: FORM_SetIndexSelected // Selects/deselects the value at the given |index| of the focused // annotation. // Parameters: // hHandle - Handle to the form fill module. Returned by // FPDFDOC_InitFormFillEnvironment. // page - Handle to the page. Returned by FPDF_LoadPage // index - 0-based index of value to be set as // selected/unselected // selected - true to select, false to deselect // Return Value: // TRUE if the operation succeeded. // FALSE if the operation failed or widget is not a supported type. // Comments: // Intended for use with listbox/combobox widget types. Comboboxes // have at most a single value selected at a time which cannot be // deselected. Deselect on a combobox is a no-op that returns false. // Default implementation is a no-op that will return false for // other types. // Not currently supported for XFA forms - will return false. FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_SetIndexSelected(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, int index, FPDF_BOOL selected); // Experimental API // Function: FORM_IsIndexSelected // Returns whether or not the value at |index| of the focused // annotation is currently selected. // Parameters: // hHandle - Handle to the form fill module. Returned by // FPDFDOC_InitFormFillEnvironment. // page - Handle to the page. Returned by FPDF_LoadPage // index - 0-based Index of value to check // Return Value: // TRUE if value at |index| is currently selected. // FALSE if value at |index| is not selected or widget is not a // supported type. // Comments: // Intended for use with listbox/combobox widget types. Default // implementation is a no-op that will return false for other types. // Not currently supported for XFA forms - will return false. FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_IsIndexSelected(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, int index); // Function: FPDF_LoadXFA // If the document consists of XFA fields, call this method to // attempt to load XFA fields. // Parameters: // document - Handle to document from FPDF_LoadDocument(). // Return Value: // TRUE upon success, otherwise FALSE. If XFA support is not built // into PDFium, performs no action and always returns FALSE. FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_LoadXFA(FPDF_DOCUMENT document); #ifdef __cplusplus } #endif #endif // PUBLIC_FPDF_FORMFILL_H_