pspp-output: Use page setup from command line by default.
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 6 May 2023 16:25:45 +0000 (09:25 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 6 May 2023 16:25:45 +0000 (09:25 -0700)
pspp-output was ignoring the page setup specified on the command line in
favor of the one embedded in an SPV file.  This is usually wrong, and in
particular it screwed up the examples in the manual by causing them to be
broken across multiple PNG output files, only the first of which was
actually shown in the manual.

doc/pspp-output.texi
utilities/pspp-output.1
utilities/pspp-output.c

index b580690dc5708f20cac83a9813838e6dce378055..cb56d1ff84baad681a1ddb360099ae728e6c6d61 100644 (file)
@@ -121,6 +121,13 @@ the destination is written as best it can, even with errors.
 Reads a table style from @var{file} and applies it to all of the
 output tables.  The file should be a TableLook @file{.stt} or
 @file{.tlo} file.
+
+@item --use-page-setup
+By default, the @code{convert} command uses the default page setup
+(for example, page size and margins) for @var{destination}, or the one
+specified with @option{-O} options, if any.  Specify this option to
+ignore these sources of page setup in favor of the one embedded in the
+SPV, if any.
 @end table
 
 @node The pspp-output get-table-look Command
index 5fd913789c0051306d12a9f62945a08a6be9fee0..4addb530c44a1c4de5bf2e5aa6eba9322f381e31 100644 (file)
@@ -102,6 +102,12 @@ write the output as best it can, even with errors.
 Reads a table style from \fIfile\fR and applies it to all of the
 output tables.  The file should a TableLook \fB.stt\fR or \fB.tlo\fR
 file.
+.IP \fB\-\-use\-page\-setup\fR
+By default, the \fBconvert\fR command uses the default page setup
+(for example, page size and margins) for \fIdestination\fR, or the
+one specified with \fB\-O\fR options, if any.  Specify this option
+to ignore these sources of page setup in favor of the one embedded
+in the SPV, if any.
 .SS The \fBget\-table\-look\fR command
 When invoked as \fBpspp\-output get\-table\-look \fIsource
 destination\fR, \fBpspp\-output\fR reads SPV file \fIsource\fR,
index 70d5d0bb7c6ceba36f99511c11703373e5fde85c..74e541aadf1789f449607ac2208c43c9b34fbdf5 100644 (file)
@@ -89,6 +89,9 @@ static bool force;
 /* --table-look: TableLook to replace table style for conversion. */
 static struct pivot_table_look *table_look;
 
+/* --use-page-setup: Use page setup from .spv file rather than command line. */
+static bool use_page_setup;
+
 /* Number of warnings issued. */
 static size_t n_warnings;
 
@@ -239,7 +242,8 @@ run_convert (int argc UNUSED, char **argv)
 
   if (ps)
     {
-      output_set_page_setup (ps);
+      if (use_page_setup)
+        output_set_page_setup (ps);
       page_setup_destroy (ps);
     }
   output_item_submit_children (root);
@@ -1012,6 +1016,7 @@ parse_options (int argc, char *argv[])
           OPT_NO_ASCII_ONLY,
           OPT_UTF8_ONLY,
           OPT_TABLE_LOOK,
+          OPT_USE_PAGE_SETUP,
           OPT_HELP_DEVELOPER,
         };
       static const struct option long_options[] =
@@ -1034,6 +1039,7 @@ parse_options (int argc, char *argv[])
           /* "convert" command options. */
           { "force", no_argument, NULL, 'f' },
           { "table-look", required_argument, NULL, OPT_TABLE_LOOK },
+          { "use-page-setup", no_argument, NULL, OPT_USE_PAGE_SETUP },
 
           /* "dump-light-table" command options. */
           { "sort", no_argument, NULL, OPT_SORT },
@@ -1118,6 +1124,10 @@ parse_options (int argc, char *argv[])
           parse_table_look (optarg);
           break;
 
+        case OPT_USE_PAGE_SETUP:
+          use_page_setup = true;
+          break;
+
         case OPT_NO_ASCII_ONLY:
           exclude_ascii_only = true;
           break;
@@ -1194,6 +1204,7 @@ The following options override \"convert\" behavior:\n\
   -O OPTION=VALUE           set output option\n\
   -f, --force               keep output file even given errors\n\
   --table-look=FILE         override tables' style with TableLook from FILE\n\
+  --use-page-setup          use page setup from SOURCE\n\
 Other options:\n\
   --help              display this help and exit\n\
   --help-developer    display help for developer commands and exit\n\