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