don't use page mode USE_OUTLINES if there are no outline entries.

Thu, 13 Mar 2003 07:59:10 +0000

author
eric
date
Thu, 13 Mar 2003 07:59:10 +0000
changeset 121
e50c7f76f2f6
parent 120
26cbb0d7782b
child 122
cdde8bcc17fe

don't use page mode USE_OUTLINES if there are no outline entries.

t2p.c file | annotate | diff | revisions
t2p.h file | annotate | diff | revisions
tumble.c file | annotate | diff | revisions
tumble.h file | annotate | diff | revisions
     1.1 --- a/t2p.c	Thu Mar 13 07:57:35 2003 +0000
     1.2 +++ b/t2p.c	Thu Mar 13 07:59:10 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   * Main program
     1.7 - * $Id: t2p.c,v 1.30 2003/03/12 19:38:59 eric Exp $
     1.8 + * $Id: t2p.c,v 1.31 2003/03/12 23:59:10 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 @@ -198,7 +198,9 @@
    1.13        return (0);
    1.14      }
    1.15  
    1.16 -  o->pdf = pdf_create (name, PDF_PAGE_MODE_USE_OUTLINES);
    1.17 +  o->pdf = pdf_create (name, (attributes->has_bookmarks ?
    1.18 +			      PDF_PAGE_MODE_USE_OUTLINES :
    1.19 +			      PDF_PAGE_MODE_USE_NONE));
    1.20    if (! o->pdf)
    1.21      {
    1.22        fprintf (stderr, "can't open output file '%s'\n", name);
    1.23 @@ -461,6 +463,9 @@
    1.24  
    1.25    page = pdf_new_page (out->pdf, width_points, height_points);
    1.26  
    1.27 +#if 0
    1.28 +  pdf_write_text (page);
    1.29 +#else
    1.30    pdf_write_g4_fax_image (page,
    1.31  			  0, 0,  /* x, y */
    1.32  			  width_points, height_points,
    1.33 @@ -468,6 +473,7 @@
    1.34  			  0, /* ImageMask */
    1.35  			  0, 0, 0,  /* r, g, b */
    1.36  			  0); /* BlackIs1 */
    1.37 +#endif
    1.38  
    1.39    while (bookmarks)
    1.40      {
    1.41 @@ -604,6 +610,8 @@
    1.42    memset (& input_attributes, 0, sizeof (input_attributes));
    1.43    memset (& output_attributes, 0, sizeof (output_attributes));
    1.44  
    1.45 +  output_attributes.has_bookmarks = (bookmark_fmt != NULL);
    1.46 +
    1.47    if (! open_pdf_output_file (out_fn, & output_attributes))
    1.48      fatal (3, "error opening output file \"%s\"\n", out_fn);
    1.49    for (i = 0; i < inf_count; i++)
     2.1 --- a/t2p.h	Thu Mar 13 07:57:35 2003 +0000
     2.2 +++ b/t2p.h	Thu Mar 13 07:59:10 2003 +0000
     2.3 @@ -3,7 +3,7 @@
     2.4   *      bilevel image files.  The images in the resulting PDF file
     2.5   *      will be compressed using ITU-T T.6 (G4) fax encoding.
     2.6   *
     2.7 - * $Id: t2p.h,v 1.11 2003/01/21 10:30:49 eric Exp $
     2.8 + * $Id: t2p.h,v 1.12 2003/03/12 23:59:10 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 @@ -52,6 +52,7 @@
    2.13    char *title;
    2.14    char *subject;
    2.15    char *keywords;
    2.16 +  bool has_bookmarks;
    2.17  } pdf_file_attributes_t;
    2.18  
    2.19  bool open_pdf_output_file (char *name,
     3.1 --- a/tumble.c	Thu Mar 13 07:57:35 2003 +0000
     3.2 +++ b/tumble.c	Thu Mar 13 07:59:10 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: tumble.c,v 1.30 2003/03/12 19:38:59 eric Exp $
     3.8 + * $Id: tumble.c,v 1.31 2003/03/12 23:59:10 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,9 @@
    3.13        return (0);
    3.14      }
    3.15  
    3.16 -  o->pdf = pdf_create (name, PDF_PAGE_MODE_USE_OUTLINES);
    3.17 +  o->pdf = pdf_create (name, (attributes->has_bookmarks ?
    3.18 +			      PDF_PAGE_MODE_USE_OUTLINES :
    3.19 +			      PDF_PAGE_MODE_USE_NONE));
    3.20    if (! o->pdf)
    3.21      {
    3.22        fprintf (stderr, "can't open output file '%s'\n", name);
    3.23 @@ -461,6 +463,9 @@
    3.24  
    3.25    page = pdf_new_page (out->pdf, width_points, height_points);
    3.26  
    3.27 +#if 0
    3.28 +  pdf_write_text (page);
    3.29 +#else
    3.30    pdf_write_g4_fax_image (page,
    3.31  			  0, 0,  /* x, y */
    3.32  			  width_points, height_points,
    3.33 @@ -468,6 +473,7 @@
    3.34  			  0, /* ImageMask */
    3.35  			  0, 0, 0,  /* r, g, b */
    3.36  			  0); /* BlackIs1 */
    3.37 +#endif
    3.38  
    3.39    while (bookmarks)
    3.40      {
    3.41 @@ -604,6 +610,8 @@
    3.42    memset (& input_attributes, 0, sizeof (input_attributes));
    3.43    memset (& output_attributes, 0, sizeof (output_attributes));
    3.44  
    3.45 +  output_attributes.has_bookmarks = (bookmark_fmt != NULL);
    3.46 +
    3.47    if (! open_pdf_output_file (out_fn, & output_attributes))
    3.48      fatal (3, "error opening output file \"%s\"\n", out_fn);
    3.49    for (i = 0; i < inf_count; i++)
     4.1 --- a/tumble.h	Thu Mar 13 07:57:35 2003 +0000
     4.2 +++ b/tumble.h	Thu Mar 13 07:59:10 2003 +0000
     4.3 @@ -3,7 +3,7 @@
     4.4   *      bilevel image files.  The images in the resulting PDF file
     4.5   *      will be compressed using ITU-T T.6 (G4) fax encoding.
     4.6   *
     4.7 - * $Id: tumble.h,v 1.11 2003/01/21 10:30:49 eric Exp $
     4.8 + * $Id: tumble.h,v 1.12 2003/03/12 23:59:10 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 @@ -52,6 +52,7 @@
    4.13    char *title;
    4.14    char *subject;
    4.15    char *keywords;
    4.16 +  bool has_bookmarks;
    4.17  } pdf_file_attributes_t;
    4.18  
    4.19  bool open_pdf_output_file (char *name,