pdf_page_label.c

changeset 131
4b8c80d77f76
child 132
ccf1c28a2940
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/pdf_page_label.c	Fri Mar 14 08:24:37 2003 +0000
     1.3 @@ -0,0 +1,72 @@
     1.4 +/*
     1.5 + * tumble: build a PDF file from image files
     1.6 + *
     1.7 + * PDF routines
     1.8 + * $Id: pdf_page_label.c,v 1.1 2003/03/14 00:24:37 eric Exp $
     1.9 + * Copyright 2003 Eric Smith <eric@brouhaha.com>
    1.10 + *
    1.11 + * This program is free software; you can redistribute it and/or modify
    1.12 + * it under the terms of the GNU General Public License version 2 as
    1.13 + * published by the Free Software Foundation.  Note that permission is
    1.14 + * not granted to redistribute this program under the terms of any
    1.15 + * other version of the General Public License.
    1.16 + *
    1.17 + * This program is distributed in the hope that it will be useful,
    1.18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.20 + * GNU General Public License for more details.
    1.21 + *
    1.22 + * You should have received a copy of the GNU General Public License
    1.23 + * along with this program; if not, write to the Free Software
    1.24 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
    1.25 + */
    1.26 +
    1.27 +
    1.28 +#include <stdbool.h>
    1.29 +#include <stdint.h>
    1.30 +#include <stdio.h>
    1.31 +#include <stdlib.h>
    1.32 +#include <string.h>
    1.33 +
    1.34 +
    1.35 +#include "bitblt.h"
    1.36 +#include "pdf.h"
    1.37 +#include "pdf_util.h"
    1.38 +#include "pdf_prim.h"
    1.39 +#include "pdf_private.h"
    1.40 +#include "pdf_name_tree.h"
    1.41 +
    1.42 +
    1.43 +void pdf_new_page_label (pdf_file_handle pdf_file,
    1.44 +			 int page_index,
    1.45 +			 int base,
    1.46 +			 int count,
    1.47 +			 char style,
    1.48 +			 char *prefix)
    1.49 +{
    1.50 +  struct pdf_obj *label_dict;
    1.51 +  char style_str [2] = { style, '\0' };
    1.52 +
    1.53 +  fprintf (stderr,
    1.54 +	   "page index %d, count %d, base %d, prefix '%s', style %c\n",
    1.55 +	   page_index, count, base,
    1.56 +	   prefix ? prefix : "NULL",
    1.57 +	   style);
    1.58 +
    1.59 +  if (! pdf_file->page_label_tree)
    1.60 +    {
    1.61 +      pdf_file->page_label_tree = pdf_new_name_tree (pdf_file, 1);
    1.62 +    }
    1.63 +
    1.64 +  label_dict = pdf_new_obj (PT_DICTIONARY);
    1.65 +  pdf_set_dict_entry (label_dict, "S", pdf_new_name (style_str));
    1.66 +  if (prefix)
    1.67 +    pdf_set_dict_entry (label_dict, "P", pdf_new_string (prefix));
    1.68 +  if (base != 1)
    1.69 +    pdf_set_dict_entry (label_dict, "St", pdf_new_integer (base));
    1.70 +
    1.71 +  pdf_add_number_tree_element (pdf_file->page_label_tree,
    1.72 +			       page_index,
    1.73 +			       label_dict);
    1.74 +}
    1.75 +