Fri, 14 Mar 2003 08:24:37 +0000
finished implementing page labels.
eric@62 | 1 | /* |
eric@125 | 2 | * tumble: build a PDF file from image files |
eric@62 | 3 | * |
eric@62 | 4 | * PDF routines |
eric@131 | 5 | * $Id: pdf.h,v 1.10 2003/03/14 00:24:37 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@59 | 25 | typedef struct pdf_file *pdf_file_handle; |
eric@59 | 26 | |
eric@59 | 27 | typedef struct pdf_page *pdf_page_handle; |
eric@59 | 28 | |
eric@74 | 29 | typedef struct pdf_bookmark *pdf_bookmark_handle; |
eric@74 | 30 | |
eric@59 | 31 | |
eric@75 | 32 | #define PDF_PAGE_MODE_USE_NONE 0 |
eric@75 | 33 | #define PDF_PAGE_MODE_USE_OUTLINES 1 |
eric@75 | 34 | #define PDF_PAGE_MODE_USE_THUMBS 2 /* not yet implemented */ |
eric@75 | 35 | |
eric@75 | 36 | |
eric@59 | 37 | void pdf_init (void); |
eric@59 | 38 | |
eric@75 | 39 | pdf_file_handle pdf_create (char *filename, int page_mode); |
eric@59 | 40 | |
eric@59 | 41 | void pdf_close (pdf_file_handle pdf_file); |
eric@59 | 42 | |
eric@59 | 43 | void pdf_set_author (pdf_file_handle pdf_file, char *author); |
eric@59 | 44 | void pdf_set_creator (pdf_file_handle pdf_file, char *author); |
eric@59 | 45 | void pdf_set_title (pdf_file_handle pdf_file, char *author); |
eric@59 | 46 | void pdf_set_subject (pdf_file_handle pdf_file, char *author); |
eric@59 | 47 | void pdf_set_keywords (pdf_file_handle pdf_file, char *author); |
eric@59 | 48 | |
eric@59 | 49 | |
eric@59 | 50 | /* width and height in units of 1/72 inch */ |
eric@59 | 51 | pdf_page_handle pdf_new_page (pdf_file_handle pdf_file, |
eric@59 | 52 | double width, |
eric@59 | 53 | double height); |
eric@59 | 54 | |
eric@59 | 55 | void pdf_close_page (pdf_page_handle pdf_page); |
eric@59 | 56 | |
eric@59 | 57 | |
eric@119 | 58 | void pdf_write_text (pdf_page_handle pdf_page); |
eric@119 | 59 | |
eric@119 | 60 | |
eric@59 | 61 | /* The length of the data must be Rows * rowbytes. |
eric@59 | 62 | Note that rowbytes must be at least (Columns+7)/8, but may be arbitrarily |
eric@59 | 63 | large. */ |
eric@59 | 64 | void pdf_write_g4_fax_image (pdf_page_handle pdf_page, |
eric@64 | 65 | double x, |
eric@64 | 66 | double y, |
eric@64 | 67 | double width, |
eric@64 | 68 | double height, |
eric@62 | 69 | Bitmap *bitmap, |
eric@66 | 70 | bool ImageMask, |
eric@66 | 71 | double r, /* RGB fill color, only for ImageMask */ |
eric@66 | 72 | double g, |
eric@66 | 73 | double b, |
eric@66 | 74 | bool BlackIs1); /* boolean, typ. false */ |
eric@59 | 75 | |
eric@59 | 76 | |
eric@107 | 77 | void pdf_write_jpeg_image (pdf_page_handle pdf_page, |
eric@107 | 78 | double x, |
eric@107 | 79 | double y, |
eric@107 | 80 | double width, |
eric@107 | 81 | double height, |
eric@107 | 82 | FILE *f); |
eric@107 | 83 | |
eric@107 | 84 | |
eric@59 | 85 | void pdf_set_page_number (pdf_page_handle pdf_page, char *page_number); |
eric@59 | 86 | |
eric@74 | 87 | /* Create a new bookmark, under the specified parent, or at the top |
eric@74 | 88 | level if parent is NULL. */ |
eric@74 | 89 | pdf_bookmark_handle pdf_new_bookmark (pdf_bookmark_handle parent, |
eric@74 | 90 | char *title, |
eric@74 | 91 | bool open, |
eric@74 | 92 | pdf_page_handle pdf_page); |
eric@131 | 93 | |
eric@131 | 94 | |
eric@131 | 95 | void pdf_new_page_label (pdf_file_handle pdf_file, |
eric@131 | 96 | int page_index, |
eric@131 | 97 | int base, |
eric@131 | 98 | int count, |
eric@131 | 99 | char style, |
eric@131 | 100 | char *prefix); |