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