mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-02 22:50:20 +00:00
Move page spec processing earlier
This commit is contained in:
parent
24f28f0768
commit
909daf9543
@ -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.
|
||||
|
12
qpdf/qpdf.cc
12
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);
|
||||
|
@ -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 ---");
|
||||
|
3
qpdf/qtest/qpdf/show-pages-pages.out
Normal file
3
qpdf/qtest/qpdf/show-pages-pages.out
Normal file
@ -0,0 +1,3 @@
|
||||
page 1: 3 0 R
|
||||
content:
|
||||
4 0 R
|
Loading…
Reference in New Issue
Block a user