pdf.c

changeset 75
29d7cbc7c251
parent 67
7add7411c1c2
child 85
dcfd1d4b5c24
     1.1 --- a/pdf.c	Wed Mar 05 01:58:36 2003 +0000
     1.2 +++ b/pdf.c	Wed Mar 05 02:09:49 2003 +0000
     1.3 @@ -4,7 +4,7 @@
     1.4   *      will be compressed using ITU-T T.6 (G4) fax encoding.
     1.5   *
     1.6   * PDF routines
     1.7 - * $Id: pdf.c,v 1.4 2003/02/21 02:49:11 eric Exp $
     1.8 + * $Id: pdf.c,v 1.5 2003/03/04 18:09:49 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 @@ -64,9 +64,19 @@
    1.13  }
    1.14  
    1.15  
    1.16 -pdf_file_handle pdf_create (char *filename)
    1.17 +pdf_file_handle pdf_create (char *filename, int page_mode)
    1.18  {
    1.19    pdf_file_handle pdf_file;
    1.20 +  char *page_mode_string;
    1.21 +
    1.22 +  switch (page_mode)
    1.23 +    {
    1.24 +    case PDF_PAGE_MODE_USE_NONE:      page_mode_string = "UseNone";     break;
    1.25 +    case PDF_PAGE_MODE_USE_OUTLINES:  page_mode_string = "UseOutlines"; break;
    1.26 +    case PDF_PAGE_MODE_USE_THUMBS:    page_mode_string = "UseThumbs";   break;
    1.27 +    default:
    1.28 +      pdf_fatal ("invalid page mode\n");
    1.29 +    }
    1.30  
    1.31    pdf_file = pdf_calloc (1, sizeof (struct pdf_file));
    1.32  
    1.33 @@ -81,8 +91,10 @@
    1.34    pdf_file->catalog = pdf_new_ind_ref (pdf_file, pdf_new_obj (PT_DICTIONARY));
    1.35    pdf_set_dict_entry (pdf_file->catalog, "Type", pdf_new_name ("Catalog"));
    1.36    pdf_set_dict_entry (pdf_file->catalog, "Pages", pdf_file->root->pages_dict);
    1.37 -  /* Outlines dictionary will be created later if needed*/
    1.38 -  pdf_set_dict_entry (pdf_file->catalog, "PageMode", pdf_new_name ("UseNone"));
    1.39 +  /* Outlines dictionary will be created later if needed */
    1.40 +  pdf_set_dict_entry (pdf_file->catalog,
    1.41 +		      "PageMode",
    1.42 +		      pdf_new_name (page_mode_string));
    1.43  
    1.44    pdf_file->info    = pdf_new_ind_ref (pdf_file, pdf_new_obj (PT_DICTIONARY));
    1.45    pdf_set_info (pdf_file, "Producer", "t2p, Copyright 2003 Eric Smith <eric@brouhaha.com>");