diff --git a/pdf.c b/pdf.c index 6dd5f55..cdbe88b 100644 --- a/pdf.c +++ b/pdf.c @@ -4,7 +4,7 @@ * will be compressed using ITU-T T.6 (G4) fax encoding. * * PDF routines - * $Id: pdf.c,v 1.4 2003/02/21 02:49:11 eric Exp $ + * $Id: pdf.c,v 1.5 2003/03/04 18:09:49 eric Exp $ * Copyright 2001, 2002, 2003 Eric Smith * * This program is free software; you can redistribute it and/or modify @@ -64,9 +64,19 @@ struct pdf_pages *pdf_new_pages (pdf_file_handle pdf_file) } -pdf_file_handle pdf_create (char *filename) +pdf_file_handle pdf_create (char *filename, int page_mode) { pdf_file_handle pdf_file; + char *page_mode_string; + + switch (page_mode) + { + case PDF_PAGE_MODE_USE_NONE: page_mode_string = "UseNone"; break; + case PDF_PAGE_MODE_USE_OUTLINES: page_mode_string = "UseOutlines"; break; + case PDF_PAGE_MODE_USE_THUMBS: page_mode_string = "UseThumbs"; break; + default: + pdf_fatal ("invalid page mode\n"); + } pdf_file = pdf_calloc (1, sizeof (struct pdf_file)); @@ -81,8 +91,10 @@ pdf_file_handle pdf_create (char *filename) pdf_file->catalog = pdf_new_ind_ref (pdf_file, pdf_new_obj (PT_DICTIONARY)); pdf_set_dict_entry (pdf_file->catalog, "Type", pdf_new_name ("Catalog")); pdf_set_dict_entry (pdf_file->catalog, "Pages", pdf_file->root->pages_dict); - /* Outlines dictionary will be created later if needed*/ - pdf_set_dict_entry (pdf_file->catalog, "PageMode", pdf_new_name ("UseNone")); + /* Outlines dictionary will be created later if needed */ + pdf_set_dict_entry (pdf_file->catalog, + "PageMode", + pdf_new_name (page_mode_string)); pdf_file->info = pdf_new_ind_ref (pdf_file, pdf_new_obj (PT_DICTIONARY)); pdf_set_info (pdf_file, "Producer", "t2p, Copyright 2003 Eric Smith "); diff --git a/pdf.h b/pdf.h index 9489605..24207b7 100644 --- a/pdf.h +++ b/pdf.h @@ -4,7 +4,7 @@ * will be compressed using ITU-T T.6 (G4) fax encoding. * * PDF routines - * $Id: pdf.h,v 1.5 2003/03/04 17:58:36 eric Exp $ + * $Id: pdf.h,v 1.6 2003/03/04 18:09:49 eric Exp $ * Copyright 2001, 2002, 2003 Eric Smith * * This program is free software; you can redistribute it and/or modify @@ -31,9 +31,14 @@ typedef struct pdf_page *pdf_page_handle; typedef struct pdf_bookmark *pdf_bookmark_handle; +#define PDF_PAGE_MODE_USE_NONE 0 +#define PDF_PAGE_MODE_USE_OUTLINES 1 +#define PDF_PAGE_MODE_USE_THUMBS 2 /* not yet implemented */ + + void pdf_init (void); -pdf_file_handle pdf_create (char *filename); +pdf_file_handle pdf_create (char *filename, int page_mode); void pdf_close (pdf_file_handle pdf_file); diff --git a/t2p.c b/t2p.c index e2a7e43..c8b9da2 100644 --- a/t2p.c +++ b/t2p.c @@ -4,7 +4,7 @@ * will be compressed using ITU-T T.6 (G4) fax encoding. * * Main program - * $Id: t2p.c,v 1.25 2003/03/04 17:58:36 eric Exp $ + * $Id: t2p.c,v 1.26 2003/03/04 18:09:49 eric Exp $ * Copyright 2001, 2002, 2003 Eric Smith * * This program is free software; you can redistribute it and/or modify @@ -198,7 +198,7 @@ bool open_pdf_output_file (char *name, return (0); } - o->pdf = pdf_create (name); + o->pdf = pdf_create (name, PDF_PAGE_MODE_USE_OUTLINES); if (! o->pdf) { fprintf (stderr, "can't open output file '%s'\n", name); diff --git a/tumble.c b/tumble.c index 7e3cac5..32a0a32 100644 --- a/tumble.c +++ b/tumble.c @@ -4,7 +4,7 @@ * will be compressed using ITU-T T.6 (G4) fax encoding. * * Main program - * $Id: tumble.c,v 1.25 2003/03/04 17:58:36 eric Exp $ + * $Id: tumble.c,v 1.26 2003/03/04 18:09:49 eric Exp $ * Copyright 2001, 2002, 2003 Eric Smith * * This program is free software; you can redistribute it and/or modify @@ -198,7 +198,7 @@ bool open_pdf_output_file (char *name, return (0); } - o->pdf = pdf_create (name); + o->pdf = pdf_create (name, PDF_PAGE_MODE_USE_OUTLINES); if (! o->pdf) { fprintf (stderr, "can't open output file '%s'\n", name);