Wed, 05 Mar 2003 02:09:49 +0000
Added support for PageMode.
pdf.c | file | annotate | diff | revisions | |
pdf.h | file | annotate | diff | revisions | |
t2p.c | file | annotate | diff | revisions | |
tumble.c | file | annotate | diff | revisions |
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>");
2.1 --- a/pdf.h Wed Mar 05 01:58:36 2003 +0000 2.2 +++ b/pdf.h Wed Mar 05 02:09:49 2003 +0000 2.3 @@ -4,7 +4,7 @@ 2.4 * will be compressed using ITU-T T.6 (G4) fax encoding. 2.5 * 2.6 * PDF routines 2.7 - * $Id: pdf.h,v 1.5 2003/03/04 17:58:36 eric Exp $ 2.8 + * $Id: pdf.h,v 1.6 2003/03/04 18:09:49 eric Exp $ 2.9 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 2.10 * 2.11 * This program is free software; you can redistribute it and/or modify 2.12 @@ -31,9 +31,14 @@ 2.13 typedef struct pdf_bookmark *pdf_bookmark_handle; 2.14 2.15 2.16 +#define PDF_PAGE_MODE_USE_NONE 0 2.17 +#define PDF_PAGE_MODE_USE_OUTLINES 1 2.18 +#define PDF_PAGE_MODE_USE_THUMBS 2 /* not yet implemented */ 2.19 + 2.20 + 2.21 void pdf_init (void); 2.22 2.23 -pdf_file_handle pdf_create (char *filename); 2.24 +pdf_file_handle pdf_create (char *filename, int page_mode); 2.25 2.26 void pdf_close (pdf_file_handle pdf_file); 2.27
3.1 --- a/t2p.c Wed Mar 05 01:58:36 2003 +0000 3.2 +++ b/t2p.c Wed Mar 05 02:09:49 2003 +0000 3.3 @@ -4,7 +4,7 @@ 3.4 * will be compressed using ITU-T T.6 (G4) fax encoding. 3.5 * 3.6 * Main program 3.7 - * $Id: t2p.c,v 1.25 2003/03/04 17:58:36 eric Exp $ 3.8 + * $Id: t2p.c,v 1.26 2003/03/04 18:09:49 eric Exp $ 3.9 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 3.10 * 3.11 * This program is free software; you can redistribute it and/or modify 3.12 @@ -198,7 +198,7 @@ 3.13 return (0); 3.14 } 3.15 3.16 - o->pdf = pdf_create (name); 3.17 + o->pdf = pdf_create (name, PDF_PAGE_MODE_USE_OUTLINES); 3.18 if (! o->pdf) 3.19 { 3.20 fprintf (stderr, "can't open output file '%s'\n", name);
4.1 --- a/tumble.c Wed Mar 05 01:58:36 2003 +0000 4.2 +++ b/tumble.c Wed Mar 05 02:09:49 2003 +0000 4.3 @@ -4,7 +4,7 @@ 4.4 * will be compressed using ITU-T T.6 (G4) fax encoding. 4.5 * 4.6 * Main program 4.7 - * $Id: tumble.c,v 1.25 2003/03/04 17:58:36 eric Exp $ 4.8 + * $Id: tumble.c,v 1.26 2003/03/04 18:09:49 eric Exp $ 4.9 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 4.10 * 4.11 * This program is free software; you can redistribute it and/or modify 4.12 @@ -198,7 +198,7 @@ 4.13 return (0); 4.14 } 4.15 4.16 - o->pdf = pdf_create (name); 4.17 + o->pdf = pdf_create (name, PDF_PAGE_MODE_USE_OUTLINES); 4.18 if (! o->pdf) 4.19 { 4.20 fprintf (stderr, "can't open output file '%s'\n", name);