⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fpdfview.h

📁 Foxit Reader DLL开发的示例软件。可以很方便地实现自己的pdf viewer.
💻 H
📖 第 1 页 / 共 3 页
字号:
//			The number of bytes for each scan line in the bitmap buffer.
DLLEXPORT int STDCALL FPDFBitmap_GetStride(FPDF_BITMAP bitmap);

// Function: FPDFBitmap_Destroy
//			Destroy an FXDIB and release all related buffers 
// Parameters:
//			bitmap		-	Handle to the bitmap. Returned by FPDFBitmap_Create function.
// Return value:
//			None.
// Comments:
//			This function will not destroy any external buffer.
//
DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap);

// Function: FPDF_AllocMemory
//			Allocated memory block in FPDFVIEW SDK. This memory can be freed by FPDF_FreeMemory function.
// Parameters:
//			size		-	Byte size of requested memory block. Can not be zero.
// Return value:
//			The allocated pointer. NULL if memory not available.
// Comments:
//			Some FPDFVIEW interface may require application to allocate memory for internal use of
//			FPDFVIEW. In this case application must call this function to allocate memory, don't
//			use malloc() or other memory allocator.
//			If an error handler installed and exception/long jump is used in the out of memory handling,
//			this function might never return if no memory available.
//
DLLEXPORT void* STDCALL FPDF_AllocMemory(unsigned long size);

// Function: FPDF_FreeMemory
//			Free a memory area allocated by Foxit SDK.
// Parameters:
//			p		-	The pointer. Should not be NULL.
// Return value:
//			None.
// Comments:
//			In case FPDFVIEW SDK allocated some memory for user application, the user application
//			must free it to avoid memory leakage. And the application must call FPDF_FreeMemory
//			function to do that. Do NOT use c/c++ memory free() function or other similar functions.
DLLEXPORT void STDCALL FPDF_FreeMemory(void* p);

#define FPDFERR_OUT_OF_MEMORY		1		// Out of memory. The error handler should quit the application,
											// or use long jump to get out of current rendering.
#define FPDFERR_MISSING_FEATURE		2		// Missing PDF feature. The error handler can safely continue
											// with other rendering.

typedef void (*FPDF_ErrorHandler)(int code, FPDF_BYTESTRING msg);

// Function: FPDF_SetErrorHandler
//			Set a call back function when FPDFVIEW SDK has some error to report
// Parameters:
//			func	-	Pointer to the error handler function
// Return value:
//			None.
// Comments:
//			Currently only two error codes are defined (see above).
//
DLLEXPORT void STDCALL FPDF_SetErrorHandler(FPDF_ErrorHandler func);

// Funcion: FPDF_SetModuleFolder
//			Set the folder path for module files (like the FPDFCJK.BIN)
// Parameters;
//			module_name	-	Name of the module. Currently please use NULL (0) only
//			folder_name	-	Name of the folder. For example: "C:\\program files\\FPDFVIEW"
// Return value:
//			None.
DLLEXPORT void STDCALL FPDF_SetModulePath(FPDF_STRING module_name, FPDF_STRING folder_name);

// Structure: FPDF_GLYPHPROVIDER
//			Define an interface for generating glyph bitmaps.
//			This interface does not exist on desktop Windows system. But on alternative systems,
//			including mobile system, this interface must be implemented in order to display
//			non-embedded non-western fonts, like Chinese/Japanese/Korean characters.
//			To make use of a glyph provider, call FPDF_SetGlyphProvider function.
typedef struct {
	// Interface: MapFont
	//		Map a font with particular name. The implementation can return any pointer to some
	//		internal font structure. Or it can return NULL if font mapping not supported (like if 
	//		there is only one font available in the system).
	//		The result of this interface function will be passed back to other interface functions
	//		as "font handle".
	// Parameters:
	//		name		-	The single byte encoded name of the font. It might be a MBCS encoded name.
	//		codepage	-	The Windows code page identifier for the font, indicating the primary character set
	//						of the font. Currently it can be one of the followings:
	//						0	-	unknown character set
	//						932	-	Japanese character set
	//						936	-	Simplified Chinese character set
	//						949	-	Korean character set
	//						950	-	Traditional character set
	//						1200-	Unicode character set
	void*	(*MapFont)(FPDF_BYTESTRING name, int codepage);

	// Interface: GetGlyphBBox
	//		Get bounding box of a glyph. The boundaries are measured in PDF font units, which is
	//		1/1000 of the em size. For example, if a character's top boundary is at half of the em square,
	//		then the top value should be 500.
	//		It's OK to return a box larger than the actual bounding box of the character. So some 
	//		implementation may just return a fixed bounding box for all glyphs. But returning a 
	//		box smaller than the actually bounding box will cause some problem like during scrolling.
	// Parameters:
	//		font		-	The font handle returned by MapFont interface.
	//		unicode		-	The unicode of the character
	//		cid			-	The CID code (see Adobe CID specifications) of the character. 0 if not available.
	//						For most characters, implementation can ignore this parameter. However, if precise
	//						display of CJK characters is required, some special CID (like half width/full width,
	//						rotated, etc) needs special handling.
	//		left		-	[OUT] Pointer to returned left boundary
	//		top			-	[OUT] Pointer to returned top boundary
	//		right		-	[OUT] Pointer to returned right boundary
	//		bottom		-	[OUT] Pointer to returned bottom boundary
	void	(*GetGlyphBBox)(void* font, int unicode, int cid, int* left, int* top, int* right, int* bottom);

	// Interface: GetGlyphBitmap
	//		This interface is the main interface for getting glyph bitmaps. The input include font handle,
	//		unicode and CID code, font size, then the implementation should allocate a sufficient buffer
	//		to hold the grayscale bitmap for the character, and return its position (relative to origin
	//		of the character), size, buffer, and stride to FPDFVIEW.
	//		FPDFVIEW then will use the returned bitmap and position information to display the glyph.
	// Parameters:
	//		font		-	The font handle returned by MapFont interface.
	//		unicode		-	The unicode of the character
	//		cid			-	The CID code of the character. See comments in GetCharBBox interface.
	//		size		-	The font size (size for em square).
	//		left		-	[OUT] Pointer to left offset of the bitmap, from the character origin.
	//						Negative means the bitmap should move to left of the origin,
	//						positive means the bitmap should move to right side of the origin.
	//		top			-	[OUT] Pointer to top offset of the bitmap, from the character origin.
	//						Negative means the bitmap should move downward from the origin,
	//						positive means the bitmap should move to upward from the origin.
	//		width		-	[OUT] Pointer to output width (number of pixels per scanline)
	//		height		-	[OUT] Pointer to output height (number of scanlines)
	//		buffer		-	[OUT] Pointer to another pointer which points to a buffer containing the
	//						glyph bitmap. This buffer must be allocated by FPDF_AllocMemory function. 
	//						This buffer must contain scanlines of the bitmap from top to bottom.
	//						Each byte in the buffer represent a pixel of the glyph, 0 means not inside
	//						the glyph, 255 means fully inside the glyph. Implementation can also use
	//						gray scale (between 0-255) to identify pixels on the border of the glyph.
	//						Implementation doesn't need to free the buffer, FPDFVIEW will do that.
	//		stride		-	[OUT] Pointer to output stride (number of bytes per scanline in the buffer).
	// Return value:
	//		Implementation should return non-zero if success, 0 if error happens (like character not found).
	int		(*GetGlyphBitmap)(void* font, int unicode, int cid, double size, int* left, int* top, 
							int* width, int* height, void** buffer, int* stride);
} FPDF_GLYPHPROVIDER;

