mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 02:49:00 +00:00
Handle pages with no /Contents from getPageContents()
The spec allows /Contents to be omitted for pages that are blank, but QPDFObjectHandle::getPageContents() was throwing an exception in this case.
This commit is contained in:
parent
4071db59aa
commit
caab1b0e16
@ -1,3 +1,11 @@
|
||||
2014-11-14 Jay Berkenbilt <ejb@ql.org>
|
||||
|
||||
* Bug fix: QPDFObjectHandle::getPageContents() no longer throws an
|
||||
exception when called on a page that has no /Contents key in its
|
||||
dictionary. This is allowed by the spec, and some software
|
||||
packages generate files like this for pages that are blank in the
|
||||
original.
|
||||
|
||||
2014-06-07 Jay Berkenbilt <ejb@ql.org>
|
||||
|
||||
* 5.1.2: release
|
||||
|
@ -633,7 +633,7 @@ QPDFObjectHandle::getPageContents()
|
||||
{
|
||||
result.push_back(contents);
|
||||
}
|
||||
else
|
||||
else if (! contents.isNull())
|
||||
{
|
||||
throw std::runtime_error("unknown object type inspecting /Contents "
|
||||
"key in page dictionary");
|
||||
|
@ -199,7 +199,7 @@ $td->runtest("remove page we don't have",
|
||||
show_ntests();
|
||||
# ----------
|
||||
$td->notify("--- Miscellaneous Tests ---");
|
||||
$n_tests += 72;
|
||||
$n_tests += 73;
|
||||
|
||||
$td->runtest("qpdf version",
|
||||
{$td->COMMAND => "qpdf --version"},
|
||||
@ -554,6 +554,11 @@ $td->runtest("check file",
|
||||
{$td->FILE => "a.pdf"},
|
||||
{$td->FILE => "indirect-decode-parms-out.pdf"});
|
||||
|
||||
$td->runtest("handle page no with contents",
|
||||
{$td->COMMAND => "qpdf --show-pages page-no-content.pdf"},
|
||||
{$td->FILE => "page-no-content.out", $td->EXIT_STATUS => 0},
|
||||
$td->NORMALIZE_NEWLINES);
|
||||
|
||||
show_ntests();
|
||||
# ----------
|
||||
$td->notify("--- Numeric range parsing tests ---");
|
||||
|
8
qpdf/qtest/qpdf/page-no-content.out
Normal file
8
qpdf/qtest/qpdf/page-no-content.out
Normal file
@ -0,0 +1,8 @@
|
||||
page 1: 3 0 R
|
||||
content:
|
||||
6 0 R
|
||||
page 2: 4 0 R
|
||||
content:
|
||||
page 3: 5 0 R
|
||||
content:
|
||||
9 0 R
|
BIN
qpdf/qtest/qpdf/page-no-content.pdf
Normal file
BIN
qpdf/qtest/qpdf/page-no-content.pdf
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user