Module pdfium_render::bindgen
source ·
[−]Re-exports
pub use self::_FPDF_DUPLEXTYPE_ as FPDF_DUPLEXTYPE;Structs
Structure for persisting a string beyond the duration of a callback. Note: although represented as a char*, string may be interpreted as a UTF-16LE formated string. Used only by XFA callbacks.
Struct for color scheme. Each should be a 32-bit value specifying the color, in 8888 ARGB format.
Structure for custom file access.
Structure for file reading or writing (I/O).
Process-wide options for initializing the library.
2D Point. Coordinate system agnostic.
Rectangle size. Coordinate system agnostic.
Matrix for transformation, in the form [a b c d e f], equivalent to: | a b 0 | | c d 0 | | e f 1 |
Rectangle area(float) in device or page coordinate system.
Define ‘max_align_t’ to match the GCC definition.
Constants
Functions
Function: FPDFBitmap_Create Create a device independent bitmap (FXDIB). Parameters: width - The number of pixels in width for the bitmap. Must be greater than 0. height - The number of pixels in height for the bitmap. Must be greater than 0. alpha - A flag indicating whether the alpha channel is used. Non-zero for using alpha, zero for not using. Return value: The created bitmap handle, or NULL if a parameter error or out of memory. Comments: The bitmap always uses 4 bytes per pixel. The first byte is always double word aligned.
Function: FPDFBitmap_CreateEx Create a device independent bitmap (FXDIB) Parameters: width - The number of pixels in width for the bitmap. Must be greater than 0. height - The number of pixels in height for the bitmap. Must be greater than 0. format - A number indicating for bitmap format, as defined above. first_scan - A pointer to the first byte of the first line if using an external buffer. If this parameter is NULL, then the a new buffer will be created. stride - Number of bytes for each scan line, for external buffer only. Return value: The bitmap handle, or NULL if parameter error or out of memory. Comments: Similar to FPDFBitmap_Create function, but allows for more formats and an external buffer is supported. The bitmap created by this function can be used in any place that a FPDF_BITMAP handle is required.
Function: FPDFBitmap_Destroy Destroy a bitmap and release all related buffers. Parameters: bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create or FPDFImageObj_GetBitmap. Return value: None. Comments: This function will not destroy any external buffers provided when the bitmap was created.
Function: FPDFBitmap_FillRect Fill a rectangle in a bitmap. Parameters: bitmap - The handle to the bitmap. Returned by FPDFBitmap_Create. left - The left position. Starting from 0 at the left-most pixel. top - The top position. Starting from 0 at the top-most line. width - Width in pixels to be filled. height - Height in pixels to be filled. color - A 32-bit value specifing the color, in 8888 ARGB format. Return value: None. Comments: This function sets the color and (optionally) alpha value in the specified region of the bitmap.
Function: FPDFBitmap_GetBuffer Get data buffer of a bitmap. Parameters: bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create or FPDFImageObj_GetBitmap. Return value: The pointer to the first byte of the bitmap buffer. Comments: The stride may be more than width * number of bytes per pixel
Function: FPDFBitmap_GetFormat Get the format of the bitmap. Parameters: bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create or FPDFImageObj_GetBitmap. Return value: The format of the bitmap. Comments: Only formats supported by FPDFBitmap_CreateEx are supported by this function; see the list of such formats above.
Function: FPDFBitmap_GetHeight Get height of a bitmap. Parameters: bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create or FPDFImageObj_GetBitmap. Return value: The height of the bitmap in pixels.
Function: FPDFBitmap_GetStride Get number of bytes for each line in the bitmap buffer. Parameters: bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create or FPDFImageObj_GetBitmap. Return value: The number of bytes for each line in the bitmap buffer. Comments: The stride may be more than width * number of bytes per pixel.
Function: FPDFBitmap_GetWidth Get width of a bitmap. Parameters: bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create or FPDFImageObj_GetBitmap. Return value: The width of the bitmap in pixels.
Function: FPDF_CloseDocument Close a loaded PDF document. Parameters: document - Handle to the loaded document. Return value: None.
Function: FPDF_ClosePage Close a loaded PDF page. Parameters: page - Handle to the loaded page. Return value: None.
Function: FPDF_CountNamedDests Get the count of named destinations in the PDF document. Parameters: document - Handle to a document Return value: The count of named destinations.
Function: FPDF_DestroyLibary Release all resources allocated by the FPDFSDK library. Parameters: None. Return value: None. Comments: You can call this function to release all memory blocks allocated by the library. After this function is called, you should not call any PDF processing functions.
Function: FPDF_DeviceToPage Convert the screen coordinates of a point to page coordinates. Parameters: page - Handle to the page. Returned by FPDF_LoadPage. start_x - Left pixel position of the display area in device coordinates. start_y - Top pixel position of the display area in 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) device_x - X value in device coordinates to be converted. device_y - Y value in device coordinates to be converted. page_x - A pointer to a double receiving the converted X value in page coordinates. page_y - A pointer to a double receiving the converted Y value in page coordinates. Return value: Returns true if the conversion succeeds, and |page_x| and |page_y| successfully receives the converted coordinates. Comments: The page coordinate system has its origin at the left-bottom corner of the page, with the X-axis on the bottom going to the right, and the Y-axis on the left side going up.
Experimental API. Function: FPDF_DocumentHasValidCrossReferenceTable Whether the document’s cross reference table is valid or not. Parameters: document - Handle to a document. Returned by FPDF_LoadDocument. Return value: True if the PDF parser did not encounter problems parsing the cross reference table. False if the parser could not parse the cross reference table and the table had to be rebuild from other data within the document. Comments: The return value can change over time as the PDF parser evolves.
Function: FPDF_GetDocPermission Get file permission flags of the document. Parameters: document - Handle to a document. Returned by FPDF_LoadDocument. Return value: A 32-bit integer indicating permission flags. Please refer to the PDF Reference for detailed descriptions. If the document is not protected, 0xffffffff will be returned.
Function: FPDF_GetFileVersion Get the file version of the given PDF document. Parameters: doc - Handle to a document. fileVersion - The PDF file version. File version: 14 for 1.4, 15 for 1.5, … Return value: True if succeeds, false otherwise. Comments: If the document was created by FPDF_CreateNewDocument, then this function will always fail.
Function: FPDF_GetLastError Get last error code when a function fails. Parameters: None. Return value: A 32-bit integer indicating error code as defined above. Comments: If the previous SDK call succeeded, the return value of this function is not defined.
Function: FPDF_GetNamedDest Get the named destination by index. Parameters: document - Handle to a document index - The index of a named destination. buffer - The buffer to store the destination name, used as wchar_t*. buflen [in/out] - Size of the buffer in bytes on input, length of the result in bytes on output or -1 if the buffer is too small. Return value: The destination handle for a given index, or NULL if there is no named destination corresponding to |index|. Comments: Call this function twice to get the name of the named destination: 1) First time pass in |buffer| as NULL and get buflen. 2) Second time pass in allocated |buffer| and buflen to retrieve |buffer|, which should be used as wchar_t*.
Function: FPDF_GetNamedDestByName Get a the destination handle for the given name. Parameters: document - Handle to the loaded document. name - The name of a destination. Return value: The handle to the destination.
Experimental API. Function: FPDF_GetPageBoundingBox Get the bounding box of the page. This is the intersection between its media box and its crop box. Parameters: page - Handle to the page. Returned by FPDF_LoadPage. rect - Pointer to a rect to receive the page bounding box. On an error, |rect| won’t be filled. Return value: True for success.
Function: FPDF_GetPageCount Get total number of pages in the document. Parameters: document - Handle to document. Returned by FPDF_LoadDocument. Return value: Total number of pages in the document.
Function: FPDF_GetPageHeight Get page height. Parameters: page - Handle to the page. Returned by FPDF_LoadPage. Return value: Page height (excluding non-displayable area) measured in points. One point is 1/72 inch (around 0.3528 mm) Note: Prefer FPDF_GetPageHeightF() above. This will be deprecated in the future.
Experimental API Function: FPDF_GetPageHeightF Get page height. Parameters: page - Handle to the page. Returned by FPDF_LoadPage(). Return value: Page height (excluding non-displayable area) measured in points. One point is 1/72 inch (around 0.3528 mm)
Function: FPDF_GetPageSizeByIndex Get the size of the page at the given index. Parameters: document - Handle to document. Returned by FPDF_LoadDocument. page_index - Page index, zero for the first page. width - Pointer to a double to receive the page width (in points). height - Pointer to a double to receive the page height (in points). Return value: Non-zero for success. 0 for error (document or page not found). Note: Prefer FPDF_GetPageSizeByIndexF() above. This will be deprecated in the future.
Experimental API. Function: FPDF_GetPageSizeByIndexF Get the size of the page at the given index. Parameters: document - Handle to document. Returned by FPDF_LoadDocument(). page_index - Page index, zero for the first page. size - Pointer to a FS_SIZEF to receive the page size. (in points). Return value: Non-zero for success. 0 for error (document or page not found).
Function: FPDF_GetPageWidth Get page width. Parameters: page - Handle to the page. Returned by FPDF_LoadPage. Return value: Page width (excluding non-displayable area) measured in points. One point is 1/72 inch (around 0.3528 mm). Note: Prefer FPDF_GetPageWidthF() above. This will be deprecated in the future.
Experimental API Function: FPDF_GetPageWidthF Get page width. Parameters: page - Handle to the page. Returned by FPDF_LoadPage(). Return value: Page width (excluding non-displayable area) measured in points. One point is 1/72 inch (around 0.3528 mm).
Function: FPDF_GetSecurityHandlerRevision Get the revision for the security handler. Parameters: document - Handle to a document. Returned by FPDF_LoadDocument. Return value: The security handler revision number. Please refer to the PDF Reference for a detailed description. If the document is not protected, -1 will be returned.
Experimental API. Function: FPDF_GetTrailerEnds Get the byte offsets of trailer ends. Parameters: document - Handle to document. Returned by FPDF_LoadDocument(). buffer - The address of a buffer that receives the byte offsets. length - The size, in ints, of |buffer|. Return value: Returns the number of ints in the buffer on success, 0 on error.
Experimental API. Function: FPDF_GetXFAPacketContent Get the content of a packet in the XFA array. Parameters: document - Handle to the document. index - Index number of the packet. 0 for the first packet. buffer - Buffer for holding the content of the XFA packet. buflen - Length of |buffer| in bytes. out_buflen - Pointer to the variable that will receive the minimum buffer size needed to contain the content of the XFA packet. Return value: Whether the operation succeeded or not.
Experimental API. Function: FPDF_GetXFAPacketCount Get the number of valid packets in the XFA entry. Parameters: document - Handle to the document. Return value: The number of valid packets, or -1 on error.
Experimental API. Function: FPDF_GetXFAPacketName Get the name of a packet in the XFA array. Parameters: document - Handle to the document. index - Index number of the packet. 0 for the first packet. buffer - Buffer for holding the name of the XFA packet. buflen - Length of |buffer| in bytes. Return value: The length of the packet name in bytes, or 0 on error.
Function: FPDF_InitLibrary Initialize the FPDFSDK library Parameters: None Return value: None. Comments: Convenience function to call FPDF_InitLibraryWithConfig() for backwards compatibility purposes. This will be deprecated in the future.
Function: FPDF_InitLibraryWithConfig Initialize the FPDFSDK library Parameters: config - configuration information as above. Return value: None. Comments: You have to call this function before you can call any PDF processing functions.
Function: FPDF_LoadCustomDocument Load PDF document from a custom access descriptor. Parameters: pFileAccess - A structure for accessing the file. password - Optional password for decrypting the PDF file. Return value: A handle to the loaded document, or NULL on failure. Comments: The application must keep the file resources |pFileAccess| points to valid until the returned FPDF_DOCUMENT is closed. |pFileAccess| itself does not need to outlive the FPDF_DOCUMENT.
Function: FPDF_LoadDocument Open and load a PDF document. Parameters: file_path - Path to the PDF file (including extension). password - A string used as the password for the PDF file. If no password is needed, empty or NULL can be used. See comments below regarding the encoding. Return value: A handle to the loaded document, or NULL on failure. Comments: Loaded document can be closed by FPDF_CloseDocument(). If this function fails, you can use FPDF_GetLastError() to retrieve the reason why it failed.
Function: FPDF_LoadMemDocument Open and load a PDF document from memory. Parameters: data_buf - Pointer to a buffer containing the PDF document. size - Number of bytes in the PDF document. password - A string used as the password for the PDF file. If no password is needed, empty or NULL can be used. Return value: A handle to the loaded document, or NULL on failure. Comments: The memory buffer must remain valid when the document is open. The loaded document can be closed by FPDF_CloseDocument. If this function fails, you can use FPDF_GetLastError() to retrieve the reason why it failed.
Experimental API. Function: FPDF_LoadMemDocument64 Open and load a PDF document from memory. Parameters: data_buf - Pointer to a buffer containing the PDF document. size - Number of bytes in the PDF document. password - A string used as the password for the PDF file. If no password is needed, empty or NULL can be used. Return value: A handle to the loaded document, or NULL on failure. Comments: The memory buffer must remain valid when the document is open. The loaded document can be closed by FPDF_CloseDocument. If this function fails, you can use FPDF_GetLastError() to retrieve the reason why it failed.
Function: FPDF_LoadPage Load a page inside the document. Parameters: document - Handle to document. Returned by FPDF_LoadDocument page_index - Index number of the page. 0 for the first page. Return value: A handle to the loaded page, or NULL if page load fails. Comments: The loaded page can be rendered to devices using FPDF_RenderPage. The loaded page can be closed using FPDF_ClosePage.
Function: FPDF_PageToDevice Convert the page coordinates of a point to screen coordinates. Parameters: page - Handle to the page. Returned by FPDF_LoadPage. start_x - Left pixel position of the display area in device coordinates. start_y - Top pixel position of the display area in 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) page_x - X value in page coordinates. page_y - Y value in page coordinate. device_x - A pointer to an integer receiving the result X value in device coordinates. device_y - A pointer to an integer receiving the result Y value in device coordinates. Return value: Returns true if the conversion succeeds, and |device_x| and |device_y| successfully receives the converted coordinates. Comments: See comments for FPDF_DeviceToPage().
Function: FPDF_RenderPageBitmap Render contents of a page to a device independent bitmap. Parameters: bitmap - Handle to the device independent bitmap (as the output buffer). The bitmap handle can be created by FPDFBitmap_Create or retrieved from an image object by FPDFImageObj_GetBitmap. page - Handle to the page. Returned by FPDF_LoadPage start_x - Left pixel position of the display area in bitmap coordinates. start_y - Top pixel position of the display area in bitmap 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 the Page Rendering flags defined above. With the FPDF_ANNOT flag, it renders all annotations that do not require user-interaction, which are all annotations except widget and popup annotations. Return value: None.
Function: FPDF_RenderPageBitmapWithMatrix Render contents of a page to a device independent bitmap. Parameters: bitmap - Handle to the device independent bitmap (as the output buffer). The bitmap handle can be created by FPDFBitmap_Create or retrieved by FPDFImageObj_GetBitmap. page - Handle to the page. Returned by FPDF_LoadPage. matrix - The transform matrix, which must be invertible. See PDF Reference 1.7, 4.2.2 Common Transformations. clipping - The rect to clip to in device coords. flags - 0 for normal display, or combination of the Page Rendering flags defined above. With the FPDF_ANNOT flag, it renders all annotations that do not require user-interaction, which are all annotations except widget and popup annotations. Return value: None. Note that behavior is undefined if det of |matrix| is 0.
Function: FPDF_SetSandBoxPolicy Set the policy for the sandbox environment. Parameters: policy - The specified policy for setting, for example: FPDF_POLICY_MACHINETIME_ACCESS. enable - True to enable, false to disable the policy. Return value: None.
Function: FPDF_VIEWERREF_GetDuplex Returns the paper handling option to be used when printing from the print dialog. Parameters: document - Handle to the loaded document. Return value: The paper handling option to be used when printing.
Function: FPDF_VIEWERREF_GetName Gets the contents for a viewer ref, with a given key. The value must be of type “name”. Parameters: document - Handle to the loaded document. key - Name of the key in the viewer pref dictionary, encoded in UTF-8. buffer - A string to write the contents of the key to. length - Length of the buffer. Return value: The number of bytes in the contents, including the NULL terminator. Thus if the return value is 0, then that indicates an error, such as when |document| is invalid or |buffer| is NULL. If |length| is less than the returned length, or |buffer| is NULL, |buffer| will not be modified.
Function: FPDF_VIEWERREF_GetNumCopies Returns the number of copies to be printed. Parameters: document - Handle to the loaded document. Return value: The number of copies to be printed.
Function: FPDF_VIEWERREF_GetPrintPageRange Page numbers to initialize print dialog box when file is printed. Parameters: document - Handle to the loaded document. Return value: The print page range to be used for printing.
Experimental API. Function: FPDF_VIEWERREF_GetPrintPageRangeCount Returns the number of elements in a FPDF_PAGERANGE. Parameters: pagerange - Handle to the page range. Return value: The number of elements in the page range. Returns 0 on error.
Experimental API. Function: FPDF_VIEWERREF_GetPrintPageRangeElement Returns an element from a FPDF_PAGERANGE. Parameters: pagerange - Handle to the page range. index - Index of the element. Return value: The value of the element in the page range at a given index. Returns -1 on error.
Function: FPDF_VIEWERREF_GetPrintScaling Whether the PDF document prefers to be scaled or not. Parameters: document - Handle to the loaded document. Return value: None.
Type Definitions
PDF types - use incomplete types (never completed) to force API type safety.
Annotation enums.
Basic data types
Structure for persisting a string beyond the duration of a callback. Note: although represented as a char*, string may be interpreted as a UTF-16LE formated string. Used only by XFA callbacks.
FPDFSDK may use three types of strings: byte string, wide string (UTF-16LE encoded), and platform dependent string
Struct for color scheme. Each should be a 32-bit value specifying the color, in 8888 ARGB format.
Structure for file reading or writing (I/O).
Process-wide options for initializing the library.
Dictionary value types.
For Windows programmers: In most cases it’s OK to treat FPDF_WIDESTRING as a Windows unicode string, however, special care needs to be taken if you expect to process Unicode larger than 0xffff.
PDF text rendering modes
String types
FPDFSDK always uses UTF-16LE encoded wide strings, each character uses 2 bytes (except surrogation), with the low byte first.
Const Pointer to FS_POINTF structure.
Const Pointer to FS_RECTF structure.
Const Pointer to FS_SIZEF structure.
2D Point. Coordinate system agnostic.
Rectangle area(float) in device or page coordinate system.
Rectangle size. Coordinate system agnostic.
Matrix for transformation, in the form [a b c d e f], equivalent to: | a b 0 | | c d 0 | | e f 1 |
2D Point. Coordinate system agnostic.
Rectangle area(float) in device or page coordinate system.
Rectangle size. Coordinate system agnostic.
Duplex types
