diff --git a/t2p.c b/t2p.c index f8388b7..6aa2243 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.30 2003/03/12 19:38:59 eric Exp $ + * $Id: t2p.c,v 1.31 2003/03/12 23:59:10 eric Exp $ * Copyright 2001, 2002, 2003 Eric Smith * * This program is free software; you can redistribute it and/or modify @@ -198,7 +198,9 @@ bool open_pdf_output_file (char *name, return (0); } - o->pdf = pdf_create (name, PDF_PAGE_MODE_USE_OUTLINES); + o->pdf = pdf_create (name, (attributes->has_bookmarks ? + PDF_PAGE_MODE_USE_OUTLINES : + PDF_PAGE_MODE_USE_NONE)); if (! o->pdf) { fprintf (stderr, "can't open output file '%s'\n", name); @@ -461,6 +463,9 @@ bool process_tiff_page (int image, /* range 1 .. n */ page = pdf_new_page (out->pdf, width_points, height_points); +#if 0 + pdf_write_text (page); +#else pdf_write_g4_fax_image (page, 0, 0, /* x, y */ width_points, height_points, @@ -468,6 +473,7 @@ bool process_tiff_page (int image, /* range 1 .. n */ 0, /* ImageMask */ 0, 0, 0, /* r, g, b */ 0); /* BlackIs1 */ +#endif while (bookmarks) { @@ -604,6 +610,8 @@ void main_args (char *out_fn, memset (& input_attributes, 0, sizeof (input_attributes)); memset (& output_attributes, 0, sizeof (output_attributes)); + output_attributes.has_bookmarks = (bookmark_fmt != NULL); + if (! open_pdf_output_file (out_fn, & output_attributes)) fatal (3, "error opening output file \"%s\"\n", out_fn); for (i = 0; i < inf_count; i++) diff --git a/t2p.h b/t2p.h index d050555..ffe91d7 100644 --- a/t2p.h +++ b/t2p.h @@ -3,7 +3,7 @@ * bilevel image files. The images in the resulting PDF file * will be compressed using ITU-T T.6 (G4) fax encoding. * - * $Id: t2p.h,v 1.11 2003/01/21 10:30:49 eric Exp $ + * $Id: t2p.h,v 1.12 2003/03/12 23:59:10 eric Exp $ * Copyright 2001, 2002, 2003 Eric Smith * * This program is free software; you can redistribute it and/or modify @@ -52,6 +52,7 @@ typedef struct char *title; char *subject; char *keywords; + bool has_bookmarks; } pdf_file_attributes_t; bool open_pdf_output_file (char *name, diff --git a/tumble.c b/tumble.c index de34b85..48f5d9c 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.30 2003/03/12 19:38:59 eric Exp $ + * $Id: tumble.c,v 1.31 2003/03/12 23:59:10 eric Exp $ * Copyright 2001, 2002, 2003 Eric Smith * * This program is free software; you can redistribute it and/or modify @@ -198,7 +198,9 @@ bool open_pdf_output_file (char *name, return (0); } - o->pdf = pdf_create (name, PDF_PAGE_MODE_USE_OUTLINES); + o->pdf = pdf_create (name, (attributes->has_bookmarks ? + PDF_PAGE_MODE_USE_OUTLINES : + PDF_PAGE_MODE_USE_NONE)); if (! o->pdf) { fprintf (stderr, "can't open output file '%s'\n", name); @@ -461,6 +463,9 @@ bool process_tiff_page (int image, /* range 1 .. n */ page = pdf_new_page (out->pdf, width_points, height_points); +#if 0 + pdf_write_text (page); +#else pdf_write_g4_fax_image (page, 0, 0, /* x, y */ width_points, height_points, @@ -468,6 +473,7 @@ bool process_tiff_page (int image, /* range 1 .. n */ 0, /* ImageMask */ 0, 0, 0, /* r, g, b */ 0); /* BlackIs1 */ +#endif while (bookmarks) { @@ -604,6 +610,8 @@ void main_args (char *out_fn, memset (& input_attributes, 0, sizeof (input_attributes)); memset (& output_attributes, 0, sizeof (output_attributes)); + output_attributes.has_bookmarks = (bookmark_fmt != NULL); + if (! open_pdf_output_file (out_fn, & output_attributes)) fatal (3, "error opening output file \"%s\"\n", out_fn); for (i = 0; i < inf_count; i++) diff --git a/tumble.h b/tumble.h index abce36d..35a30a4 100644 --- a/tumble.h +++ b/tumble.h @@ -3,7 +3,7 @@ * bilevel image files. The images in the resulting PDF file * will be compressed using ITU-T T.6 (G4) fax encoding. * - * $Id: tumble.h,v 1.11 2003/01/21 10:30:49 eric Exp $ + * $Id: tumble.h,v 1.12 2003/03/12 23:59:10 eric Exp $ * Copyright 2001, 2002, 2003 Eric Smith * * This program is free software; you can redistribute it and/or modify @@ -52,6 +52,7 @@ typedef struct char *title; char *subject; char *keywords; + bool has_bookmarks; } pdf_file_attributes_t; bool open_pdf_output_file (char *name,