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