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