📄 fpdfview.h
字号:
// page_index - Page index, zero for the first page.
// width - Pointer to a double value receiving the page width (in points)
// height - Pointer to a double value receiving the page height (in points)
// Return value:
// Non-zero for success. 0 for error (document or page not found).
//
DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, int page_index, double* width, double* height);
// Page rendering flags. They can be combined with bit OR
#define FPDF_ANNOT 0x01 // Set if annotations are to be rendered
#define FPDF_LCD_TEXT 0x02 // Set if using text rendering optimized for LCD display
#define FPDF_NO_GDIPLUS 0x04 // Set if you don't want to use GDI+ (for fast rendering with poorer graphic quality)
// Applicable to desktop Windows systems only.
#define FPDF_DEBUG_INFO 0x80 // Set if you want to get some debug info.
// Please discuss with Foxit first if you need to collect debug info.
#ifdef _WIN32
// Function: FPDF_RenderPage
// Render contents in a page to a device (screen, bitmap, or printer)
// This function is only supported on Windows system
// Parameters:
// dc - Handle to device context.
// page - Handle to the page. Returned by FPDF_LoadPage function.
// start_x - Left pixel position of the display area in the device coordination
// start_y - Top pixel position of the display area in the device coordination
// 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.
//
DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y,
int rotate, int flags);
#endif
// Function: FPDF_RenderPageBitmap
// Render contents in a page to a device independant bitmap
// Parameters:
// bitmap - Handle to the device independant bitmap (as the output buffer).
// Bitmap handle can be created by FPDFBitmap_Create function.
// page - Handle to the page. Returned by FPDF_LoadPage function.
// start_x - Left pixel position of the display area in the device coordination
// start_y - Top pixel position of the display area in the device coordination
// 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.
//
DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y,
int size_x, int size_y, int rotate, int flags);
// Function: FPDF_LoadDocument
// Close a loaded PDF page.
// Parameters:
// page - Handle to the loaded page
// Return value:
// None.
//
DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page);
// Function: FPDF_CloseDocument
// Close a loaded PDF document.
// Parameters:
// document - Handle to the loaded document
// Return value:
// None.
//
DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document);
// Function: FPDF_DeviceToPage
// Convert the screen coordinations of a point to page coordinations.
// Parameters:
// page - Handle to the page. Returned by FPDF_LoadPage function.
// start_x - Left pixel position of the display area in the device coordination
// start_y - Top pixel position of the display area in the device coordination
// 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 coordination, for the point to be converted
// device_y - Y value in device coordination, for the point to be converted
// page_x - Pointer to a double value receiving the converted X value in page coordination
// page_y - Pointer to a double value receiving the converted Y value in page coordination
// Return value:
// None.
// Comments:
// The page coordination system has its origin at left-bottom corner of the page, with X axis goes along
// the bottom side to the right, and Y axis goes along the left side upward. NOTE: this coordination system
// can be altered when you zoom, scroll, or rotate a page, however, a point on the page should always have
// the same coordination values in the page coordination system.
//
// The device coordination system is device dependant. For screen device, its origin is at left-top
// corner of the window. However this origin can be altered by Windows coordination transformation
// utilities. You must make sure the start_x, start_y, size_x, size_y and rotate parameters have exactly
// same values as you used in FPDF_RenderPage() function call.
//
DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y,
int rotate, int device_x, int device_y, double* page_x, double* page_y);
// Function: FPDF_PageToDevice
// Convert the screen coordinations of a point to page coordinations.
// Parameters:
// page - Handle to the page. Returned by FPDF_LoadPage function.
// start_x - Left pixel position of the display area in the device coordination
// start_y - Top pixel position of the display area in the device coordination
// 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 coordination, for the point to be converted
// page_y - Y value in page coordination, for the point to be converted
// device_x - Point to an integer value receiving the result X value in device coordination.
// device_y - Point to an integer value receiving the result Y value in device coordination.
// Return value:
// None
// Comments:
// See comments of FPDF_DeviceToPage() function.
//
DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y,
int rotate, double page_x, double page_y, int* device_x, int* device_y);
// Fucntion: FPDFBitmap_Create
// Create a Foxit Device Independant Bitmap (FXDIB)
// Parameters:
// width - Number of pixels in a horizontal line of the bitmap. Must be greater than 0.
// height - Number of pixels in a vertical line of the bitmap. Must be greater than 0.
// alpha - A flag indicating whether alpha channel is used. Non-zero for using alpha, zero for not using.
// Return value:
// The created bitmap handle, or NULL if parameter error or out of memory.
// Comments:
// An FXDIB always use 4 byte per pixel. The first byte of a pixel is always double word aligned.
// Each pixel contains red (R), green (G), blue (B) and optionally alpha (A) values.
// The byte order is BGRx (the last byte unused if no alpha channel) or BGRA.
//
// The pixels in a horizontal line (also called scan line) are stored side by side, with left most
// pixel stored first (with lower memory address). Each scan line uses width*4 bytes.
//
// Scan lines are stored one after another, with top most scan line stored first. There is no gap
// between adjacent scan lines.
//
// This function allocates enough memory for holding all pixels in the bitmap, but it doesn't
// initialize the buffer. Applications can use FPDFBitmap_FillRect to fill the bitmap using any color.
DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width, int height, int alpha);
// More DIB formats
#define FPDFBitmap_Gray 1 // Gray scale bitmap, one byte per pixel
#define FPDFBitmap_BGR 2 // 3 bytes per pixel, byte order: blue, green, red
#define FPDFBitmap_BGRx 3 // 4 bytes per pixel, byte order: blue, green, red, unused
#define FPDFBitmap_BGRA 4 // 4 bytes per pixel, byte order: blue, green, red, alpha
// Fucntion: FPDFBitmap_CreateEx
// Create a Foxit Device Independant Bitmap (FXDIB)
// Parameters:
// width - Number of pixels in a horizontal line of the bitmap. Must be greater than 0.
// height - Number of pixels in a vertical line of the bitmap. Must be greater than 0.
// format - A number indicating for bitmap format, as defined above
// first_scan - A pointer pointing to the first byte of first scan line, for external buffer
// only. If this parameter is NULL, then the SDK will create its own buffer.
// stride - Number of bytes for each scan line, for external buffer only..
// Return value:
// The created bitmap handle, or NULL if parameter error or out of memory.
// Comments:
// Similar to FPDFBitmap_Create function, with more formats and external buffer supported.
// Bitmap created by this function can be used in any place that a FPDF_BITMAP handle is
// required.
//
// If external scanline buffer is used, then the application should destroy the buffer
// by itself. FPDFBitmap_Destroy function will not destroy the buffer.
//
DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, int height, int format, void* first_scan, int stride);
// Fucntion: FPDFBitmap_FillRect
// Fill a rectangle area in an FXDIB
// Parameters:
// bitmap - The handle to the bitmap. Returned by FPDFBitmap_Create function.
// left - The left side position. Starting from 0 at the left-most pixel.
// top - The top side position. Starting from 0 at the top-most scan line.
// width - Number of pixels to be filled in each scan line.
// height - Number of scan lines to be filled.
// red - A number from 0 to 255, identifying the red intensity
// green - A number from 0 to 255, identifying the green intensity
// blue - A number from 0 to 255, identifying the blue intensity
// alpha - (Only if the alpha channeled is used when bitmap created) A number from 0 to 255,
// identifying the alpha value.
// Return value:
// None
// Comments:
// This function set the color and (optionally) alpha value in specified region of the bitmap.
// NOTE: If alpha channel is used, this function does NOT composite the background with the source color,
// instead the background will be replaced by the source color and alpha.
// If alpha channel is not used, the "alpha" parameter is ignored.
//
DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, int left, int top, int width, int height,
int red, int green, int blue, int alpha);
// Function: FPDFBitmap_GetBuffer
// Get data buffer of an FXDIB
// Parameters:
// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create function.
// Return value:
// The pointer to the first byte of the bitmap buffer.
// Comments:
// Applications can use this function to get the bitmap buffer pointer, then manipulate any color
// and/or alpha values for any pixels in the bitmap.
DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap);
// Function: FPDFBitmap_GetWidth
// Get width of an FXDIB
// Parameters:
// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create function.
// Return value:
// The number of pixels in a horizontal line of the bitmap.
DLLEXPORT int STDCALL FPDFBitmap_GetWidth(FPDF_BITMAP bitmap);
// Function: FPDFBitmap_GetHeight
// Get height of an FXDIB
// Parameters:
// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create function.
// Return value:
// The number of pixels in a vertical line of the bitmap.
DLLEXPORT int STDCALL FPDFBitmap_GetHeight(FPDF_BITMAP bitmap);
// Function: FPDFBitmap_GetStride
// Get number of bytes for each scan line in the bitmap buffer
// Parameters:
// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create function.
// Return value:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -