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

📄 pdflib.h

📁 将TXT文件转换成PDF文件,从CODEPROJECTS网站上得来的,很好用!
💻 H
📖 第 1 页 / 共 2 页
字号:
/*---------------------------------------------------------------------------* |              PDFlib - A library for generating PDF on the fly             | +---------------------------------------------------------------------------+ | Copyright (c) 1997-2002 PDFlib GmbH and Thomas Merz. All rights reserved. | +---------------------------------------------------------------------------+ |    This software is NOT in the public domain.  It can be used under two   | |    substantially different licensing terms:                               | |                                                                           | |    The commercial license is available for a fee, and allows you to       | |    - ship a commercial product based on PDFlib                            | |    - implement commercial Web services with PDFlib                        | |    - distribute (free or commercial) software when the source code is     | |      not made available                                                   | |    Details can be found in the file PDFlib-license.pdf.                   | |                                                                           | |    The "Aladdin Free Public License" doesn't require any license fee,     | |    and allows you to                                                      | |    - develop and distribute PDFlib-based software for which the complete  | |      source code is made available                                        | |    - redistribute PDFlib non-commercially under certain conditions        | |    - redistribute PDFlib on digital media for a fee if the complete       | |      contents of the media are freely redistributable                     | |    Details can be found in the file aladdin-license.pdf.                  | |                                                                           | |    These conditions extend to ports to other programming languages.       | |    PDFlib is distributed with no warranty of any kind. Commercial users,  | |    however, will receive warranty and support statements in writing.      | *---------------------------------------------------------------------------*//* $Id: pdflib.h,v 1.39.2.11 2002/01/23 15:40:42 rjs Exp $ * * PDFlib public function and constant declarations * */#ifndef PDFLIB_H#define PDFLIB_H/*  * ---------------------------------------------------------------------- * Setup, mostly Windows calling conventions and DLL stuff * ---------------------------------------------------------------------- */#include <stdio.h>#ifdef WIN32#define PDFLIB_CALL	__cdecl#ifdef PDFLIB_EXPORTS#define PDFLIB_API __declspec(dllexport) /* prepare a DLL (internal use only) */#elif defined(PDFLIB_DLL)#define PDFLIB_API __declspec(dllimport) /* PDFlib clients: import PDFlib DLL */#else	/* !PDFLIB_DLL */	#define PDFLIB_API /* */	/* default: generate or use static library */#endif	/* !PDFLIB_DLL */#else	/* !WIN32 */#if ((defined __IBMC__ || defined __IBMCPP__) && defined __DLL__ && defined OS2)    #define PDFLIB_CALL _Export    #define PDFLIB_API#endif	/* IBM VisualAge C++ DLL */#ifndef PDFLIB_CALL#define PDFLIB_CALL#endif#ifndef PDFLIB_API#define PDFLIB_API#endif#endif	/* !WIN32 *//* Make our declarations C++ compatible */#ifdef __cplusplusextern "C" {#endif/* Define the basic PDF type. This is used opaquely at the API level. */typedef struct PDF_s PDF;/*  * ---------------------------------------------------------------------- * p_basic.c: general functions * ---------------------------------------------------------------------- *//* * The version defines below may be used to check the version of the * include file against the library. *//* do not change this (version.sh will do it for you :) */#define PDFLIB_MAJORVERSION	4	/* PDFlib major version number */#define PDFLIB_MINORVERSION	0	/* PDFlib minor version number */#define PDFLIB_REVISION		2	/* PDFlib revision number */#define PDFLIB_VERSIONSTRING	"4.0.2"	/* The whole bunch *//* * Allow for the external and internal float type to be easily redefined. * This is only for special applications which require improved accuracy, * and not supported in the general case due to platform and binary * compatibility issues.*//* #define float double *//* Returns the PDFlib major version number. */PDFLIB_API int PDFLIB_CALLPDF_get_majorversion(void);/* Returns the PDFlib minor version number. */PDFLIB_API int PDFLIB_CALLPDF_get_minorversion(void);/* Boot PDFlib (recommended although currently not required). */PDFLIB_API void PDFLIB_CALLPDF_boot(void);/* Shut down PDFlib (recommended although currently not required). */PDFLIB_API void PDFLIB_CALLPDF_shutdown(void);/* Create a new PDF object with client-supplied error handling and memory allocation routines. */typedef void  (*errorproc_t)(PDF *p1, int type, const char *msg);typedef void* (*allocproc_t)(PDF *p2, size_t size, const char *caller);typedef void* (*reallocproc_t)(PDF *p3,		void *mem, size_t size, const char *caller);typedef void  (*freeproc_t)(PDF *p4, void *mem);PDFLIB_API PDF * PDFLIB_CALLPDF_new2(errorproc_t errorhandler, allocproc_t allocproc,	reallocproc_t reallocproc, freeproc_t freeproc, void *opaque);/* Fetch opaque application pointer stored in PDFlib (for multi-threading). */PDFLIB_API void * PDFLIB_CALLPDF_get_opaque(PDF *p);/* Create a new PDF object, using default error handling and memory management. */PDFLIB_API PDF * PDFLIB_CALLPDF_new(void);/* Delete the PDF object, and free all internal resources. */PDFLIB_API void PDFLIB_CALLPDF_delete(PDF *p);/* Create a new PDF file using the supplied file name. */PDFLIB_API int PDFLIB_CALLPDF_open_file(PDF *p, const char *filename);/* Open a new PDF file associated with p, using the supplied file handle. */PDFLIB_API int PDFLIB_CALLPDF_open_fp(PDF *p, FILE *fp);/* Open a new PDF in memory, and install a callback for fetching the data. */typedef size_t (*writeproc_t)(PDF *p1, void *data, size_t size);PDFLIB_API void PDFLIB_CALLPDF_open_mem(PDF *p, writeproc_t writeproc);/* Close the generated PDF file, and release all document-related resources. */PDFLIB_API void PDFLIB_CALLPDF_close(PDF *p);/* Add a new page to the document. */PDFLIB_API void PDFLIB_CALLPDF_begin_page(PDF *p, float width, float height);/* Finish the page. */PDFLIB_API void PDFLIB_CALLPDF_end_page(PDF *p);/* PDFlib exceptions which may be handled by a user-supplied error handler */#define PDF_MemoryError    1#define PDF_IOError        2#define PDF_RuntimeError   3#define PDF_IndexError     4#define PDF_TypeError      5#define PDF_DivisionByZero 6#define PDF_OverflowError  7#define PDF_SyntaxError    8#define PDF_ValueError     9#define PDF_SystemError   10#define PDF_NonfatalError 11#define PDF_UnknownError  12/*  * ---------------------------------------------------------------------- * p_params.c: parameter handling * ---------------------------------------------------------------------- *//* Set some PDFlib parameter with string type. */PDFLIB_API void PDFLIB_CALLPDF_set_parameter(PDF *p, const char *key, const char *value);/* Set the value of some PDFlib parameter with float type. */PDFLIB_API void PDFLIB_CALLPDF_set_value(PDF *p, const char *key, float value);/* Get the contents of some PDFlib parameter with string type. */PDFLIB_API const char * PDFLIB_CALLPDF_get_parameter(PDF *p, const char *key, float modifier);/* Get the value of some PDFlib parameter with float type. */PDFLIB_API float PDFLIB_CALLPDF_get_value(PDF *p, const char *key, float modifier);/*  * ---------------------------------------------------------------------- * p_font.c: text and font handling * ---------------------------------------------------------------------- *//* Search a font, and prepare it for later use.  The metrics will be loaded, and if embed is nonzero, the font file will be checked, but not yet used. Encoding is one of "builtin", "macroman", "winansi", "host", or a user-defined encoding name, or the name of a CMap. */PDFLIB_API int PDFLIB_CALLPDF_findfont(PDF *p, const char *fontname, const char *encoding, int embed);/* Set the current font in the given size, using a font handle returned by PDF_findfont(). */PDFLIB_API void PDFLIB_CALLPDF_setfont(PDF *p, int font, float fontsize);/* Request a glyph name from a custom encoding (unsupported). */PDFLIB_API const char * PDFLIB_CALLPDF_encoding_get_name(PDF *p, const char *encoding, int slot);/*  * ---------------------------------------------------------------------- * p_text.c: text output * ---------------------------------------------------------------------- *//* Print text in the current font and size at the current position. */PDFLIB_API void PDFLIB_CALLPDF_show(PDF *p, const char *text);/* Print text in the current font at (x, y). */PDFLIB_API void PDFLIB_CALLPDF_show_xy(PDF *p, const char *text, float x, float y);/* Print text at the next line. The spacing between lines is determined by the "leading" parameter. */PDFLIB_API void PDFLIB_CALLPDF_continue_text(PDF *p, const char *text);/* Format text in the current font and size into the supplied text box according to the requested formatting mode, which must be one of "left", "right", "center", "justify", or "fulljustify". If width and height are 0, only a single line is placed at the point (left, top) in the requested mode. */PDFLIB_API int PDFLIB_CALLPDF_show_boxed(PDF *p, const char *text, float left, float top,    float width, float height, const char *hmode, const char *feature);/* This function is unsupported, and not considered part of the PDFlib API! */PDFLIB_API void PDFLIB_CALLPDF_set_text_matrix(PDF *p,    float a, float b, float c, float d, float e, float f);/* Set the text output position. */PDFLIB_API void PDFLIB_CALLPDF_set_text_pos(PDF *p, float x, float y);/* Return the width of text in an arbitrary font. */PDFLIB_API float PDFLIB_CALLPDF_stringwidth(PDF *p, const char *text, int font, float size);/* Function duplicates with explicit string length for use with strings containing null characters. These are for C and C++ clients only,but are used internally for the other language bindings. *//* Same as PDF_show() but with explicit string length. */PDFLIB_API void PDFLIB_CALLPDF_show2(PDF *p, const char *text, int len);/* Same as PDF_show_xy() but with explicit string length. */PDFLIB_API void PDFLIB_CALLPDF_show_xy2(PDF *p, const char *text, int len, float x, float y);/* Same as PDF_continue_text but with explicit string length. */PDFLIB_API void PDFLIB_CALLPDF_continue_text2(PDF *p, const char *text, int len);/* Same as PDF_stringwidth but with explicit string length. */PDFLIB_API float PDFLIB_CALLPDF_stringwidth2(PDF *p, const char *text, int len, int font, float size);/*  * ---------------------------------------------------------------------- * p_gstate.c: graphics state * ---------------------------------------------------------------------- *//* Maximum length of dash arrays */#define MAX_DASH_LENGTH	8/* Set the current dash pattern to b black and w white units. */PDFLIB_API void PDFLIB_CALLPDF_setdash(PDF *p, float b, float w);/* Set a more complicated dash pattern defined by an array. */PDFLIB_API void PDFLIB_CALLPDF_setpolydash(PDF *p, float *dasharray, int length);/* Set the flatness to a value between 0 and 100 inclusive. */PDFLIB_API void PDFLIB_CALLPDF_setflat(PDF *p, float flatness);/* Set the line join parameter to a value between 0 and 2 inclusive. */PDFLIB_API void PDFLIB_CALLPDF_setlinejoin(PDF *p, int linejoin);/* Set the linecap parameter to a value between 0 and 2 inclusive. */PDFLIB_API void PDFLIB_CALLPDF_setlinecap(PDF *p, int linecap);/* Set the miter limit to a value greater than or equal to 1. */PDFLIB_API void PDFLIB_CALLPDF_setmiterlimit(PDF *p, float miter);/* Set the current linewidth to width. */PDFLIB_API void PDFLIB_CALLPDF_setlinewidth(PDF *p, float width);/* Reset all color and graphics state parameters to their defaults. */PDFLIB_API void PDFLIB_CALLPDF_initgraphics(PDF *p);/* Save the current graphics state. */PDFLIB_API void PDFLIB_CALLPDF_save(PDF *p);/* Restore the most recently saved graphics state. */PDFLIB_API void PDFLIB_CALLPDF_restore(PDF *p);/* Translate the origin of the coordinate system. */PDFLIB_API void PDFLIB_CALLPDF_translate(PDF *p, float tx, float ty);/* Scale the coordinate system. */PDFLIB_API void PDFLIB_CALLPDF_scale(PDF *p, float sx, float sy);/* Rotate the coordinate system by phi degrees. */PDFLIB_API void PDFLIB_CALLPDF_rotate(PDF *p, float phi);/* Skew the coordinate system in x and y direction by alpha and beta degrees. */PDFLIB_API void PDFLIB_CALLPDF_skew(PDF *p, float alpha, float beta);/* Concatenate a matrix to the current transformation matrix. */PDFLIB_API void PDFLIB_CALL

⌨️ 快捷键说明

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