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.

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