home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pdflb302.zip / pdf / pdflib-3.0.2 / pdflib / pdflib.h < prev    next >
C/C++ Source or Header  |  2000-08-21  |  24KB  |  680 lines

  1. /*---------------------------------------------------------------------------*
  2.  |        PDFlib - A library for dynamically generating PDF documents        |
  3.  +---------------------------------------------------------------------------+
  4.  |        Copyright (c) 1997-2000 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.  
  30. /* pdflib.h
  31.  *
  32.  * PDFlib public function and constant declarations
  33.  *
  34.  */
  35.  
  36. #ifndef PDFLIB_H
  37. #define PDFLIB_H
  38.  
  39. /* 
  40.  * ----------------------------------------------------------------------
  41.  * Setup, mostly Windows calling conventions and DLL stuff
  42.  * ----------------------------------------------------------------------
  43.  */
  44.  
  45. #ifndef SWIG
  46. #include <stdlib.h>
  47. #include <stdio.h>
  48. #endif
  49.  
  50. #ifdef WIN32
  51.  
  52. #define PDFLIB_CALL    __cdecl
  53.  
  54. #ifdef PDFLIB_EXPORTS
  55. #define PDFLIB_API __declspec(dllexport) /* prepare a DLL (PDFlib-internal use only) */
  56.  
  57. #elif defined(PDFLIB_DLL)
  58. #define PDFLIB_API __declspec(dllimport) /* PDFlib clients - import PDFlib DLL fcts. */
  59.  
  60. #else    /* !PDFLIB_DLL */    
  61. #define PDFLIB_API /* */         /* default: generate or use static library */
  62.  
  63. #endif    /* !PDFLIB_DLL */
  64.  
  65. #else    /* !WIN32 */
  66.  
  67. #if (((defined __IBMC__) || (defined __IBMCPP__)) && (defined __DLL__))
  68.     #define PDFLIB_CALL _Export
  69.     #define PDFLIB_API
  70. #endif    /* IBM VisualAge C++ DLL */
  71.  
  72. #ifndef PDFLIB_CALL
  73. #define PDFLIB_CALL
  74. #endif
  75. #ifndef PDFLIB_API
  76. #define PDFLIB_API
  77. #endif
  78.  
  79. #endif    /* !WIN32 */
  80.  
  81. /* Make our declarations C++ compatible */
  82. #ifdef __cplusplus
  83. extern "C" {
  84. #endif
  85.  
  86. /* Define the basic PDF type. This is used opaquely at the API level. */
  87. typedef struct PDF_s PDF;
  88.  
  89. /* 
  90.  * ----------------------------------------------------------------------
  91.  * p_basic.c
  92.  * ----------------------------------------------------------------------
  93.  */
  94.  
  95. /* General Functions */
  96.  
  97. #ifndef SWIG
  98. /*
  99.  * The version defines below may be used to check the version of the
  100.  * include file against the library. This is not reasonable at the
  101.  * scripting API level since both version constants and version functions
  102.  * are supplied from the library in this case.
  103.  */
  104.  
  105. /* PDFlib version number, major part */
  106. #define PDFLIB_MAJORVERSION    3
  107.  
  108. /* PDFlib version number, minor part (must use two decimal places if != 0) */
  109. #define PDFLIB_MINORVERSION    02
  110. #define PDFLIB_VERSIONSTRING    "3.02"
  111.  
  112. /*
  113.  * ActiveX uses the Class ID;
  114.  * Tcl and Perl have intrinsic versioning which we make use of;
  115.  */
  116. #if !defined(PDFLIB_ACTIVEX) && !defined(PDFLIB_TCL) && !defined(PDFLIB_PERL)
  117.  
  118. /* Returns the PDFlib major version number. */
  119. PDFLIB_API int PDFLIB_CALL
  120. PDF_get_majorversion(void);
  121.  
  122. /* Returns the PDFlib minor version number. */
  123. PDFLIB_API int PDFLIB_CALL
  124. PDF_get_minorversion(void);
  125.  
  126. #endif /* !defined(PDFLIB_ACTIVEX) && !defined(PDFLIB_TCL) && !defined(PDFLIB_PERL) */
  127.  
  128. /* Boot PDFlib. Recommended although currently not required.
  129.  Booting is done automatically for Java, Tcl, Perl, and Python. */
  130. PDFLIB_API void PDFLIB_CALL
  131. PDF_boot(void);
  132.  
  133. /* Shut down PDFlib. Recommended although currently not required. */
  134. PDFLIB_API void PDFLIB_CALL
  135. PDF_shutdown(void);
  136.  
  137. /* This typedef is required to pacify the Watcom compiler in C++ mode. */
  138. typedef void (*errorproc)(PDF *p, int type, const char *msg);
  139.  
  140. /* Create a new PDF object.  Returns a pointer to the opaque PDF datatype 
  141. which you will need as the "p" argument for all other functions. All 
  142. function pointers may be NULL if default handlers are to be used. */
  143. PDFLIB_API PDF * PDFLIB_CALL
  144. PDF_new2(errorproc errorhandler,
  145.     void* (*allocproc)(PDF *p, size_t size, const char *caller),
  146.     void* (*reallocproc)(PDF *p, void *mem, size_t size, const char *caller),
  147.     void  (*freeproc)(PDF *p, void *mem),
  148.     void   *opaque);
  149.  
  150. /* Fetch opaque application pointer stored in PDFlib (useful for
  151.  multi-threading) */
  152. PDFLIB_API void * PDFLIB_CALL
  153. PDF_get_opaque(PDF *p);
  154.  
  155. #endif    /* !SWIG */
  156.  
  157. /* Create a new PDF object. */
  158. PDFLIB_API PDF * PDFLIB_CALL
  159. PDF_new(void);
  160.  
  161. /* Delete the PDF object. */
  162. PDFLIB_API void PDFLIB_CALL
  163. PDF_delete(PDF *p);
  164.  
  165. /* Open a new PDF file associated with p, using the supplied file name.
  166.  Returns -1 on error. */
  167. PDFLIB_API int PDFLIB_CALL
  168. PDF_open_file(PDF *p, const char *filename);
  169.  
  170. /* Close the generated PDF file. */
  171. PDFLIB_API void PDFLIB_CALL
  172. PDF_close(PDF *p);
  173.  
  174. #if !defined(SWIG)
  175. /* Open a new PDF file associated with p, using the supplied file handle.
  176.  Returns -1 on error. */
  177. PDFLIB_API int PDFLIB_CALL
  178. PDF_open_fp(PDF *p, FILE *fp);
  179.  
  180. /* Open a new PDF in memory, and install a callback for fetching the data */
  181. PDFLIB_API void PDFLIB_CALL
  182. PDF_open_mem(PDF *p, size_t (*writeproc)(PDF *p, void *data, size_t size));
  183. #endif    /* !defined(SWIG) */
  184.  
  185. /* Get the contents of the PDF output buffer. The result must be used
  186.  by the client before calling any other PDFlib function.  Must not be
  187.  called within page descriptions. */
  188. PDFLIB_API const char * PDFLIB_CALL
  189. PDF_get_buffer(PDF *p, long *size);
  190.  
  191. /* Start a new page. */
  192. PDFLIB_API void PDFLIB_CALL
  193. PDF_begin_page(PDF *p, float width, float height);
  194.  
  195. /* Finish the page. */
  196. PDFLIB_API void PDFLIB_CALL
  197. PDF_end_page(PDF *p);
  198.  
  199. #ifndef SWIG
  200. /* PDFlib exceptions which may be handled by a user-supplied error handler */
  201. #define PDF_MemoryError    1
  202. #define PDF_IOError        2
  203. #define PDF_RuntimeError   3
  204. #define PDF_IndexError     4
  205. #define PDF_TypeError      5
  206. #define PDF_DivisionByZero 6
  207. #define PDF_OverflowError  7
  208. #define PDF_SyntaxError    8
  209. #define PDF_ValueError     9
  210. #define PDF_SystemError   10
  211. #define PDF_NonfatalError 11
  212. #define PDF_UnknownError  12
  213.  
  214. #endif    /* !SWIG */
  215.  
  216. /* Set some PDFlib parameter with string type */
  217. PDFLIB_API void PDFLIB_CALL
  218. PDF_set_parameter(PDF *p, const char *key, const char *value);
  219.  
  220. /* Set the contents of some PDFlib parameter with string type */
  221. PDFLIB_API const char * PDFLIB_CALL
  222. PDF_get_parameter(PDF *p, const char *key, float modifier);
  223.  
  224. /* Set some PDFlib parameter with float type */
  225. PDFLIB_API void PDFLIB_CALL
  226. PDF_set_value(PDF *p, const char *key, float value);
  227.  
  228. /* Get the value of some PDFlib parameter with float type */
  229. PDFLIB_API float PDFLIB_CALL
  230. PDF_get_value(PDF *p, const char *key, float modifier);
  231.  
  232. /* 
  233.  * ----------------------------------------------------------------------
  234.  * p_font.c
  235.  * ----------------------------------------------------------------------
  236.  */
  237.  
  238. /* Text Functions, Font Handling Functions */
  239.  
  240. /* Prepare a font for later use with PDF_setfont(). The metrics will be
  241.  loaded, and if embed is nonzero, the font file will be checked (but not
  242.  yet used. Encoding is one of "builtin", "macroman", "winansi", "host", or
  243.  a user-defined name, or the name of a CMap. */
  244. PDFLIB_API int PDFLIB_CALL
  245. PDF_findfont(PDF *p, const char *fontname, const char *encoding, int embed);
  246.  
  247. /* Set the current font in the given size. The font descriptor must have
  248.  been retrieved via PDF_findfont(). */
  249. PDFLIB_API void PDFLIB_CALL
  250. PDF_setfont(PDF *p, int font, float fontsize);
  251.  
  252. /* 
  253.  * ----------------------------------------------------------------------
  254.  * p_text.c
  255.  * ----------------------------------------------------------------------
  256.  */
  257.  
  258. /* Text Output Functions */
  259.  
  260. /* Print text in the current font and size at the current position. */
  261. PDFLIB_API void PDFLIB_CALL
  262. PDF_show(PDF *p, const char *text);
  263.  
  264. /* Print text in the current font at (x, y). */
  265. PDFLIB_API void PDFLIB_CALL
  266. PDF_show_xy(PDF *p, const char *text, float x, float y);
  267.  
  268. /* Print text at the next line. */
  269. PDFLIB_API void PDFLIB_CALL
  270. PDF_continue_text(PDF *p, const char *text);
  271.  
  272. /* Format text in the current font and size into the supplied text box
  273.  according to the requested formatting mode. If width and height
  274.  are 0, only a single line is placed at the point (left, top) in the
  275.  requested mode. Returns the number of characters which didn't fit in
  276.  the box. */
  277. PDFLIB_API int PDFLIB_CALL
  278. PDF_show_boxed(PDF *p, const char *text, float left, float top, float width, float height, const char *hmode, const char *feature);
  279.  
  280. /* Set a transformation matrix to be applied to the current font. */
  281. PDFLIB_API void PDFLIB_CALL
  282. PDF_set_text_matrix(PDF *p, float a, float b, float c, float d, float e, float f);
  283.  
  284. /* Set the text output position to (x, y). */
  285. PDFLIB_API void PDFLIB_CALL
  286. PDF_set_text_pos(PDF *p, float x, float y);
  287.  
  288. /* Return the width of text in an arbitrary font which has been selected
  289.  with PDF_findfont(). */
  290. PDFLIB_API float PDFLIB_CALL
  291. PDF_stringwidth(PDF *p, const char *text, int font, float size);
  292.  
  293. #ifndef SWIG
  294.  
  295. /* Function duplicates with explicit string length for use with 
  296. strings containing null characters. These are for C and C++ clients only,
  297. but are used internally for the other language bindings. */
  298.  
  299. /* Same as PDF_show() but with explicit string length. */
  300. PDFLIB_API void PDFLIB_CALL
  301. PDF_show2(PDF *p, const char *text, int len);
  302.  
  303. /* Same as PDF_show_xy() but with explicit string length. */
  304. PDFLIB_API void PDFLIB_CALL
  305. PDF_show_xy2(PDF *p, const char *text, int len, float x, float y);
  306.  
  307. /* Same as PDF_continue_text but with explicit string length. */
  308. PDFLIB_API void PDFLIB_CALL
  309. PDF_continue_text2(PDF *p, const char *text, int len);
  310.  
  311. /* Same as PDF_stringwidth but with explicit string length. */
  312. PDFLIB_API float PDFLIB_CALL
  313. PDF_stringwidth2(PDF *p, const char *text, int len, int font, float size);
  314.  
  315. #endif /* !SWIG */
  316.  
  317. /* 
  318.  * ----------------------------------------------------------------------
  319.  * p_gstate.c
  320.  * ----------------------------------------------------------------------
  321.  */
  322.  
  323. /* Graphics Functions, General Graphics State Functions */
  324.  
  325. /* Set the current dash pattern to b black and w white units. */
  326. PDFLIB_API void PDFLIB_CALL
  327. PDF_setdash(PDF *p, float b, float w);
  328.  
  329. /* Set a more complicated dash pattern defined by an array. */
  330. PDFLIB_API void PDFLIB_CALL
  331. PDF_setpolydash(PDF *p, float *dasharray, int length);
  332.  
  333. #ifndef SWIG
  334. /* Maximum length of dash arrays */
  335. #define MAX_DASH_LENGTH    8
  336. #endif
  337.  
  338. /* Set the flatness to a value between 0 and 100 inclusive. */
  339. PDFLIB_API void PDFLIB_CALL
  340. PDF_setflat(PDF *p, float flatness);
  341.  
  342. /* Set the line join parameter to a value between 0 and 2 inclusive. */
  343. PDFLIB_API void PDFLIB_CALL
  344. PDF_setlinejoin(PDF *p, int linejoin);
  345.  
  346. /* Set the linecap parameter to a value between 0 and 2 inclusive. */
  347. PDFLIB_API void PDFLIB_CALL
  348. PDF_setlinecap(PDF *p, int linecap);
  349.  
  350. /* Set the miter limit to a value greater than or equal to 1. */
  351. PDFLIB_API void PDFLIB_CALL
  352. PDF_setmiterlimit(PDF *p, float miter);
  353.  
  354. /* Set the current linewidth to width. */
  355. PDFLIB_API void PDFLIB_CALL
  356. PDF_setlinewidth(PDF *p, float width);
  357.  
  358.  
  359. /* Special Graphics State Functions */
  360.  
  361. /* Save the current graphics state. */
  362. PDFLIB_API void PDFLIB_CALL
  363. PDF_save(PDF *p);
  364.  
  365. /* Restore the most recently saved graphics state. */
  366. PDFLIB_API void PDFLIB_CALL
  367. PDF_restore(PDF *p);
  368.  
  369. /* Translate the origin of the coordinate system to (tx, ty). */
  370. PDFLIB_API void PDFLIB_CALL
  371. PDF_translate(PDF *p, float tx, float ty);
  372.  
  373. /* Scale the coordinate system by (sx, sy). */
  374. PDFLIB_API void PDFLIB_CALL
  375. PDF_scale(PDF *p, float sx, float sy);
  376.  
  377. /* Rotate the coordinate system by phi degrees. */
  378. PDFLIB_API void PDFLIB_CALL
  379. PDF_rotate(PDF *p, float phi);
  380.  
  381. /* Skew the coordinate system in x and y direction by alpha and beta degrees. */
  382. PDFLIB_API void PDFLIB_CALL
  383. PDF_skew(PDF *p, float alpha, float beta);
  384.  
  385. /* Concatenate a matrix to the CTM. a*d must not be equal to b*c. */
  386. PDFLIB_API void PDFLIB_CALL
  387. PDF_concat(PDF *p, float a, float b, float c, float d, float e, float f);
  388.  
  389. /* 
  390.  * ----------------------------------------------------------------------
  391.  * p_draw.c
  392.  * ----------------------------------------------------------------------
  393.  */
  394.  
  395. /* Path Segment Functions */
  396.  
  397. /* Set the current point to (x, y). */
  398. PDFLIB_API void PDFLIB_CALL
  399. PDF_moveto(PDF *p, float x, float y);
  400.  
  401. /* Draw a line from the current point to (x, y). */
  402. PDFLIB_API void PDFLIB_CALL
  403. PDF_lineto(PDF *p, float x, float y);
  404.  
  405. /* Draw a Bezier curve from the current point, using 3 more control points. */
  406. PDFLIB_API void PDFLIB_CALL
  407. PDF_curveto(PDF *p, float x1, float y1, float x2, float y2, float x3, float y3);
  408.  
  409. /* Draw a circle with center (x, y) and radius r. */
  410. PDFLIB_API void PDFLIB_CALL
  411. PDF_circle(PDF *p, float x, float y, float r);
  412.  
  413. /* Draw a circular arc with center (x, y) and radius r from alpha1 to alpha2. */
  414. PDFLIB_API void PDFLIB_CALL
  415. PDF_arc(PDF *p, float x, float y, float r, float alpha1, float alpha2);
  416.  
  417. /* Draw a rectangle at lower left (x, y) with width and height. */
  418. PDFLIB_API void PDFLIB_CALL
  419. PDF_rect(PDF *p, float x, float y, float width, float height);
  420.  
  421. /* Close the current path. */
  422. PDFLIB_API void PDFLIB_CALL
  423. PDF_closepath(PDF *p);
  424.  
  425. /* Path Painting and Clipping Functions */
  426.  
  427. /* Stroke the path with the current color and line width,and clear it. */
  428. PDFLIB_API void PDFLIB_CALL
  429. PDF_stroke(PDF *p);
  430.  
  431. /* Close the path, and stroke it. */
  432. PDFLIB_API void PDFLIB_CALL
  433. PDF_closepath_stroke(PDF *p);
  434.  
  435. /* Fill the interior of the path with the current fill color. */
  436. PDFLIB_API void PDFLIB_CALL
  437. PDF_fill(PDF *p);
  438.  
  439. /* Fill and stroke the path with the current fill and stroke color. */
  440. PDFLIB_API void PDFLIB_CALL
  441. PDF_fill_stroke(PDF *p);
  442.  
  443. /* Close the path, fill, and stroke it. */
  444. PDFLIB_API void PDFLIB_CALL
  445. PDF_closepath_fill_stroke(PDF *p);
  446.  
  447. /* End the current path. Deprecated, use one of the stroke, fill, or clip
  448.  functions instead.  */
  449. PDFLIB_API void PDFLIB_CALL
  450. PDF_endpath(PDF *p);
  451.  
  452. /* Use the current path as clipping path. */
  453. PDFLIB_API void PDFLIB_CALL
  454. PDF_clip(PDF *p);
  455.  
  456. /* 
  457.  * ----------------------------------------------------------------------
  458.  * p_color.c
  459.  * ----------------------------------------------------------------------
  460.  */
  461.  
  462. /* Color Functions */
  463.  
  464. /* Set the current fill color to a gray value between 0 and 1 inclusive. */
  465. PDFLIB_API void PDFLIB_CALL
  466. PDF_setgray_fill(PDF *p, float g);
  467.  
  468. /* Set the current stroke color to a gray value between 0 and 1 inclusive. */
  469. PDFLIB_API void PDFLIB_CALL
  470. PDF_setgray_stroke(PDF *p, float g);
  471.  
  472. /* Set the current fill and stroke color. */
  473. PDFLIB_API void PDFLIB_CALL
  474. PDF_setgray(PDF *p, float g);
  475.  
  476. /* Set the current fill color to the supplied RGB values. */
  477. PDFLIB_API void PDFLIB_CALL
  478. PDF_setrgbcolor_fill(PDF *p, float red, float green, float blue);
  479.  
  480. /* Set the current stroke color to the supplied RGB values. */
  481. PDFLIB_API void PDFLIB_CALL
  482. PDF_setrgbcolor_stroke(PDF *p, float red, float green, float blue);
  483.  
  484. /* Set the current fill and stroke color to the supplied RGB values. */
  485. PDFLIB_API void PDFLIB_CALL
  486. PDF_setrgbcolor(PDF *p, float red, float green, float blue);
  487.  
  488. #ifdef PDF_CMYK_SUPPORTED
  489.  
  490. /* Set the current fill color to the supplied CMYK values. */
  491. PDFLIB_API void PDFLIB_CALL
  492. PDF_setcmykcolor_fill(PDF *p, float cyan, float magenta, float yellow, float black);
  493.  
  494. /* Set the current stroke color to the supplied CMYK values. */
  495. PDFLIB_API void PDFLIB_CALL
  496. PDF_setcmykcolor_stroke(PDF *p, float cyan, float magenta, float yellow, float black);
  497.  
  498. /* Set the current fill and stroke color to the supplied CMYK values. */
  499. PDFLIB_API void PDFLIB_CALL
  500. PDF_setcmykcolor(PDF *p, float cyan, float magenta, float yellow, float black);
  501.  
  502. #endif /* PDF_CMYK_SUPPORTED */
  503.  
  504. /* 
  505.  * ----------------------------------------------------------------------
  506.  * p_image.c
  507.  * ----------------------------------------------------------------------
  508.  */
  509.  
  510. /* Image Functions */
  511.  
  512. /* Place an image at the lower left corner (x, y), and scale it. */
  513. PDFLIB_API void PDFLIB_CALL
  514. PDF_place_image(PDF *p, int image, float x, float y, float scale);
  515.  
  516. /* Use image data from a variety of data sources. Returns an image descriptor
  517.  or -1. Supported types are "jpeg", "ccitt", "raw". Supported sources are
  518.  "memory", "fileref", "url". len is only used for type="raw", params is only
  519.  used for type="ccitt". */
  520. PDFLIB_API int PDFLIB_CALL
  521. PDF_open_image(PDF *p, const char *type, const char *source, const char *data, long length, int width, int height, int components, int bpc, const char *params);
  522.  
  523. /* Open an image for later use. Returns an image descriptor or -1. Supported
  524.  types are "jpeg", "tiff", "gif", and "png" (depending on configuration,
  525.  however). stringparam is either "", "mask", "masked", or "page". intparam
  526.  is either 0, the image number of the applied mask, or the page. */
  527. PDFLIB_API int PDFLIB_CALL
  528. PDF_open_image_file(PDF *p, const char *type, const char *filename, const char *stringparam, int intparam);
  529.  
  530. /* Close an image retrieved with one of the PDF_open_image*() functions. */
  531. PDFLIB_API void PDFLIB_CALL
  532. PDF_close_image(PDF *p, int image);
  533.  
  534. #ifdef PDF_THUMBNAILS_SUPPORTED
  535. /* Add an existing image as thumbnail for the current page. PDFlib doesn't
  536. help with preparing the thumbnail, but simply places it in the output. */
  537. PDFLIB_API void PDFLIB_CALL
  538. PDF_add_thumbnail(PDF *p, int im);
  539. #endif    /* PDF_THUMBNAILS_SUPPORTED */
  540.  
  541. /* 
  542.  * ----------------------------------------------------------------------
  543.  * p_ccitt.c
  544.  * ----------------------------------------------------------------------
  545.  */
  546.  
  547. /* Open a raw CCITT image for later use. Returns an image descriptor or -1. */
  548. PDFLIB_API int PDFLIB_CALL
  549. PDF_open_CCITT(PDF *p, const char *filename, int width, int height, int BitReverse, int K, int BlackIs1);
  550.  
  551. /* 
  552.  * ----------------------------------------------------------------------
  553.  * p_hyper.c
  554.  * ----------------------------------------------------------------------
  555.  */
  556.  
  557. /* Hypertext Functions, Bookmarks */
  558.  
  559. /* Add a nested bookmark under parent, or a new top-level bookmark if 
  560.  parent = 0. text may be Unicode. Returns a bookmark descriptor which may be
  561.  used as parent for subsequent nested bookmarks. If open = 1, child
  562.  bookmarks will be folded out, and invisible if open = 0. */
  563. PDFLIB_API int PDFLIB_CALL
  564. PDF_add_bookmark(PDF *p, const char *text, int parent, int open);
  565.  
  566. /* Document Information Fields */
  567.  
  568. /* Fill document information field key with value. value may be Unicode. */
  569. PDFLIB_API void PDFLIB_CALL
  570. PDF_set_info(PDF *p, const char *key, const char *value);
  571.  
  572. /* 
  573.  * ----------------------------------------------------------------------
  574.  * p_annots.c
  575.  * ----------------------------------------------------------------------
  576.  */
  577.  
  578. /* File Attachments */
  579.  
  580. /* Add a file attachment annotation. description and author may be Unicode. 
  581.  icon is one of "graph, "paperclip", "pushpin", or "tag". */
  582. PDFLIB_API void PDFLIB_CALL
  583. PDF_attach_file(PDF *p, float llx, float lly, float urx, float ury, const char *filename, const char *description, const char *author, const char *mimetype, const char *icon);
  584.  
  585. /* Note Annotations */
  586.  
  587. /* Add a note annotation. contents and title may be Unicode. icon is one
  588.  of "comment, "insert", "note", "paragraph", "newparagraph", "key", or "help".
  589.  */
  590. PDFLIB_API void PDFLIB_CALL
  591. PDF_add_note(PDF *p, float llx, float lly, float urx, float ury, const char *contents, const char *title, const char *icon, int open);
  592.  
  593. /* Links */
  594.  
  595. /* Add a file link annotation (to a PDF file). */
  596. PDFLIB_API void PDFLIB_CALL
  597. PDF_add_pdflink(PDF *p, float llx, float lly, float urx, float ury, const char *filename, int page, const char *dest);
  598.  
  599. /* Add a launch annotation (arbitrary file type). */
  600. PDFLIB_API void PDFLIB_CALL
  601. PDF_add_launchlink(PDF *p, float llx, float lly, float urx, float ury, const char *filename);
  602.  
  603. /* Add a link annotation with a target within the current file. dest can be
  604.  "fullpage" or "fitwidth". */
  605. PDFLIB_API void PDFLIB_CALL
  606. PDF_add_locallink(PDF *p, float llx, float lly, float urx, float ury, int page, const char *dest);
  607.  
  608. /* Add a weblink annotation. */
  609. PDFLIB_API void PDFLIB_CALL
  610. PDF_add_weblink(PDF *p, float llx, float lly, float urx, float ury, const char *url);
  611.  
  612. /* Set the border style for all kinds of annotations.
  613.  These settings are used for all annotations until a new style is set. 
  614.  Supported border style names are "solid" and "dashed". */
  615. PDFLIB_API void PDFLIB_CALL
  616. PDF_set_border_style(PDF *p, const char *style, float width);
  617.  
  618. /* Set the border color for all kinds of annotations. */
  619. PDFLIB_API void PDFLIB_CALL
  620. PDF_set_border_color(PDF *p, float red, float green, float blue);
  621.  
  622. /* Set the border dash style for all kinds of annotations. See PDF_setdash(). */
  623. PDFLIB_API void PDFLIB_CALL
  624. PDF_set_border_dash(PDF *p, float b, float w);
  625.  
  626. /* 
  627.  * ----------------------------------------------------------------------
  628.  * Convenience stuff
  629.  * ----------------------------------------------------------------------
  630.  */
  631.  
  632. /* Page Size Formats */
  633.  
  634. /*
  635. Although PDF doesn┤t impose any restrictions on the usable page size,
  636. Acrobat implementations suffer from architectural limits concerning
  637. the page size.
  638. Although PDFlib will generate PDF documents with page sizes outside
  639. these limits, the default error handler will issue a warning message.
  640.  
  641. Acrobat 3 minimum page size: 1" = 72 pt = 2.54 cm
  642. Acrobat 3 maximum page size: 45" = 3240 pt = 114.3 cm
  643. Acrobat 4 minimum page size: 0.25" = 18 pt = 0.635 cm
  644. Acrobat 4 maximum page size: 200" = 14400 pt = 508 cm
  645. */
  646.  
  647. /* The page sizes are only available to the C and C++ bindings */
  648. #ifndef SWIG
  649. #define a0_width     (float) 2380.0
  650. #define a0_height     (float) 3368.0
  651. #define a1_width     (float) 1684.0
  652. #define a1_height     (float) 2380.0
  653. #define a2_width     (float) 1190.0
  654. #define a2_height     (float) 1684.0
  655. #define a3_width     (float) 842.0
  656. #define a3_height     (float) 1190.0
  657. #define a4_width     (float) 595.0
  658. #define a4_height     (float) 842.0
  659. #define a5_width     (float) 421.0
  660. #define a5_height     (float) 595.0
  661. #define a6_width     (float) 297.0
  662. #define a6_height     (float) 421.0
  663. #define b5_width     (float) 501.0
  664. #define b5_height     (float) 709.0
  665. #define letter_width     (float) 612.0
  666. #define letter_height     (float) 792.0
  667. #define legal_width      (float) 612.0
  668. #define legal_height      (float) 1008.0
  669. #define ledger_width     (float) 1224.0
  670. #define ledger_height     (float) 792.0
  671. #define p11x17_width     (float) 792.0
  672. #define p11x17_height     (float) 1224.0
  673. #endif
  674.  
  675. #ifdef __cplusplus
  676. } // extern "C"
  677. #endif
  678.  
  679. #endif    /* PDFLIB_H */
  680.