pdf.h

Thu, 20 Mar 2003 07:53:09 +0000

author
eric
date
Thu, 20 Mar 2003 07:53:09 +0000
changeset 147
090af3709920
parent 141
752599b50ff3
child 166
301f6f17c364
permissions
-rw-r--r--

added color, width_samples, height_samples areguments to pdf_write_jpeg_image().

     1 /*
     2  * tumble: build a PDF file from image files
     3  *
     4  * PDF routines
     5  * $Id: pdf.h,v 1.13 2003/03/19 23:53:09 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 /* Acrobat default units aren't really points, but they're close. */
    26 #define POINTS_PER_INCH 72.0
    28 /* page size limited by Acrobat Reader to 45 inches on a side */
    29 #define PAGE_MAX_INCHES 45
    30 #define PAGE_MAX_POINTS (PAGE_MAX_INCHES * POINTS_PER_INCH)
    33 typedef struct pdf_file *pdf_file_handle;
    35 typedef struct pdf_page *pdf_page_handle;
    37 typedef struct pdf_bookmark *pdf_bookmark_handle;
    40 #define PDF_PAGE_MODE_USE_NONE     0
    41 #define PDF_PAGE_MODE_USE_OUTLINES 1  /* if no outlines, will use NONE */
    42 #define PDF_PAGE_MODE_USE_THUMBS   2  /* not yet implemented */
    45 void pdf_init (void);
    47 pdf_file_handle pdf_create (char *filename);
    49 void pdf_close (pdf_file_handle pdf_file, int page_mode);
    51 void pdf_set_author   (pdf_file_handle pdf_file, char *author);
    52 void pdf_set_creator  (pdf_file_handle pdf_file, char *author);
    53 void pdf_set_title    (pdf_file_handle pdf_file, char *author);
    54 void pdf_set_subject  (pdf_file_handle pdf_file, char *author);
    55 void pdf_set_keywords (pdf_file_handle pdf_file, char *author);
    58 /* width and height in units of 1/72 inch */
    59 pdf_page_handle pdf_new_page (pdf_file_handle pdf_file,
    60 			      double width,
    61 			      double height);
    63 void pdf_close_page (pdf_page_handle pdf_page);
    66 void pdf_write_text (pdf_page_handle pdf_page);
    69 /* The length of the data must be Rows * rowbytes.
    70    Note that rowbytes must be at least (Columns+7)/8, but may be arbitrarily
    71    large. */
    72 void pdf_write_g4_fax_image (pdf_page_handle pdf_page,
    73 			     double x,
    74 			     double y,
    75 			     double width,
    76 			     double height,
    77 			     Bitmap *bitmap,
    78 			     bool ImageMask,
    79 			     double r, /* RGB fill color, only for ImageMask */
    80 			     double g,
    81 			     double b,
    82 			     bool BlackIs1);    /* boolean, typ. false */
    85 void pdf_write_jpeg_image (pdf_page_handle pdf_page,
    86 			   double x,
    87 			   double y,
    88 			   double width,
    89 			   double height,
    90 			   bool color,
    91 			   uint32_t width_samples,
    92 			   uint32_t height_samples,
    93 			   FILE *f);
    96 void pdf_set_page_number (pdf_page_handle pdf_page, char *page_number);
    98 /* Create a new bookmark, under the specified parent, or at the top
    99    level if parent is NULL. */
   100 pdf_bookmark_handle pdf_new_bookmark (pdf_bookmark_handle parent,
   101 				      char *title,
   102 				      bool open,
   103 				      pdf_page_handle pdf_page);
   106 void pdf_new_page_label (pdf_file_handle pdf_file,
   107 			 int page_index,
   108 			 int base,
   109 			 int count,
   110 			 char style,
   111 			 char *prefix);