pdf_prim.h

changeset 59
e8821eb2fb08
child 62
9bd354b83e16
     1.1 diff -r d1c6dc4bf34a -r e8821eb2fb08 pdf_prim.h
     1.2 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 +++ b/pdf_prim.h	Thu Feb 20 12:16:00 2003 +0000
     1.4 @@ -0,0 +1,100 @@
     1.5 +typedef enum
     1.6 +{
     1.7 +  PT_BAD,
     1.8 +
     1.9 +  /* scalar */
    1.10 +  PT_NULL,
    1.11 +  PT_BOOL,
    1.12 +  PT_NAME,
    1.13 +  PT_STRING,
    1.14 +  PT_INTEGER,
    1.15 +  PT_REAL,
    1.16 +  PT_IND_REF,
    1.17 +
    1.18 +  /* composite */
    1.19 +  PT_DICTIONARY,
    1.20 +  PT_ARRAY,
    1.21 +  PT_STREAM
    1.22 +} pdf_obj_type;
    1.23 +
    1.24 +
    1.25 +struct pdf_obj;
    1.26 +
    1.27 +
    1.28 +typedef void (*pdf_stream_write_callback)(pdf_file_handle pdf_file,
    1.29 +					  struct pdf_obj *stream,
    1.30 +					  void *app_data);
    1.31 +
    1.32 +
    1.33 +void pdf_set_dict_entry (struct pdf_obj *dict_obj, char *key, struct pdf_obj *val);
    1.34 +struct pdf_obj *pdf_get_dict_entry (struct pdf_obj *dict_obj, char *key);
    1.35 +
    1.36 +
    1.37 +void pdf_add_array_elem (struct pdf_obj *array_obj, struct pdf_obj *val);
    1.38 +
    1.39 +
    1.40 +/* Create a new object that will NOT be used indirectly */
    1.41 +struct pdf_obj *pdf_new_obj (pdf_obj_type type);
    1.42 +
    1.43 +struct pdf_obj *pdf_new_bool (int bool);
    1.44 +
    1.45 +struct pdf_obj *pdf_new_name (char *name);
    1.46 +
    1.47 +struct pdf_obj *pdf_new_string (char *str);
    1.48 +
    1.49 +struct pdf_obj *pdf_new_integer (unsigned long val);
    1.50 +
    1.51 +struct pdf_obj *pdf_new_real (double val);
    1.52 +
    1.53 +
    1.54 +/* Create a new indirect object */
    1.55 +struct pdf_obj *pdf_new_ind_ref (pdf_file_handle pdf_file, struct pdf_obj *obj);
    1.56 +
    1.57 +/* get the object referenced by an indirect reference */
    1.58 +struct pdf_obj *pdf_deref_ind_obj (struct pdf_obj *ind_obj);
    1.59 +
    1.60 +
    1.61 +unsigned long pdf_get_integer (struct pdf_obj *obj);
    1.62 +void pdf_set_integer (struct pdf_obj *obj, unsigned long val);
    1.63 +
    1.64 +
    1.65 +double pdf_get_real (struct pdf_obj *obj);
    1.66 +void pdf_set_real (struct pdf_obj *obj, double val);
    1.67 +
    1.68 +
    1.69 +/* The callback will be called when the stream data is to be written to the
    1.70 +   file.  app_data will be passed as an argument to the callback. */
    1.71 +struct pdf_obj *pdf_new_stream (pdf_file_handle pdf_file,
    1.72 +				struct pdf_obj *stream_dict,
    1.73 +				pdf_stream_write_callback callback,
    1.74 +				void *app_data);
    1.75 +
    1.76 +/* The callback should call pdf_stream_write_data to write the actual
    1.77 +   stream data. */
    1.78 +void pdf_stream_write_data (pdf_file_handle pdf_file,
    1.79 +			    struct pdf_obj *stream,
    1.80 +			    char *data,
    1.81 +			    unsigned long len);
    1.82 +
    1.83 +void pdf_stream_add_filter (struct pdf_obj *stream,
    1.84 +			    char *filter_name,
    1.85 +			    struct pdf_obj *decode_parms);
    1.86 +
    1.87 +
    1.88 +/* Write the object to the file */
    1.89 +void pdf_write_obj (pdf_file_handle pdf_file, struct pdf_obj *obj);
    1.90 +
    1.91 +
    1.92 +/* Write the indirect object to the file.  For most objects this should
    1.93 +   be done by pdf_write_all_ind_obj() when the file is being closed, but for
    1.94 +   large objects such as streams, it's probably better to do it as soon as the
    1.95 +   object is complete. */
    1.96 +void pdf_write_ind_obj (pdf_file_handle pdf_file, struct pdf_obj *ind_obj);
    1.97 +
    1.98 +
    1.99 +/* Write all indirect objects that haven't already been written to the file. */
   1.100 +void pdf_write_all_ind_obj (pdf_file_handle pdf_file);
   1.101 +
   1.102 +
   1.103 +/* Write the cross reference table, and return the maximum object number */
   1.104 +unsigned long pdf_write_xref (pdf_file_handle pdf_file);