Move page spec processing earlier

This commit is contained in:
Jay Berkenbilt 2017-08-05 08:29:26 -04:00
parent 24f28f0768
commit 909daf9543
4 changed files with 23 additions and 7 deletions

View File

@ -1,3 +1,9 @@
2017-08-05 Jay Berkenbilt <ejb@ql.org>
* Process --pages options earlier so that certain inspection
options, like --show-pages, can show the state after the merging
operations.
2017-08-02 Jay Berkenbilt <ejb@ql.org>
* Fix off-by-one error in parsing pages options. Fixes #129.

View File

@ -1874,12 +1874,6 @@ static void set_encryption_options(QPDF& pdf, Options& o, QPDFWriter& w)
static void write_outfile(QPDF& pdf, Options& o)
{
QPDF encryption_pdf;
std::vector<PointerHolder<QPDF> > page_heap;
if (! o.page_specs.empty())
{
handle_page_specs(pdf, o, page_heap);
}
if (strcmp(o.outfilename, "-") == 0)
{
o.outfilename = 0;
@ -2020,6 +2014,12 @@ int main(int argc, char* argv[])
pdf.processFile(o.infilename, o.password);
}
std::vector<PointerHolder<QPDF> > page_heap;
if (! o.page_specs.empty())
{
handle_page_specs(pdf, o, page_heap);
}
if (o.outfilename == 0)
{
do_inspection(pdf, o);

View File

@ -206,7 +206,7 @@ $td->runtest("remove page we don't have",
show_ntests();
# ----------
$td->notify("--- Miscellaneous Tests ---");
$n_tests += 94;
$n_tests += 95;
$td->runtest("qpdf version",
{$td->COMMAND => "qpdf --version"},
@ -652,6 +652,13 @@ $td->runtest("don't overwrite self",
{$td->REGEXP => "input file and output file are the same.*",
$td->EXIT_STATUS => 2});
$td->runtest("combine show and --pages",
{$td->COMMAND =>
"qpdf --empty --pages minimal.pdf -- --show-pages"},
{$td->FILE => "show-pages-pages.out",
$td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
show_ntests();
# ----------
$td->notify("--- Numeric range parsing tests ---");

View File

@ -0,0 +1,3 @@
page 1: 3 0 R
content:
4 0 R