aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--manual/qpdf-manual.xml9
-rw-r--r--qpdf/qpdf.cc16
-rw-r--r--qpdf/qtest/qpdf.test8
-rw-r--r--qpdf/qtest/qpdf/split-pages-group.out3
5 files changed, 35 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index eacde282..3b7eb32a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2017-08-12 Jay Berkenbilt <ejb@ql.org>
+ * Provide --verbose option that causes qpdf to print an indication
+ of what files it is writing.
+
* Change --single-pages to --split-pages and make it take an
optional argument specifying the number of pages per file.
diff --git a/manual/qpdf-manual.xml b/manual/qpdf-manual.xml
index 3f3415c8..d05af020 100644
--- a/manual/qpdf-manual.xml
+++ b/manual/qpdf-manual.xml
@@ -285,6 +285,15 @@ make
</listitem>
</varlistentry>
<varlistentry>
+ <term><option>--verbose</option></term>
+ <listitem>
+ <para>
+ Increase verbosity of output. For now, this just prints some
+ indication of any file that it creates.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><option>--linearize</option></term>
<listitem>
<para>
diff --git a/qpdf/qpdf.cc b/qpdf/qpdf.cc
index f3051eb4..b68434a9 100644
--- a/qpdf/qpdf.cc
+++ b/qpdf/qpdf.cc
@@ -44,6 +44,7 @@ struct Options
linearize(false),
decrypt(false),
split_pages(0),
+ verbose(false),
copy_encryption(false),
encryption_file(0),
encryption_file_password(0),
@@ -99,6 +100,7 @@ struct Options
bool linearize;
bool decrypt;
int split_pages;
+ bool verbose;
bool copy_encryption;
char const* encryption_file;
char const* encryption_file_password;
@@ -198,6 +200,7 @@ Basic Options\n\
-------------\n\
\n\
--password=password specify a password for accessing encrypted files\n\
+--verbose provide additional informational output\n\
--linearize generated a linearized (web optimized) file\n\
--copy-encryption=file copy encryption parameters from specified file\n\
--encryption-file-password=password\n\
@@ -1341,6 +1344,10 @@ static void parse_options(int argc, char* argv[], Options& o)
int n = ((parameter == 0) ? 1 : atoi(parameter));
o.split_pages = n;
}
+ else if (strcmp(arg, "verbose") == 0)
+ {
+ o.verbose = true;
+ }
else if (strcmp(arg, "deterministic-id") == 0)
{
o.deterministic_id = true;
@@ -2033,6 +2040,10 @@ static void write_outfile(QPDF& pdf, Options& o)
QPDFWriter w(outpdf, outfile.c_str());
set_writer_options(outpdf, o, w);
w.write();
+ if (o.verbose)
+ {
+ std::cout << whoami << ": wrote file " << outfile << std::endl;
+ }
}
}
else
@@ -2044,6 +2055,11 @@ static void write_outfile(QPDF& pdf, Options& o)
QPDFWriter w(pdf, o.outfilename);
set_writer_options(pdf, o, w);
w.write();
+ if (o.verbose && o.outfilename)
+ {
+ std::cout << whoami << ": wrote file "
+ << o.outfilename << std::endl;
+ }
}
}
diff --git a/qpdf/qtest/qpdf.test b/qpdf/qtest/qpdf.test
index e5a97058..98887102 100644
--- a/qpdf/qtest/qpdf.test
+++ b/qpdf/qtest/qpdf.test
@@ -325,8 +325,8 @@ $td->runtest("check obj0.pdf",
# Min/Force version
$td->runtest("set min version",
- {$td->COMMAND => "qpdf --min-version=1.6 good1.pdf a.pdf"},
- {$td->STRING => "",
+ {$td->COMMAND => "qpdf --verbose --min-version=1.6 good1.pdf a.pdf"},
+ {$td->STRING => "qpdf: wrote file a.pdf\n",
$td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
$td->runtest("check version",
@@ -730,8 +730,8 @@ for (@sp_cases)
$td->runtest("split page group > 1",
{$td->COMMAND => "qpdf --static-id --split-pages=5 11-pages.pdf" .
- " split-out-group.pdf"},
- {$td->STRING => "", $td->EXIT_STATUS => 0},
+ " --verbose split-out-group.pdf"},
+ {$td->FILE => "split-pages-group.out", $td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
foreach my $f ('01-05', '06-10', '11-11')
{
diff --git a/qpdf/qtest/qpdf/split-pages-group.out b/qpdf/qtest/qpdf/split-pages-group.out
new file mode 100644
index 00000000..ec00ab7e
--- /dev/null
+++ b/qpdf/qtest/qpdf/split-pages-group.out
@@ -0,0 +1,3 @@
+qpdf: wrote file split-out-group-01-05.pdf
+qpdf: wrote file split-out-group-06-10.pdf
+qpdf: wrote file split-out-group-11-11.pdf