pdflib.h
上传用户:lqriiqpl
上传日期:2022-07-04
资源大小:258k
文件大小:25k
源码类别:

文件操作

开发平台:

Visual C++

  1. /*---------------------------------------------------------------------------*
  2.  |              PDFlib - A library for generating PDF on the fly             |
  3.  +---------------------------------------------------------------------------+
  4.  | Copyright (c) 1997-2002 PDFlib GmbH and Thomas Merz. All rights reserved. |
  5.  +---------------------------------------------------------------------------+
  6.  |    This software is NOT in the public domain.  It can be used under two   |
  7.  |    substantially different licensing terms:                               |
  8.  |                                                                           |
  9.  |    The commercial license is available for a fee, and allows you to       |
  10.  |    - ship a commercial product based on PDFlib                            |
  11.  |    - implement commercial Web services with PDFlib                        |
  12.  |    - distribute (free or commercial) software when the source code is     |
  13.  |      not made available                                                   |
  14.  |    Details can be found in the file PDFlib-license.pdf.                   |
  15.  |                                                                           |
  16.  |    The "Aladdin Free Public License" doesn't require any license fee,     |
  17.  |    and allows you to                                                      |
  18.  |    - develop and distribute PDFlib-based software for which the complete  |
  19.  |      source code is made available                                        |
  20.  |    - redistribute PDFlib non-commercially under certain conditions        |
  21.  |    - redistribute PDFlib on digital media for a fee if the complete       |
  22.  |      contents of the media are freely redistributable                     |
  23.  |    Details can be found in the file aladdin-license.pdf.                  |
  24.  |                                                                           |
  25.  |    These conditions extend to ports to other programming languages.       |
  26.  |    PDFlib is distributed with no warranty of any kind. Commercial users,  |
  27.  |    however, will receive warranty and support statements in writing.      |
  28.  *---------------------------------------------------------------------------*/
  29. /* $Id: pdflib.h,v 1.39.2.11 2002/01/23 15:40:42 rjs Exp $
  30.  *
  31.  * PDFlib public function and constant declarations
  32.  *
  33.  */
  34. #ifndef PDFLIB_H
  35. #define PDFLIB_H
  36. /* 
  37.  * ----------------------------------------------------------------------
  38.  * Setup, mostly Windows calling conventions and DLL stuff
  39.  * ----------------------------------------------------------------------
  40.  */
  41. #include <stdio.h>
  42. #ifdef WIN32
  43. #define PDFLIB_CALL __cdecl
  44. #ifdef PDFLIB_EXPORTS
  45. #define PDFLIB_API __declspec(dllexport) /* prepare a DLL (internal use only) */
  46. #elif defined(PDFLIB_DLL)
  47. #define PDFLIB_API __declspec(dllimport) /* PDFlib clients: import PDFlib DLL */
  48. #else /* !PDFLIB_DLL */
  49. #define PDFLIB_API /* */ /* default: generate or use static library */
  50. #endif /* !PDFLIB_DLL */
  51. #else /* !WIN32 */
  52. #if ((defined __IBMC__ || defined __IBMCPP__) && defined __DLL__ && defined OS2)
  53.     #define PDFLIB_CALL _Export
  54.     #define PDFLIB_API
  55. #endif /* IBM VisualAge C++ DLL */
  56. #ifndef PDFLIB_CALL
  57. #define PDFLIB_CALL
  58. #endif
  59. #ifndef PDFLIB_API
  60. #define PDFLIB_API
  61. #endif
  62. #endif /* !WIN32 */
  63. /* Make our declarations C++ compatible */
  64. #ifdef __cplusplus
  65. extern "C" {
  66. #endif
  67. /* Define the basic PDF type. This is used opaquely at the API level. */
  68. typedef struct PDF_s PDF;
  69. /* 
  70.  * ----------------------------------------------------------------------
  71.  * p_basic.c: general functions
  72.  * ----------------------------------------------------------------------
  73.  */
  74. /*
  75.  * The version defines below may be used to check the version of the
  76.  * include file against the library.
  77.  */
  78. /* do not change this (version.sh will do it for you :) */
  79. #define PDFLIB_MAJORVERSION 4 /* PDFlib major version number */
  80. #define PDFLIB_MINORVERSION 0 /* PDFlib minor version number */
  81. #define PDFLIB_REVISION 2 /* PDFlib revision number */
  82. #define PDFLIB_VERSIONSTRING "4.0.2" /* The whole bunch */
  83. /*
  84.  * Allow for the external and internal float type to be easily redefined.
  85.  * This is only for special applications which require improved accuracy,
  86.  * and not supported in the general case due to platform and binary
  87.  * compatibility issues.
  88. */
  89. /* #define float double */
  90. /* Returns the PDFlib major version number. */
  91. PDFLIB_API int PDFLIB_CALL
  92. PDF_get_majorversion(void);
  93. /* Returns the PDFlib minor version number. */
  94. PDFLIB_API int PDFLIB_CALL
  95. PDF_get_minorversion(void);
  96. /* Boot PDFlib (recommended although currently not required). */
  97. PDFLIB_API void PDFLIB_CALL
  98. PDF_boot(void);
  99. /* Shut down PDFlib (recommended although currently not required). */
  100. PDFLIB_API void PDFLIB_CALL
  101. PDF_shutdown(void);
  102. /* Create a new PDF object with client-supplied error handling and memory
  103.  allocation routines. */
  104. typedef void  (*errorproc_t)(PDF *p1, int type, const char *msg);
  105. typedef void* (*allocproc_t)(PDF *p2, size_t size, const char *caller);
  106. typedef void* (*reallocproc_t)(PDF *p3,
  107. void *mem, size_t size, const char *caller);
  108. typedef void  (*freeproc_t)(PDF *p4, void *mem);
  109. PDFLIB_API PDF * PDFLIB_CALL
  110. PDF_new2(errorproc_t errorhandler, allocproc_t allocproc,
  111. reallocproc_t reallocproc, freeproc_t freeproc, void *opaque);
  112. /* Fetch opaque application pointer stored in PDFlib (for multi-threading). */
  113. PDFLIB_API void * PDFLIB_CALL
  114. PDF_get_opaque(PDF *p);
  115. /* Create a new PDF object, using default error handling and memory
  116.  management. */
  117. PDFLIB_API PDF * PDFLIB_CALL
  118. PDF_new(void);
  119. /* Delete the PDF object, and free all internal resources. */
  120. PDFLIB_API void PDFLIB_CALL
  121. PDF_delete(PDF *p);
  122. /* Create a new PDF file using the supplied file name. */
  123. PDFLIB_API int PDFLIB_CALL
  124. PDF_open_file(PDF *p, const char *filename);
  125. /* Open a new PDF file associated with p, using the supplied file handle. */
  126. PDFLIB_API int PDFLIB_CALL
  127. PDF_open_fp(PDF *p, FILE *fp);
  128. /* Open a new PDF in memory, and install a callback for fetching the data. */
  129. typedef size_t (*writeproc_t)(PDF *p1, void *data, size_t size);
  130. PDFLIB_API void PDFLIB_CALL
  131. PDF_open_mem(PDF *p, writeproc_t writeproc);
  132. /* Close the generated PDF file, and release all document-related resources. */
  133. PDFLIB_API void PDFLIB_CALL
  134. PDF_close(PDF *p);
  135. /* Add a new page to the document. */
  136. PDFLIB_API void PDFLIB_CALL
  137. PDF_begin_page(PDF *p, float width, float height);
  138. /* Finish the page. */
  139. PDFLIB_API void PDFLIB_CALL
  140. PDF_end_page(PDF *p);
  141. /* PDFlib exceptions which may be handled by a user-supplied error handler */
  142. #define PDF_MemoryError    1
  143. #define PDF_IOError        2
  144. #define PDF_RuntimeError   3
  145. #define PDF_IndexError     4
  146. #define PDF_TypeError      5
  147. #define PDF_DivisionByZero 6
  148. #define PDF_OverflowError  7
  149. #define PDF_SyntaxError    8
  150. #define PDF_ValueError     9
  151. #define PDF_SystemError   10
  152. #define PDF_NonfatalError 11
  153. #define PDF_UnknownError  12
  154. /* 
  155.  * ----------------------------------------------------------------------
  156.  * p_params.c: parameter handling
  157.  * ----------------------------------------------------------------------
  158.  */
  159. /* Set some PDFlib parameter with string type. */
  160. PDFLIB_API void PDFLIB_CALL
  161. PDF_set_parameter(PDF *p, const char *key, const char *value);
  162. /* Set the value of some PDFlib parameter with float type. */
  163. PDFLIB_API void PDFLIB_CALL
  164. PDF_set_value(PDF *p, const char *key, float value);
  165. /* Get the contents of some PDFlib parameter with string type. */
  166. PDFLIB_API const char * PDFLIB_CALL
  167. PDF_get_parameter(PDF *p, const char *key, float modifier);
  168. /* Get the value of some PDFlib parameter with float type. */
  169. PDFLIB_API float PDFLIB_CALL
  170. PDF_get_value(PDF *p, const char *key, float modifier);
  171. /* 
  172.  * ----------------------------------------------------------------------
  173.  * p_font.c: text and font handling
  174.  * ----------------------------------------------------------------------
  175.  */
  176. /* Search a font, and prepare it for later use.  The metrics will be
  177.  loaded, and if embed is nonzero, the font file will be checked, but not
  178.  yet used. Encoding is one of "builtin", "macroman", "winansi", "host", or
  179.  a user-defined encoding name, or the name of a CMap. */
  180. PDFLIB_API int PDFLIB_CALL
  181. PDF_findfont(PDF *p, const char *fontname, const char *encoding, int embed);
  182. /* Set the current font in the given size, using a font handle returned by
  183.  PDF_findfont(). */
  184. PDFLIB_API void PDFLIB_CALL
  185. PDF_setfont(PDF *p, int font, float fontsize);
  186. /* Request a glyph name from a custom encoding (unsupported). */
  187. PDFLIB_API const char * PDFLIB_CALL
  188. PDF_encoding_get_name(PDF *p, const char *encoding, int slot);
  189. /* 
  190.  * ----------------------------------------------------------------------
  191.  * p_text.c: text output
  192.  * ----------------------------------------------------------------------
  193.  */
  194. /* Print text in the current font and size at the current position. */
  195. PDFLIB_API void PDFLIB_CALL
  196. PDF_show(PDF *p, const char *text);
  197. /* Print text in the current font at (x, y). */
  198. PDFLIB_API void PDFLIB_CALL
  199. PDF_show_xy(PDF *p, const char *text, float x, float y);
  200. /* Print text at the next line. The spacing between lines is determined by
  201.  the "leading" parameter. */
  202. PDFLIB_API void PDFLIB_CALL
  203. PDF_continue_text(PDF *p, const char *text);
  204. /* Format text in the current font and size into the supplied text box
  205.  according to the requested formatting mode, which must be one of
  206.  "left", "right", "center", "justify", or "fulljustify". If width and height
  207.  are 0, only a single line is placed at the point (left, top) in the
  208.  requested mode. */
  209. PDFLIB_API int PDFLIB_CALL
  210. PDF_show_boxed(PDF *p, const char *text, float left, float top,
  211.     float width, float height, const char *hmode, const char *feature);
  212. /* This function is unsupported, and not considered part of the PDFlib API! */
  213. PDFLIB_API void PDFLIB_CALL
  214. PDF_set_text_matrix(PDF *p,
  215.     float a, float b, float c, float d, float e, float f);
  216. /* Set the text output position. */
  217. PDFLIB_API void PDFLIB_CALL
  218. PDF_set_text_pos(PDF *p, float x, float y);
  219. /* Return the width of text in an arbitrary font. */
  220. PDFLIB_API float PDFLIB_CALL
  221. PDF_stringwidth(PDF *p, const char *text, int font, float size);
  222. /* Function duplicates with explicit string length for use with 
  223. strings containing null characters. These are for C and C++ clients only,
  224. but are used internally for the other language bindings. */
  225. /* Same as PDF_show() but with explicit string length. */
  226. PDFLIB_API void PDFLIB_CALL
  227. PDF_show2(PDF *p, const char *text, int len);
  228. /* Same as PDF_show_xy() but with explicit string length. */
  229. PDFLIB_API void PDFLIB_CALL
  230. PDF_show_xy2(PDF *p, const char *text, int len, float x, float y);
  231. /* Same as PDF_continue_text but with explicit string length. */
  232. PDFLIB_API void PDFLIB_CALL
  233. PDF_continue_text2(PDF *p, const char *text, int len);
  234. /* Same as PDF_stringwidth but with explicit string length. */
  235. PDFLIB_API float PDFLIB_CALL
  236. PDF_stringwidth2(PDF *p, const char *text, int len, int font, float size);
  237. /* 
  238.  * ----------------------------------------------------------------------
  239.  * p_gstate.c: graphics state
  240.  * ----------------------------------------------------------------------
  241.  */
  242. /* Maximum length of dash arrays */
  243. #define MAX_DASH_LENGTH 8
  244. /* Set the current dash pattern to b black and w white units. */
  245. PDFLIB_API void PDFLIB_CALL
  246. PDF_setdash(PDF *p, float b, float w);
  247. /* Set a more complicated dash pattern defined by an array. */
  248. PDFLIB_API void PDFLIB_CALL
  249. PDF_setpolydash(PDF *p, float *dasharray, int length);
  250. /* Set the flatness to a value between 0 and 100 inclusive. */
  251. PDFLIB_API void PDFLIB_CALL
  252. PDF_setflat(PDF *p, float flatness);
  253. /* Set the line join parameter to a value between 0 and 2 inclusive. */
  254. PDFLIB_API void PDFLIB_CALL
  255. PDF_setlinejoin(PDF *p, int linejoin);
  256. /* Set the linecap parameter to a value between 0 and 2 inclusive. */
  257. PDFLIB_API void PDFLIB_CALL
  258. PDF_setlinecap(PDF *p, int linecap);
  259. /* Set the miter limit to a value greater than or equal to 1. */
  260. PDFLIB_API void PDFLIB_CALL
  261. PDF_setmiterlimit(PDF *p, float miter);
  262. /* Set the current linewidth to width. */
  263. PDFLIB_API void PDFLIB_CALL
  264. PDF_setlinewidth(PDF *p, float width);
  265. /* Reset all color and graphics state parameters to their defaults. */
  266. PDFLIB_API void PDFLIB_CALL
  267. PDF_initgraphics(PDF *p);
  268. /* Save the current graphics state. */
  269. PDFLIB_API void PDFLIB_CALL
  270. PDF_save(PDF *p);
  271. /* Restore the most recently saved graphics state. */
  272. PDFLIB_API void PDFLIB_CALL
  273. PDF_restore(PDF *p);
  274. /* Translate the origin of the coordinate system. */
  275. PDFLIB_API void PDFLIB_CALL
  276. PDF_translate(PDF *p, float tx, float ty);
  277. /* Scale the coordinate system. */
  278. PDFLIB_API void PDFLIB_CALL
  279. PDF_scale(PDF *p, float sx, float sy);
  280. /* Rotate the coordinate system by phi degrees. */
  281. PDFLIB_API void PDFLIB_CALL
  282. PDF_rotate(PDF *p, float phi);
  283. /* Skew the coordinate system in x and y direction by alpha and beta degrees. */
  284. PDFLIB_API void PDFLIB_CALL
  285. PDF_skew(PDF *p, float alpha, float beta);
  286. /* Concatenate a matrix to the current transformation matrix. */
  287. PDFLIB_API void PDFLIB_CALL
  288. PDF_concat(PDF *p, float a, float b, float c, float d, float e, float f);
  289. /* Explicitly set the current transformation matrix. */
  290. PDFLIB_API void PDFLIB_CALL
  291. PDF_setmatrix(PDF *p, float a, float b, float c, float d, float e, float f);
  292. /* 
  293.  * ----------------------------------------------------------------------
  294.  * p_draw.c: path construction, painting, and clipping
  295.  * ----------------------------------------------------------------------
  296.  */
  297. /* Set the current point. */
  298. PDFLIB_API void PDFLIB_CALL
  299. PDF_moveto(PDF *p, float x, float y);
  300. /* Draw a line from the current point to (x, y). */
  301. PDFLIB_API void PDFLIB_CALL
  302. PDF_lineto(PDF *p, float x, float y);
  303. /* Draw a Bezier curve from the current point, using 3 more control points. */
  304. PDFLIB_API void PDFLIB_CALL
  305. PDF_curveto(PDF *p, float x1, float y1, float x2, float y2, float x3, float y3);
  306. /* Draw a circle with center (x, y) and radius r. */
  307. PDFLIB_API void PDFLIB_CALL
  308. PDF_circle(PDF *p, float x, float y, float r);
  309. /* Draw a counterclockwise circular arc from alpha to beta degrees. */
  310. PDFLIB_API void PDFLIB_CALL
  311. PDF_arc(PDF *p, float x, float y, float r, float alpha, float beta);
  312. /* Draw a clockwise circular arc from alpha to beta degrees. */
  313. PDFLIB_API void PDFLIB_CALL
  314. PDF_arcn(PDF *p, float x, float y, float r, float alpha, float beta);
  315. /* Draw a rectangle at lower left (x, y) with width and height. */
  316. PDFLIB_API void PDFLIB_CALL
  317. PDF_rect(PDF *p, float x, float y, float width, float height);
  318. /* Close the current path. */
  319. PDFLIB_API void PDFLIB_CALL
  320. PDF_closepath(PDF *p);
  321. /* Stroke the path with the current color and line width, and clear it. */
  322. PDFLIB_API void PDFLIB_CALL
  323. PDF_stroke(PDF *p);
  324. /* Close the path, and stroke it. */
  325. PDFLIB_API void PDFLIB_CALL
  326. PDF_closepath_stroke(PDF *p);
  327. /* Fill the interior of the path with the current fill color. */
  328. PDFLIB_API void PDFLIB_CALL
  329. PDF_fill(PDF *p);
  330. /* Fill and stroke the path with the current fill and stroke color. */
  331. PDFLIB_API void PDFLIB_CALL
  332. PDF_fill_stroke(PDF *p);
  333. /* Close the path, fill, and stroke it. */
  334. PDFLIB_API void PDFLIB_CALL
  335. PDF_closepath_fill_stroke(PDF *p);
  336. /* Deprecated, use one of the stroke, fill, or clip functions instead. */
  337. PDFLIB_API void PDFLIB_CALL
  338. PDF_endpath(PDF *p);
  339. /* Use the current path as clipping path. */
  340. PDFLIB_API void PDFLIB_CALL
  341. PDF_clip(PDF *p);
  342. /* 
  343.  * ----------------------------------------------------------------------
  344.  * p_color.c: color handling
  345.  * ----------------------------------------------------------------------
  346.  */
  347. /* Deprecated, use PDF_setcolor(p, "fill", "gray", g, 0, 0, 0) instead. */
  348. PDFLIB_API void PDFLIB_CALL
  349. PDF_setgray_fill(PDF *p, float gray);
  350. /* Deprecated, use PDF_setcolor(p, "stroke", "gray", g, 0, 0, 0) instead. */
  351. PDFLIB_API void PDFLIB_CALL
  352. PDF_setgray_stroke(PDF *p, float gray);
  353. /* Deprecated, use PDF_setcolor(p, "both", "gray", g, 0, 0, 0) instead. */
  354. PDFLIB_API void PDFLIB_CALL
  355. PDF_setgray(PDF *p, float gray);
  356. /* Deprecated, use PDF_setcolor(p, "fill", "rgb", red, green, blue, 0). */
  357. PDFLIB_API void PDFLIB_CALL
  358. PDF_setrgbcolor_fill(PDF *p, float red, float green, float blue);
  359. /* Deprecated, use PDF_setcolor(p, "stroke", "rgb", red, green, blue, 0). */
  360. PDFLIB_API void PDFLIB_CALL
  361. PDF_setrgbcolor_stroke(PDF *p, float red, float green, float blue);
  362. /* Deprecated, use PDF_setcolor(p, "both", "rgb", red, green, blue, 0). */
  363. PDFLIB_API void PDFLIB_CALL
  364. PDF_setrgbcolor(PDF *p, float red, float green, float blue);
  365. /* Make a named spot color from the current color. */
  366. PDFLIB_API int PDFLIB_CALL
  367. PDF_makespotcolor(PDF *p, const char *spotname, int len);
  368. /* Set the current color space and color. type is "fill", "stroke", or "both".*/
  369. PDFLIB_API void PDFLIB_CALL
  370. PDF_setcolor(PDF *p, const char *fstype, const char *colorspace,
  371.     float c1, float c2, float c3, float c4);
  372. /*
  373.  * ----------------------------------------------------------------------
  374.  * p_pattern.c: pattern definition
  375.  * ----------------------------------------------------------------------
  376.  */
  377. /* Start a new pattern definition. */
  378. PDFLIB_API int PDFLIB_CALL
  379. PDF_begin_pattern(PDF *p,
  380.     float width, float height, float xstep, float ystep, int painttype);
  381. /* Finish a pattern definition. */
  382. PDFLIB_API void PDFLIB_CALL
  383. PDF_end_pattern(PDF *p);
  384. /*
  385.  * ----------------------------------------------------------------------
  386.  * p_template.c: template definition
  387.  * ----------------------------------------------------------------------
  388.  */
  389. /* Start a new template definition. */
  390. PDFLIB_API int PDFLIB_CALL
  391. PDF_begin_template(PDF *p, float width, float height);
  392. /* Finish a template definition. */
  393. PDFLIB_API void PDFLIB_CALL
  394. PDF_end_template(PDF *p);
  395. /* 
  396.  * ----------------------------------------------------------------------
  397.  * p_image.c: image handling
  398.  * ----------------------------------------------------------------------
  399.  */
  400. /* Place an image or template with the lower left corner at (x, y),
  401.  and scale it. */
  402. PDFLIB_API void PDFLIB_CALL
  403. PDF_place_image(PDF *p, int image, float x, float y, float scale);
  404. /* Use image data from a variety of data sources. Supported types are
  405.  "jpeg", "ccitt", "raw". Supported sources are "memory", "fileref", "url".
  406.  len is only used for type="raw", params is only used for type="ccitt". */
  407. PDFLIB_API int PDFLIB_CALL
  408. PDF_open_image(PDF *p, const char *imagetype, const char *source,
  409.     const char *data, long length, int width, int height, int components,
  410.     int bpc, const char *params);
  411. /* Open an image file. Supported types are "jpeg", "tiff", "gif", and "png"
  412.  stringparam is either "", "mask", "masked", or "page". intparam is either 0,
  413.  the image number of the applied mask, or the page. */
  414. PDFLIB_API int PDFLIB_CALL
  415. PDF_open_image_file(PDF *p, const char *imagetype, const char *filename,
  416.     const char *stringparam, int intparam);
  417. /* Close an image retrieved with one of the PDF_open_image*() functions. */
  418. PDFLIB_API void PDFLIB_CALL
  419. PDF_close_image(PDF *p, int image);
  420. /* Add an existing image as thumbnail for the current page. */
  421. PDFLIB_API void PDFLIB_CALL
  422. PDF_add_thumbnail(PDF *p, int image);
  423. /* 
  424.  * ----------------------------------------------------------------------
  425.  * p_ccitt.c: fax-compressed data processing
  426.  * ----------------------------------------------------------------------
  427.  */
  428. /* Open a raw CCITT image. */
  429. PDFLIB_API int PDFLIB_CALL
  430. PDF_open_CCITT(PDF *p, const char *filename, int width, int height,
  431.     int BitReverse, int K, int BlackIs1);
  432. /* 
  433.  * ----------------------------------------------------------------------
  434.  * p_hyper.c: bookmarks and document info fields
  435.  * ----------------------------------------------------------------------
  436.  */
  437. /* Add a nested bookmark under parent, or a new top-level bookmark if
  438.  parent = 0. Returns a bookmark descriptor which may be
  439.  used as parent for subsequent nested bookmarks. If open = 1, child
  440.  bookmarks will be folded out, and invisible if open = 0. */
  441. PDFLIB_API int PDFLIB_CALL
  442. PDF_add_bookmark(PDF *p, const char *text, int parent, int open);
  443. /* Fill document information field key with value. key is one of "Subject",
  444.  "Title", "Creator", "Author", "Keywords", or a user-defined key. */
  445. PDFLIB_API void PDFLIB_CALL
  446. PDF_set_info(PDF *p, const char *key, const char *value);
  447. /* 
  448.  * ----------------------------------------------------------------------
  449.  * p_annots.c: file attachments, notes, and links
  450.  * ----------------------------------------------------------------------
  451.  */
  452. /* Add a file attachment annotation. icon is one of "graph", "paperclip",
  453.  "pushpin", or "tag". */
  454. PDFLIB_API void PDFLIB_CALL
  455. PDF_attach_file(PDF *p, float llx, float lly, float urx, float ury,
  456.     const char *filename, const char *description, const char *author,
  457.     const char *mimetype, const char *icon);
  458. /* Add a note annotation. icon is one of of "comment", "insert", "note",
  459.  "paragraph", "newparagraph", "key", or "help". */
  460. PDFLIB_API void PDFLIB_CALL
  461. PDF_add_note(PDF *p, float llx, float lly, float urx, float ury,
  462.     const char *contents, const char *title, const char *icon, int open);
  463. /* Add a file link annotation (to a PDF target). */
  464. PDFLIB_API void PDFLIB_CALL
  465. PDF_add_pdflink(PDF *p, float llx, float lly, float urx, float ury,
  466.     const char *filename, int page, const char *dest);
  467. /* Add a launch annotation (to a target of arbitrary file type). */
  468. PDFLIB_API void PDFLIB_CALL
  469. PDF_add_launchlink(PDF *p, float llx, float lly, float urx, float ury,
  470.     const char *filename);
  471. /* Add a link annotation to a target within the current PDF file. */
  472. PDFLIB_API void PDFLIB_CALL
  473. PDF_add_locallink(PDF *p, float llx, float lly, float urx, float ury,
  474.     int page, const char *dest);
  475. /* Add a weblink annotation to a target URL on the Web. */
  476. PDFLIB_API void PDFLIB_CALL
  477. PDF_add_weblink(PDF *p, float llx, float lly, float urx, float ury,
  478.     const char *url);
  479. /* Set the border style for all kinds of annotations. style is "solid" or
  480.  "dashed". */
  481. PDFLIB_API void PDFLIB_CALL
  482. PDF_set_border_style(PDF *p, const char *style, float width);
  483. /* Set the border color for all kinds of annotations. */
  484. PDFLIB_API void PDFLIB_CALL
  485. PDF_set_border_color(PDF *p, float red, float green, float blue);
  486. /* Set the border dash style for all kinds of annotations. See PDF_setdash(). */
  487. PDFLIB_API void PDFLIB_CALL
  488. PDF_set_border_dash(PDF *p, float b, float w);
  489. /* 
  490.  * ----------------------------------------------------------------------
  491.  * p_pdi.c: PDF import (requires the PDI library)
  492.  * ----------------------------------------------------------------------
  493.  */
  494. /* Open an existing PDF document and prepare it for later use. */
  495. PDFLIB_API int PDFLIB_CALL
  496. PDF_open_pdi(PDF *p, const char *filename, const char *stringparam,
  497.     int intparam);
  498. /* Close all open page handles, and close the input PDF document. */
  499. PDFLIB_API void PDFLIB_CALL
  500. PDF_close_pdi(PDF *p, int doc);
  501. /* Prepare a page for later use with PDF_place_pdi_page(). */
  502. PDFLIB_API int PDFLIB_CALL
  503. PDF_open_pdi_page(PDF *p, int doc, int page, const char *label);
  504. /* Place a PDF page with the lower left corner at (x, y), and scale it. */
  505. PDFLIB_API void PDFLIB_CALL
  506. PDF_place_pdi_page(PDF *p, int page, float x, float y, float sx, float sy);
  507. /* Close the page handle, and free all page-related resources. */
  508. PDFLIB_API void PDFLIB_CALL
  509. PDF_close_pdi_page(PDF *p, int page);
  510. /* Get the contents of some PDI document parameter with string type. */
  511. PDFLIB_API const char *PDFLIB_CALL
  512. PDF_get_pdi_parameter(PDF *p, const char *key, int doc, int page,
  513.     int index, int *len);
  514. /* Get the contents of some PDI document parameter with numerical type. */
  515. PDFLIB_API float PDFLIB_CALL
  516. PDF_get_pdi_value(PDF *p, const char *key, int doc, int page, int index);
  517. /* 
  518.  * ----------------------------------------------------------------------
  519.  * p_stream.c: output stream handling
  520.  * ----------------------------------------------------------------------
  521.  */
  522. /* Get the contents of the PDF output buffer. The result must be used by
  523.  the client before calling any other PDFlib function. */
  524. PDFLIB_API const char * PDFLIB_CALL
  525. PDF_get_buffer(PDF *p, long *size);
  526. /* 
  527.  * ----------------------------------------------------------------------
  528.  * page size formats
  529.  * ----------------------------------------------------------------------
  530.  */
  531. /*
  532. Although PDF doesn磘 impose any restrictions on the usable page size,
  533. Acrobat implementations suffer from architectural limits concerning
  534. the page size.
  535. Although PDFlib will generate PDF documents with page sizes outside
  536. these limits, the default error handler will issue a warning message.
  537. Acrobat 3 minimum page size: 1" = 72 pt = 2.54 cm
  538. Acrobat 3 maximum page size: 45" = 3240 pt = 114.3 cm
  539. Acrobat 4 minimum page size: 0.25" = 18 pt = 0.635 cm
  540. Acrobat 4 maximum page size: 200" = 14400 pt = 508 cm
  541. */
  542. /* The page sizes are only available to the C and C++ bindings */
  543. #define a0_width  (float) 2380.0
  544. #define a0_height  (float) 3368.0
  545. #define a1_width  (float) 1684.0
  546. #define a1_height  (float) 2380.0
  547. #define a2_width  (float) 1190.0
  548. #define a2_height  (float) 1684.0
  549. #define a3_width  (float) 842.0
  550. #define a3_height  (float) 1190.0
  551. #define a4_width  (float) 595.0
  552. #define a4_height  (float) 842.0
  553. #define a5_width  (float) 421.0
  554. #define a5_height  (float) 595.0
  555. #define a6_width  (float) 297.0
  556. #define a6_height  (float) 421.0
  557. #define b5_width  (float) 501.0
  558. #define b5_height  (float) 709.0
  559. #define letter_width  (float) 612.0
  560. #define letter_height  (float) 792.0
  561. #define legal_width   (float) 612.0
  562. #define legal_height   (float) 1008.0
  563. #define ledger_width  (float) 1224.0
  564. #define ledger_height  (float) 792.0
  565. #define p11x17_width  (float) 792.0
  566. #define p11x17_height  (float) 1224.0
  567. #ifdef __cplusplus
  568. } /* extern "C" */
  569. #endif
  570. #endif /* PDFLIB_H */