diff options
author | Jay Berkenbilt <ejb@ql.org> | 2017-08-05 14:29:26 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2017-08-05 16:22:33 +0200 |
commit | 909daf9543a6e364a50568485278fdfd6c6abb7d (patch) | |
tree | f2d1ae1ffba5d243d77164583c353cd73ac6be11 /qpdf | |
parent | 24f28f0768b655b130626091ac23cf67d9e39630 (diff) | |
download | qpdf-909daf9543a6e364a50568485278fdfd6c6abb7d.tar.zst |
Move page spec processing earlier
Diffstat (limited to 'qpdf')
-rw-r--r-- | qpdf/qpdf.cc | 12 | ||||
-rw-r--r-- | qpdf/qtest/qpdf.test | 9 | ||||
-rw-r--r-- | qpdf/qtest/qpdf/show-pages-pages.out | 3 |
3 files changed, 17 insertions, 7 deletions
diff --git a/qpdf/qpdf.cc b/qpdf/qpdf.cc index 680e81e8..2d123d85 100644 --- a/qpdf/qpdf.cc +++ b/qpdf/qpdf.cc @@ -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); diff --git a/qpdf/qtest/qpdf.test b/qpdf/qtest/qpdf.test index 807014db..2fff85b6 100644 --- a/qpdf/qtest/qpdf.test +++ b/qpdf/qtest/qpdf.test @@ -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 ---"); diff --git a/qpdf/qtest/qpdf/show-pages-pages.out b/qpdf/qtest/qpdf/show-pages-pages.out new file mode 100644 index 00000000..429dadf3 --- /dev/null +++ b/qpdf/qtest/qpdf/show-pages-pages.out @@ -0,0 +1,3 @@ +page 1: 3 0 R + content: + 4 0 R |