// Function: FPDF_SetGlyphProvider
//			Make use of a custom glyph bitmap provider.
//			Not available on Desktop Windows system.
// Parameters:
//			pProvider	-	Pointer to a provider structure. This structure must be available all the time
//							(better put it in static data). And all member interfaces of this structure
//							should be properly set and implemented.
// Return value:
//			None.
DLLEXPORT void STDCALL FPDF_SetGlyphProvider(FPDF_GLYPHPROVIDER* pProvider);

// Function: FPDF_SetSystemFontFile
//			Make use of a system font. The font file must be in TrueType or Type1 format and must be
//			encoded in a standard encoding system.
//			Available for embedded Linux system only.
// Parameters:
//			file_path	-	The full path of the font file.
// Return value:
//			Non-zero for success. Zero for error.
//
DLLEXPORT int STDCALL FPDF_SetSystemFontFile(FPDF_BYTESTRING file_path);

#ifdef _WIN32_WCE

// Structure: FPDF_WCEFONTMAPPER
//			For Windows Mobile Only:
//			An interface for mapping PDF fonts to system fonts on Windows mobile.
//			Used for Chinese/Japanese/Korean fonts only.
//			By default, FPDFVIEW picks the system default font for particular character sets. If your 
//			system has more than one fonts installed for a particular character set, you can build a 
//			font mapper structure and call FPDF_SetWCEFontMapper function to set to FPDFVIEW engine. 
//			This will allow FPDFVIEW to pick different fonts for different styles.
//
typedef struct {
	// Interface: MapFontId
	//		Get a font identifier number for a particular font, from its name and character set.
	//		If the system supports more than one font for a particular character set, the implementation
	//		should assign different identifier number for each of the fonts supported. For example,
	//		assign 0 to the default font, 1 for an alternative font, etc.
	// Parameters:
	//		name		-	Zero-terminated byte string name for the font. This is the name used in
	//						PDF document. The implementation can analyze the name and try to figure out
	//						font style. For example, if the name contains "Gothic", it indicates a bold 
	//						style in Japanese font.
	//		charset		-	Windows charset identifier, like GB2312_CHARSET, SHIFTJIS_CHARSET. See
	//						MSDN document for CreateFont function.
	// Return value:
	//		An identifier number between 0 and 255 (within one byte range).
	//		FPDFVIEW will use this return value in GetFontById interface.
	//
	int (*MapFontId)(FPDF_BYTESTRING name, int charset);

	// Interface: GetFontById
	//		Get face name of the font by its identifier (returned by MapFontId interface).
	// Parameters:
	//		buffer		-	An output buffer used to hold unicode name of the font face. It must be
	//						terminated by NULL character (unicode 0).
	//		size		-	Size of the buffer (number of characters, including the terminator)
	//		charset		-	Windows charset identifier, like GB2312_CHARSET, SHIFTJIS_CHARSET. See
	//						MSDN document for CreateFont function.
	//		font_id		-	The font id returned by MapFontId interface.
	// Return value:
	//		None.
	//
	void (*GetFontById)(unsigned short* buffer, int size, int charset, int font_id);
} FPDF_WCEFONTMAPPER;

// Function: FPDF_SetWCEFontMapper
//			For Windows Mobile Only: make use of a font mapper for CJK charsets.
//			This function should be called before page rendering.
// Parameters:
//			mapper		-	Pointer to the mapper structure.
// Return value:
//			None.
//
DLLEXPORT void STDCALL FPDF_SetWCEFontMapper(FPDF_WCEFONTMAPPER* mapper);

#endif	// _WIN32_WCE

#ifdef __cplusplus
};
#endif

#endif // _FPDFVIEW_H_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -