Back to index

texmacs  1.0.7.15
pdfdoc.h
Go to the documentation of this file.
00001 /*  $Header: /home/cvsroot/dvipdfmx/src/pdfdoc.h,v 1.33 2009/09/19 18:48:27 matthias Exp $
00002 
00003     This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
00004 
00005     Copyright (C) 2007 by Jin-Hwan Cho and Shunsaku Hirata,
00006     the dvipdfmx project team <dvipdfmx@project.ktug.or.kr>
00007     
00008     Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks@kettering.edu>
00009 
00010     This program is free software; you can redistribute it and/or modify
00011     it under the terms of the GNU General Public License as published by
00012     the Free Software Foundation; either version 2 of the License, or
00013     (at your option) any later version.
00014     
00015     This program is distributed in the hope that it will be useful,
00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018     GNU General Public License for more details.
00019     
00020     You should have received a copy of the GNU General Public License
00021     along with this program; if not, write to the Free Software
00022     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00023 */
00024 
00025 #ifndef _PDFDOC_H_
00026 #define _PDFDOC_H_
00027 
00028 #include "pdfobj.h"
00029 #include "pdfdev.h"
00030 
00031 #define PDF_DOC_GRABBING_NEST_MAX 4
00032 
00033 extern void     pdf_doc_set_verbose (void);
00034 
00035 extern void     pdf_open_document  (const char *filename,
00036                                 int do_encryption,
00037                                 double media_width, double media_height,
00038                                 double annot_grow_amount, int bookmark_open_depth,
00039                                 int check_gotos);
00040 extern void     pdf_close_document (void);
00041 
00042 
00043 /* PDF document metadata */
00044 extern void     pdf_doc_set_creator   (const char *creator);
00045 
00046 
00047 /* They just return PDF dictionary object.
00048  * Callers are completely responsible for doing right thing...
00049  */
00050 extern pdf_obj *pdf_doc_get_dictionary (const char *category);
00051 extern pdf_obj *pdf_doc_get_reference  (const char *category);
00052 
00053 #define pdf_doc_page_tree() pdf_doc_get_dictionary("Pages")
00054 #define pdf_doc_catalog()   pdf_doc_get_dictionary("Catalog")
00055 #define pdf_doc_docinfo()   pdf_doc_get_dictionary("Info")
00056 #define pdf_doc_names()     pdf_doc_get_dictionary("Names")
00057 #define pdf_doc_this_page() pdf_doc_get_dictionary("@THISPAGE")
00058 
00059 extern pdf_obj *pdf_doc_get_page (pdf_file *pf, long page_no, long *count_p,
00060                               pdf_rect *bbox, pdf_obj **resources_p);
00061 
00062 extern long     pdf_doc_current_page_number    (void);
00063 extern pdf_obj *pdf_doc_current_page_resources (void);
00064 
00065 extern pdf_obj *pdf_doc_ref_page (unsigned long page_no);
00066 #define pdf_doc_this_page_ref() pdf_doc_get_reference("@THISPAGE")
00067 #define pdf_doc_next_page_ref() pdf_doc_get_reference("@NEXTPAGE")
00068 #define pdf_doc_prev_page_ref() pdf_doc_get_reference("@PREVPAGE")
00069 
00070 /* Not really managing tree...
00071  * There should be something for number tree.
00072  */
00073 extern int      pdf_doc_add_names       (const char *category,
00074                                     const void *key, int keylen, pdf_obj *value);
00075 
00076 extern void     pdf_doc_set_bop_content (const char *str, unsigned length);
00077 extern void     pdf_doc_set_eop_content (const char *str, unsigned length);
00078 
00079 /* Page */
00080 extern void     pdf_doc_begin_page   (double scale, double x_origin, double y_origin);
00081 extern void     pdf_doc_end_page     (void);
00082 
00083 extern void     pdf_doc_set_mediabox (unsigned page_no, const pdf_rect *mediabox);
00084 extern void     pdf_doc_get_mediabox (unsigned page_no, pdf_rect *mediabox);
00085 
00086 extern void     pdf_doc_add_page_content  (const char *buffer, unsigned length);
00087 extern void     pdf_doc_add_page_resource (const char *category,
00088                                       const char *resource_name, pdf_obj *resources);
00089 
00090 /* Article thread */
00091 extern void     pdf_doc_begin_article (const char *article_id, pdf_obj *info);
00092 #if 0
00093 extern void     pdf_doc_end_article   (const char *article_id);  /* Do nothing... */
00094 #endif
00095 extern void     pdf_doc_make_article  (const char *article_id,
00096                                    const char **bead_order, int num_beads);
00097 extern void     pdf_doc_add_bead      (const char *article_id,
00098                                    const char *bead_id,
00099                                    long page_no, const pdf_rect *rect);
00100 
00101 /* Bookmarks */
00102 extern int      pdf_doc_bookmarks_up    (void);
00103 extern int      pdf_doc_bookmarks_down  (void);
00104 extern void     pdf_doc_bookmarks_add   (pdf_obj *dict, int is_open);
00105 extern int      pdf_doc_bookmarks_depth (void);
00106 
00107 
00108 /* Returns xobj_id of started xform. */
00109 extern int      pdf_doc_begin_grabbing (const char *ident,
00110                                    double ref_x, double ref_y,
00111                                    const pdf_rect *cropbox);
00112 extern void     pdf_doc_end_grabbing   (pdf_obj *attrib);
00113 
00114 
00115 /* Annotation */
00116 extern void     pdf_doc_add_annot   (unsigned page_no,
00117                                  const pdf_rect *rect,
00118                                  pdf_obj *annot_dict,
00119                                  int dest_is_new);
00120 
00121 /* Annotation with auto- clip and line (or page) break */
00122 extern void     pdf_doc_begin_annot (pdf_obj *dict);
00123 extern void     pdf_doc_end_annot   (void);
00124 
00125 extern void     pdf_doc_break_annot (void);
00126 extern void     pdf_doc_expand_box  (const pdf_rect *rect);
00127 
00128 /* Manual thumbnail */
00129 extern void     pdf_doc_enable_manual_thumbnails (void);
00130 
00131 #if 0
00132 /* PageLabels - */
00133 extern void     pdf_doc_set_pagelabel (long  page_start,
00134                                        const char *type,
00135                                        const void *prefix, int pfrx_len,
00136                                        long  counter_start);
00137 #endif
00138 
00139 /* Similar to bop_content */
00140 #include "pdfcolor.h"
00141 extern void     pdf_doc_set_bgcolor   (const pdf_color *color);
00142 
00143 #endif /* _PDFDOC_H_ */