pdf_prim.h

Fri, 21 Feb 2003 09:25:47 +0000

author
eric
date
Fri, 21 Feb 2003 09:25:47 +0000
changeset 66
6e0551b59dba
parent 62
9bd354b83e16
child 67
7add7411c1c2
permissions
-rw-r--r--

implemented ImageMask fill color arguments to pdf_write_g4_fax_image().

eric@62 1 /*
eric@62 2 * t2p: Create a PDF file from the contents of one or more TIFF
eric@62 3 * bilevel image files. The images in the resulting PDF file
eric@62 4 * will be compressed using ITU-T T.6 (G4) fax encoding.
eric@62 5 *
eric@62 6 * PDF routines
eric@66 7 * $Id: pdf_prim.h,v 1.3 2003/02/21 01:25:47 eric Exp $
eric@62 8 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
eric@62 9 *
eric@62 10 * This program is free software; you can redistribute it and/or modify
eric@62 11 * it under the terms of the GNU General Public License version 2 as
eric@62 12 * published by the Free Software Foundation. Note that permission is
eric@62 13 * not granted to redistribute this program under the terms of any
eric@62 14 * other version of the General Public License.
eric@62 15 *
eric@62 16 * This program is distributed in the hope that it will be useful,
eric@62 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
eric@62 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
eric@62 19 * GNU General Public License for more details.
eric@62 20 *
eric@62 21 * You should have received a copy of the GNU General Public License
eric@62 22 * along with this program; if not, write to the Free Software
eric@62 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
eric@62 24 */
eric@62 25
eric@62 26
eric@59 27 typedef enum
eric@59 28 {
eric@59 29 PT_BAD,
eric@59 30
eric@59 31 /* scalar */
eric@59 32 PT_NULL,
eric@59 33 PT_BOOL,
eric@59 34 PT_NAME,
eric@59 35 PT_STRING,
eric@59 36 PT_INTEGER,
eric@59 37 PT_REAL,
eric@59 38 PT_IND_REF,
eric@59 39
eric@59 40 /* composite */
eric@59 41 PT_DICTIONARY,
eric@59 42 PT_ARRAY,
eric@59 43 PT_STREAM
eric@59 44 } pdf_obj_type;
eric@59 45
eric@59 46
eric@59 47 struct pdf_obj;
eric@59 48
eric@59 49
eric@59 50 typedef void (*pdf_stream_write_callback)(pdf_file_handle pdf_file,
eric@59 51 struct pdf_obj *stream,
eric@59 52 void *app_data);
eric@59 53
eric@59 54
eric@59 55 void pdf_set_dict_entry (struct pdf_obj *dict_obj, char *key, struct pdf_obj *val);
eric@59 56 struct pdf_obj *pdf_get_dict_entry (struct pdf_obj *dict_obj, char *key);
eric@59 57
eric@59 58
eric@59 59 void pdf_add_array_elem (struct pdf_obj *array_obj, struct pdf_obj *val);
eric@59 60
eric@59 61
eric@59 62 /* Create a new object that will NOT be used indirectly */
eric@59 63 struct pdf_obj *pdf_new_obj (pdf_obj_type type);
eric@59 64
eric@62 65 struct pdf_obj *pdf_new_bool (bool val);
eric@59 66
eric@59 67 struct pdf_obj *pdf_new_name (char *name);
eric@59 68
eric@59 69 struct pdf_obj *pdf_new_string (char *str);
eric@59 70
eric@59 71 struct pdf_obj *pdf_new_integer (unsigned long val);
eric@59 72
eric@59 73 struct pdf_obj *pdf_new_real (double val);
eric@59 74
eric@59 75
eric@59 76 /* Create a new indirect object */
eric@59 77 struct pdf_obj *pdf_new_ind_ref (pdf_file_handle pdf_file, struct pdf_obj *obj);
eric@59 78
eric@59 79 /* get the object referenced by an indirect reference */
eric@59 80 struct pdf_obj *pdf_deref_ind_obj (struct pdf_obj *ind_obj);
eric@59 81
eric@59 82
eric@59 83 unsigned long pdf_get_integer (struct pdf_obj *obj);
eric@59 84 void pdf_set_integer (struct pdf_obj *obj, unsigned long val);
eric@59 85
eric@59 86
eric@59 87 double pdf_get_real (struct pdf_obj *obj);
eric@59 88 void pdf_set_real (struct pdf_obj *obj, double val);
eric@59 89
eric@59 90
eric@59 91 /* The callback will be called when the stream data is to be written to the
eric@59 92 file. app_data will be passed as an argument to the callback. */
eric@59 93 struct pdf_obj *pdf_new_stream (pdf_file_handle pdf_file,
eric@59 94 struct pdf_obj *stream_dict,
eric@59 95 pdf_stream_write_callback callback,
eric@59 96 void *app_data);
eric@59 97
eric@66 98 /* The callback should call pdf_stream_write_data or pdf_stream_printf
eric@66 99 to write the actual stream data. */
eric@59 100 void pdf_stream_write_data (pdf_file_handle pdf_file,
eric@59 101 struct pdf_obj *stream,
eric@59 102 char *data,
eric@59 103 unsigned long len);
eric@59 104
eric@66 105 void pdf_stream_printf (pdf_file_handle pdf_file,
eric@66 106 struct pdf_obj *stream,
eric@66 107 char *fmt, ...);
eric@66 108
eric@66 109
eric@59 110 void pdf_stream_add_filter (struct pdf_obj *stream,
eric@59 111 char *filter_name,
eric@59 112 struct pdf_obj *decode_parms);
eric@59 113
eric@59 114
eric@59 115 /* Write the object to the file */
eric@59 116 void pdf_write_obj (pdf_file_handle pdf_file, struct pdf_obj *obj);
eric@59 117
eric@59 118
eric@59 119 /* Write the indirect object to the file. For most objects this should
eric@59 120 be done by pdf_write_all_ind_obj() when the file is being closed, but for
eric@59 121 large objects such as streams, it's probably better to do it as soon as the
eric@59 122 object is complete. */
eric@59 123 void pdf_write_ind_obj (pdf_file_handle pdf_file, struct pdf_obj *ind_obj);
eric@59 124
eric@59 125
eric@59 126 /* Write all indirect objects that haven't already been written to the file. */
eric@59 127 void pdf_write_all_ind_obj (pdf_file_handle pdf_file);
eric@59 128
eric@59 129
eric@59 130 /* Write the cross reference table, and return the maximum object number */
eric@59 131 unsigned long pdf_write_xref (pdf_file_handle pdf_file);