2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-10-31 19:02:30 +00:00

set page labels: detect start page < 1 (fixes #939)

This commit is contained in:
Jay Berkenbilt 2024-02-17 15:42:10 -05:00
parent 072623d6e8
commit 7bc52c5728
2 changed files with 5 additions and 2 deletions

View File

@ -1139,6 +1139,9 @@ QPDFJob::Config::setPageLabels(const std::vector<std::string>& specs)
}
auto start_num = match[3].matched ? QUtil::string_to_int(match[3].str().c_str()) : 1;
if (start_num < 1) {
usage("starting page number must be >= 1");
}
auto prefix = match[4].matched ? match[4].str() : "";
// We can't check ordering until we know how many pages there are, so that is delayed until
// near the end.

View File

@ -33,8 +33,8 @@ $td->runtest("no page labels",
my @errors = (
["quack", ".*page label spec must be.*"],
["5:r 10:D", ".*the first page .*must start with page 1.*"],
["1:r 10:D 31:A",
".*page 31 is more than the total number of pages \\(30\\).*"],
["1:r 10:D 31:A", ".*page 31 is more than the total number of pages \\(30\\).*"],
["1:r/0", ".*starting page number must be >= 1.*"],
);
$n_tests += scalar(@errors);