Mon, 14 Dec 2009 16:18:21 +0000
remove erroneous 0.33-philpem1 tag
1 /*
2 * tumble: build a PDF file from image files
3 *
4 * PDF routines
5 * $Id: pdf.h,v 1.13 2003/03/19 23:53:09 eric Exp $
6 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. Note that permission is
11 * not granted to redistribute this program under the terms of any
12 * other version of the General Public License.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
22 */
25 /* Acrobat default units aren't really points, but they're close. */
26 #define POINTS_PER_INCH 72.0
28 /* page size limited by Acrobat Reader to 45 inches on a side */
29 #define PAGE_MAX_INCHES 45
30 #define PAGE_MAX_POINTS (PAGE_MAX_INCHES * POINTS_PER_INCH)
33 typedef struct pdf_file *pdf_file_handle;
35 typedef struct pdf_page *pdf_page_handle;
37 typedef struct pdf_bookmark *pdf_bookmark_handle;
40 #define PDF_PAGE_MODE_USE_NONE 0
41 #define PDF_PAGE_MODE_USE_OUTLINES 1 /* if no outlines, will use NONE */
42 #define PDF_PAGE_MODE_USE_THUMBS 2 /* not yet implemented */
45 void pdf_init (void);
47 pdf_file_handle pdf_create (char *filename);
49 void pdf_close (pdf_file_handle pdf_file, int page_mode);
51 void pdf_set_author (pdf_file_handle pdf_file, char *author);
52 void pdf_set_creator (pdf_file_handle pdf_file, char *author);
53 void pdf_set_title (pdf_file_handle pdf_file, char *author);
54 void pdf_set_subject (pdf_file_handle pdf_file, char *author);
55 void pdf_set_keywords (pdf_file_handle pdf_file, char *author);
58 /* width and height in units of 1/72 inch */
59 pdf_page_handle pdf_new_page (pdf_file_handle pdf_file,
60 double width,
61 double height);
63 void pdf_close_page (pdf_page_handle pdf_page);
66 void pdf_write_text (pdf_page_handle pdf_page);
69 /* The length of the data must be Rows * rowbytes.
70 Note that rowbytes must be at least (Columns+7)/8, but may be arbitrarily
71 large. */
72 void pdf_write_g4_fax_image (pdf_page_handle pdf_page,
73 double x,
74 double y,
75 double width,
76 double height,
77 Bitmap *bitmap,
78 bool ImageMask,
79 double r, /* RGB fill color, only for ImageMask */
80 double g,
81 double b,
82 bool BlackIs1); /* boolean, typ. false */
85 void pdf_write_jpeg_image (pdf_page_handle pdf_page,
86 double x,
87 double y,
88 double width,
89 double height,
90 bool color,
91 uint32_t width_samples,
92 uint32_t height_samples,
93 FILE *f);
95 void pdf_write_png_image (pdf_page_handle pdf_page,
96 double x,
97 double y,
98 double width,
99 double height,
100 int color,
101 char *pal,
102 int palent,
103 int bpp,
104 uint32_t width_samples,
105 uint32_t height_samples,
106 FILE *f);
108 void pdf_write_jp2_image (pdf_page_handle pdf_page,
109 double x,
110 double y,
111 double width,
112 double height,
113 uint32_t width_samples,
114 uint32_t height_samples,
115 FILE *f);
117 void pdf_set_page_number (pdf_page_handle pdf_page, char *page_number);
119 /* Create a new bookmark, under the specified parent, or at the top
120 level if parent is NULL. */
121 pdf_bookmark_handle pdf_new_bookmark (pdf_bookmark_handle parent,
122 char *title,
123 bool open,
124 pdf_page_handle pdf_page);
127 void pdf_new_page_label (pdf_file_handle pdf_file,
128 int page_index,
129 int base,
130 int count,
131 char style,
132 char *prefix);