1.1 --- a/pdf.c Thu Mar 13 11:42:46 2003 +0000 1.2 +++ b/pdf.c Thu Mar 13 11:44:34 2003 +0000 1.3 @@ -2,7 +2,7 @@ 1.4 * tumble: build a PDF file from image files 1.5 * 1.6 * PDF routines 1.7 - * $Id: pdf.c,v 1.10 2003/03/13 00:57:05 eric Exp $ 1.8 + * $Id: pdf.c,v 1.11 2003/03/13 03:44:34 eric Exp $ 1.9 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 1.10 * 1.11 * This program is free software; you can redistribute it and/or modify 1.12 @@ -98,9 +98,10 @@ 1.13 pdf_set_dict_entry (pdf_file->catalog, 1.14 "PageMode", 1.15 pdf_new_name (page_mode_string)); 1.16 + pdf_set_dict_entry (pdf_file->catalog, "PageLayout", pdf_new_name ("SinglePage")); 1.17 1.18 pdf_file->info = pdf_new_ind_ref (pdf_file, pdf_new_obj (PT_DICTIONARY)); 1.19 - pdf_set_info (pdf_file, "Producer", "tumble by Eric Smith <eric@brouhaha.com>"); 1.20 + pdf_set_info (pdf_file, "Producer", "tumble by Eric Smith -- http://tumble.brouhaha.com/"); 1.21 1.22 pdf_file->trailer_dict = pdf_new_obj (PT_DICTIONARY); 1.23 /* Size key will be added later */ 1.24 @@ -108,7 +109,11 @@ 1.25 pdf_set_dict_entry (pdf_file->trailer_dict, "Info", pdf_file->info); 1.26 1.27 /* write file header */ 1.28 - fprintf (pdf_file->f, "%%PDF-1.2\r\n"); 1.29 + fprintf (pdf_file->f, "%%PDF-1.3\r\n"); 1.30 + 1.31 + /* write comment containing 8-bit chars as a hint that the file is binary */ 1.32 + /* PDF 1.4 spec, section 3.4.1 */ 1.33 + fprintf (pdf_file->f, "%%\342\343\317\323\r\n"); 1.34 1.35 return (pdf_file); 1.36 } 1.37 @@ -193,6 +198,14 @@ 1.38 pdf_set_dict_entry (page->page_dict, "MediaBox", page->media_box); 1.39 pdf_set_dict_entry (page->page_dict, "Resources", page->resources); 1.40 1.41 + if (pdf_get_integer (pdf_file->root->count) == 0) 1.42 + { 1.43 + struct pdf_obj *dest_array = pdf_new_obj (PT_ARRAY); 1.44 + pdf_add_array_elem (dest_array, page->page_dict); 1.45 + pdf_add_array_elem (dest_array, pdf_new_name ("Fit")); 1.46 + pdf_set_dict_entry (pdf_file->catalog, "OpenAction", dest_array); 1.47 + } 1.48 + 1.49 /* $$$ currently only support a single-level pages tree */ 1.50 pdf_set_dict_entry (page->page_dict, "Parent", pdf_file->root->pages_dict); 1.51 pdf_add_array_elem (pdf_file->root->kids, page->page_dict); 1.52 @@ -213,6 +226,3 @@ 1.53 { 1.54 } 1.55 1.56 -void pdf_bookmark (pdf_page_handle pdf_page, int level, char *name) 1.57 -{ 1.58 -}