summaryrefslogtreecommitdiffstats
path: root/qpdf
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2014-11-14 19:43:34 +0100
committerJay Berkenbilt <ejb@ql.org>2014-11-14 19:43:34 +0100
commitcaab1b0e1642bc6ee0194c7ab4c4a4de2ab22f2c (patch)
tree289badc34732a92059a939935a67f37fbbb8b8b2 /qpdf
parent4071db59aa475b42ba4db71462ab4f83b4bd2132 (diff)
downloadqpdf-caab1b0e1642bc6ee0194c7ab4c4a4de2ab22f2c.tar.zst
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.
Diffstat (limited to 'qpdf')
-rw-r--r--qpdf/qtest/qpdf.test7
-rw-r--r--qpdf/qtest/qpdf/page-no-content.out8
-rw-r--r--qpdf/qtest/qpdf/page-no-content.pdfbin0 -> 1362 bytes
3 files changed, 14 insertions, 1 deletions
diff --git a/qpdf/qtest/qpdf.test b/qpdf/qtest/qpdf.test
index 8e697844..b2bf06a7 100644
--- a/qpdf/qtest/qpdf.test
+++ b/qpdf/qtest/qpdf.test
@@ -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 ---");
diff --git a/qpdf/qtest/qpdf/page-no-content.out b/qpdf/qtest/qpdf/page-no-content.out
new file mode 100644
index 00000000..15df72db
--- /dev/null
+++ b/qpdf/qtest/qpdf/page-no-content.out
@@ -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
diff --git a/qpdf/qtest/qpdf/page-no-content.pdf b/qpdf/qtest/qpdf/page-no-content.pdf
new file mode 100644
index 00000000..77b7832a
--- /dev/null
+++ b/qpdf/qtest/qpdf/page-no-content.pdf
Binary files differ