mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 02:49:00 +00:00
Small enhancement to --pages argument parsing
This commit is contained in:
parent
47f4ebcdac
commit
a7ef572c84
@ -1,3 +1,8 @@
|
||||
2020-11-09 Jay Berkenbilt <ejb@ql.org>
|
||||
|
||||
* Handle "." appearing in --pages not preceded by a numeric range
|
||||
as a special case in comand-line parsing code.
|
||||
|
||||
2020-11-04 Jay Berkenbilt <ejb@ql.org>
|
||||
|
||||
* Ignore the value of the offset/generation field in an xref entry
|
||||
|
14
qpdf/qpdf.cc
14
qpdf/qpdf.cc
@ -2877,9 +2877,17 @@ ArgParser::parsePagesOptions()
|
||||
// The range is invalid. Let's see if it's a file.
|
||||
try
|
||||
{
|
||||
fclose(QUtil::safe_fopen(range, "rb"));
|
||||
// Yup, it's a file.
|
||||
QTC::TC("qpdf", "qpdf pages range omitted in middle");
|
||||
if (strcmp(range, ".") == 0)
|
||||
{
|
||||
// "." means the input file.
|
||||
QTC::TC("qpdf", "qpdf pages range omitted with .");
|
||||
}
|
||||
else
|
||||
{
|
||||
fclose(QUtil::safe_fopen(range, "rb"));
|
||||
QTC::TC("qpdf", "qpdf pages range omitted in middle");
|
||||
// Yup, it's a file.
|
||||
}
|
||||
range_omitted = true;
|
||||
}
|
||||
catch (std::runtime_error&)
|
||||
|
@ -456,3 +456,4 @@ qpdf found shared xobject in leaf 0
|
||||
QPDF copy foreign with data 1
|
||||
QPDF copy foreign with foreign_stream 1
|
||||
QPDFObjectHandle need_newline 1
|
||||
qpdf pages range omitted with . 0
|
||||
|
@ -2093,7 +2093,7 @@ foreach my $f (qw(page_api_2 direct-pages))
|
||||
show_ntests();
|
||||
# ----------
|
||||
$td->notify("--- Merging and Splitting ---");
|
||||
$n_tests += 26;
|
||||
$n_tests += 28;
|
||||
|
||||
# Select pages from the same file multiple times including selecting
|
||||
# twice from an encrypted file and specifying the password only the
|
||||
@ -2149,6 +2149,14 @@ $td->runtest("merge with implicit ranges",
|
||||
$td->runtest("check output",
|
||||
{$td->FILE => "a.pdf"},
|
||||
{$td->FILE => "merge-implicit-ranges.pdf"});
|
||||
$td->runtest("merge with . and implicit ranges",
|
||||
{$td->COMMAND =>
|
||||
"qpdf minimal.pdf a.pdf --pages minimal.pdf . 1 --" .
|
||||
" --static-id"},
|
||||
{$td->STRING => "", $td->EXIT_STATUS => 0});
|
||||
$td->runtest("check output",
|
||||
{$td->FILE => "a.pdf"},
|
||||
{$td->FILE => "merge-dot-implicit-ranges.pdf"});
|
||||
$td->runtest("merge with multiple labels",
|
||||
{$td->COMMAND =>
|
||||
"qpdf --empty a.pdf" .
|
||||
|
BIN
qpdf/qtest/qpdf/merge-dot-implicit-ranges.pdf
Normal file
BIN
qpdf/qtest/qpdf/merge-dot-implicit-ranges.pdf
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user