1.1 --- a/semantics.c Tue Jan 01 05:41:03 2002 +0000 1.2 +++ b/semantics.c Tue Jan 01 06:11:43 2002 +0000 1.3 @@ -52,6 +52,8 @@ 1.4 including those from subcontexts */ 1.5 1.6 char *output_file; 1.7 + pdf_file_attributes_t file_attributes; 1.8 + 1.9 bookmark_t *first_bookmark; 1.10 bookmark_t *last_bookmark; 1.11 1.12 @@ -285,8 +287,38 @@ 1.13 { 1.14 output_clone (); 1.15 last_output_context->output_file = name; 1.16 + last_output_context->file_attributes.author = NULL; 1.17 + last_output_context->file_attributes.creator = NULL; 1.18 + last_output_context->file_attributes.title = NULL; 1.19 + last_output_context->file_attributes.subject = NULL; 1.20 + last_output_context->file_attributes.keywords = NULL; 1.21 }; 1.22 1.23 +void output_set_author (char *author) 1.24 +{ 1.25 + last_output_context->file_attributes.author = author; 1.26 +} 1.27 + 1.28 +void output_set_creator (char *creator) 1.29 +{ 1.30 + last_output_context->file_attributes.creator = creator; 1.31 +} 1.32 + 1.33 +void output_set_title (char *title) 1.34 +{ 1.35 + last_output_context->file_attributes.title = title; 1.36 +} 1.37 + 1.38 +void output_set_subject (char *subject) 1.39 +{ 1.40 + last_output_context->file_attributes.subject = subject; 1.41 +} 1.42 + 1.43 +void output_set_keywords (char *keywords) 1.44 +{ 1.45 + last_output_context->file_attributes.keywords = keywords; 1.46 +} 1.47 + 1.48 void output_set_bookmark (char *name) 1.49 { 1.50 bookmark_t *new_bookmark; 1.51 @@ -408,7 +440,16 @@ 1.52 for (; context; context = context->parent) 1.53 if (context->output_file) 1.54 return (context->output_file); 1.55 - fprintf (stderr, "no output file name found\n"); 1.56 + fprintf (stderr, "no output file found\n"); 1.57 + exit (2); 1.58 +} 1.59 + 1.60 +static pdf_file_attributes_t *get_output_file_attributes (output_context_t *context) 1.61 +{ 1.62 + for (; context; context = context->parent) 1.63 + if (context->output_file) 1.64 + return (& context->file_attributes); 1.65 + fprintf (stderr, "no output file found\n"); 1.66 exit (2); 1.67 } 1.68 1.69 @@ -557,7 +598,8 @@ 1.70 else 1.71 page = first_output_page; 1.72 p = 0; 1.73 - if (! open_pdf_output_file (get_output_file (page->output_context))) 1.74 + if (! open_pdf_output_file (get_output_file (page->output_context), 1.75 + get_output_file_attributes (page->output_context))) 1.76 return (0); 1.77 page_label = get_output_page_label (page->output_context); 1.78 process_page_numbers (page_index,