pdf.h

Thu, 20 Mar 2003 06:54:08 +0000

author
eric
date
Thu, 20 Mar 2003 06:54:08 +0000
changeset 141
752599b50ff3
parent 133
76c197fe2eeb
child 147
090af3709920
permissions
-rw-r--r--

more JPEG support. added input file handler API.

eric@62 1 /*
eric@125 2 * tumble: build a PDF file from image files
eric@62 3 *
eric@62 4 * PDF routines
eric@141 5 * $Id: pdf.h,v 1.12 2003/03/19 22:54:07 eric Exp $
eric@62 6 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
eric@62 7 *
eric@62 8 * This program is free software; you can redistribute it and/or modify
eric@62 9 * it under the terms of the GNU General Public License version 2 as
eric@62 10 * published by the Free Software Foundation. Note that permission is
eric@62 11 * not granted to redistribute this program under the terms of any
eric@62 12 * other version of the General Public License.
eric@62 13 *
eric@62 14 * This program is distributed in the hope that it will be useful,
eric@62 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
eric@62 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
eric@62 17 * GNU General Public License for more details.
eric@62 18 *
eric@62 19 * You should have received a copy of the GNU General Public License
eric@62 20 * along with this program; if not, write to the Free Software
eric@62 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
eric@62 22 */
eric@62 23
eric@62 24
eric@141 25 #define POINTS_PER_INCH 72
eric@141 26
eric@141 27 /* page size limited by Acrobat Reader to 45 inches on a side */
eric@141 28 #define PAGE_MAX_INCHES 45
eric@141 29 #define PAGE_MAX_POINTS (PAGE_MAX_INCHES * POINTS_PER_INCH)
eric@141 30
eric@141 31
eric@59 32 typedef struct pdf_file *pdf_file_handle;
eric@59 33
eric@59 34 typedef struct pdf_page *pdf_page_handle;
eric@59 35
eric@74 36 typedef struct pdf_bookmark *pdf_bookmark_handle;
eric@74 37
eric@59 38
eric@75 39 #define PDF_PAGE_MODE_USE_NONE 0
eric@133 40 #define PDF_PAGE_MODE_USE_OUTLINES 1 /* if no outlines, will use NONE */
eric@75 41 #define PDF_PAGE_MODE_USE_THUMBS 2 /* not yet implemented */
eric@75 42
eric@75 43
eric@59 44 void pdf_init (void);
eric@59 45
eric@133 46 pdf_file_handle pdf_create (char *filename);
eric@59 47
eric@133 48 void pdf_close (pdf_file_handle pdf_file, int page_mode);
eric@59 49
eric@59 50 void pdf_set_author (pdf_file_handle pdf_file, char *author);
eric@59 51 void pdf_set_creator (pdf_file_handle pdf_file, char *author);
eric@59 52 void pdf_set_title (pdf_file_handle pdf_file, char *author);
eric@59 53 void pdf_set_subject (pdf_file_handle pdf_file, char *author);
eric@59 54 void pdf_set_keywords (pdf_file_handle pdf_file, char *author);
eric@59 55
eric@59 56
eric@59 57 /* width and height in units of 1/72 inch */
eric@59 58 pdf_page_handle pdf_new_page (pdf_file_handle pdf_file,
eric@59 59 double width,
eric@59 60 double height);
eric@59 61
eric@59 62 void pdf_close_page (pdf_page_handle pdf_page);
eric@59 63
eric@59 64
eric@119 65 void pdf_write_text (pdf_page_handle pdf_page);
eric@119 66
eric@119 67
eric@59 68 /* The length of the data must be Rows * rowbytes.
eric@59 69 Note that rowbytes must be at least (Columns+7)/8, but may be arbitrarily
eric@59 70 large. */
eric@59 71 void pdf_write_g4_fax_image (pdf_page_handle pdf_page,
eric@64 72 double x,
eric@64 73 double y,
eric@64 74 double width,
eric@64 75 double height,
eric@62 76 Bitmap *bitmap,
eric@66 77 bool ImageMask,
eric@66 78 double r, /* RGB fill color, only for ImageMask */
eric@66 79 double g,
eric@66 80 double b,
eric@66 81 bool BlackIs1); /* boolean, typ. false */
eric@59 82
eric@59 83
eric@107 84 void pdf_write_jpeg_image (pdf_page_handle pdf_page,
eric@107 85 double x,
eric@107 86 double y,
eric@107 87 double width,
eric@107 88 double height,
eric@107 89 FILE *f);
eric@107 90
eric@107 91
eric@59 92 void pdf_set_page_number (pdf_page_handle pdf_page, char *page_number);
eric@59 93
eric@74 94 /* Create a new bookmark, under the specified parent, or at the top
eric@74 95 level if parent is NULL. */
eric@74 96 pdf_bookmark_handle pdf_new_bookmark (pdf_bookmark_handle parent,
eric@74 97 char *title,
eric@74 98 bool open,
eric@74 99 pdf_page_handle pdf_page);
eric@131 100
eric@131 101
eric@131 102 void pdf_new_page_label (pdf_file_handle pdf_file,
eric@131 103 int page_index,
eric@131 104 int base,
eric@131 105 int count,
eric@131 106 char style,
eric@131 107 char *prefix);