summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-07-15 10:01:29 -0700
committerTom Sepez <tsepez@chromium.org>2015-07-15 10:01:29 -0700
commit5bd88ec07e79215400777f3095c6843e0627cade (patch)
treeb1db5e49ddb4228a78de4896a5339e08709e5c56
parentacf0647bd20b5fbb95be955e60a355884d837631 (diff)
downloadpdfium-5bd88ec07e79215400777f3095c6843e0627cade.tar.xz
Add test case for parsing endobj keywords.
There is no assurance that the expected result files are consistent with other readers. Jun will have to verify that after making his parser changes for bug 493126. BUG=493126 R=thestig@chromium.org, jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/1232803005 .
-rw-r--r--testing/resources/pixel/endobj1.in60
-rw-r--r--testing/resources/pixel/endobj1.pdf70
-rw-r--r--testing/resources/pixel/endobj10.in59
-rw-r--r--testing/resources/pixel/endobj10.pdf69
-rw-r--r--testing/resources/pixel/endobj10_expected.pdf.0.pngbin0 -> 590 bytes
-rw-r--r--testing/resources/pixel/endobj11.in65
-rw-r--r--testing/resources/pixel/endobj11.pdf75
-rw-r--r--testing/resources/pixel/endobj11_expected.pdf.0.pngbin0 -> 590 bytes
-rw-r--r--testing/resources/pixel/endobj12.in65
-rw-r--r--testing/resources/pixel/endobj12.pdf75
-rw-r--r--testing/resources/pixel/endobj12_expected.pdf.0.pngbin0 -> 590 bytes
-rw-r--r--testing/resources/pixel/endobj13.in65
-rw-r--r--testing/resources/pixel/endobj13.pdf75
-rw-r--r--testing/resources/pixel/endobj13_expected.pdf.0.pngbin0 -> 590 bytes
-rw-r--r--testing/resources/pixel/endobj1_expected.pdf.0.pngbin0 -> 5433 bytes
-rw-r--r--testing/resources/pixel/endobj2.in59
-rw-r--r--testing/resources/pixel/endobj2.pdf69
-rw-r--r--testing/resources/pixel/endobj2_expected.pdf.0.pngbin0 -> 590 bytes
-rw-r--r--testing/resources/pixel/endobj3.in59
-rw-r--r--testing/resources/pixel/endobj3.pdf69
-rw-r--r--testing/resources/pixel/endobj3_expected.pdf.0.pngbin0 -> 5433 bytes
-rw-r--r--testing/resources/pixel/endobj4.in59
-rw-r--r--testing/resources/pixel/endobj4.pdf69
-rw-r--r--testing/resources/pixel/endobj4_expected.pdf.0.pngbin0 -> 5433 bytes
-rw-r--r--testing/resources/pixel/endobj5.in60
-rw-r--r--testing/resources/pixel/endobj5.pdf70
-rw-r--r--testing/resources/pixel/endobj5_expected.pdf.0.pngbin0 -> 4508 bytes
-rw-r--r--testing/resources/pixel/endobj6.in60
-rw-r--r--testing/resources/pixel/endobj6.pdf70
-rw-r--r--testing/resources/pixel/endobj6_expected.pdf.0.pngbin0 -> 590 bytes
-rw-r--r--testing/resources/pixel/endobj7.in60
-rw-r--r--testing/resources/pixel/endobj7.pdf70
-rw-r--r--testing/resources/pixel/endobj7_expected.pdf.0.pngbin0 -> 590 bytes
-rw-r--r--testing/resources/pixel/endobj8.in59
-rw-r--r--testing/resources/pixel/endobj8.pdf69
-rw-r--r--testing/resources/pixel/endobj8_expected.pdf.0.pngbin0 -> 590 bytes
-rw-r--r--testing/resources/pixel/endobj9.in59
-rw-r--r--testing/resources/pixel/endobj9.pdf69
-rw-r--r--testing/resources/pixel/endobj9_expected.pdf.0.pngbin0 -> 590 bytes
39 files changed, 1708 insertions, 0 deletions
diff --git a/testing/resources/pixel/endobj1.in b/testing/resources/pixel/endobj1.in
new file mode 100644
index 0000000000..3e7f5e6bc5
--- /dev/null
+++ b/testing/resources/pixel/endobj1.in
@@ -0,0 +1,60 @@
+{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+{{object 2 0}} <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+{{object 3 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+{{object 4 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+{{object 5 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+% Case 1:
+% /Length identifies intended end of stream, despite embedded keywords.
+% Both should render as text.
+{{object 6 0}} <<
+ /Length 97
+>>
+stream
+BT
+20 50 Td
+/F1 12 Tf
+(endobj is text) Tj
+0 50 Td
+/F2 13 Tf
+(endstream is text per /Length) Tj
+ET
+endstream
+endobj
+{{xref}}
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+{{startxref}}
+%%EOF
diff --git a/testing/resources/pixel/endobj1.pdf b/testing/resources/pixel/endobj1.pdf
new file mode 100644
index 0000000000..918e0a60a3
--- /dev/null
+++ b/testing/resources/pixel/endobj1.pdf
@@ -0,0 +1,70 @@
+%PDF-1.7
+% ò¤ô
+1 0 obj <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+2 0 obj <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+3 0 obj <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+4 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+5 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+% Case 1:
+% /Length identifies intended end of stream, despite embedded keywords.
+% Both should render as text.
+6 0 obj <<
+ /Length 97
+>>
+stream
+BT
+20 50 Td
+/F1 12 Tf
+(endobj is text) Tj
+0 50 Td
+/F2 13 Tf
+(endstream is text per /Length) Tj
+ET
+endstream
+endobj
+xref
+0 7
+0000000000 65535 f
+0000000015 00000 n
+0000000061 00000 n
+0000000154 00000 n
+0000000296 00000 n
+0000000374 00000 n
+0000000566 00000 n
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+startxref
+715
+%%EOF
diff --git a/testing/resources/pixel/endobj10.in b/testing/resources/pixel/endobj10.in
new file mode 100644
index 0000000000..d89132a97c
--- /dev/null
+++ b/testing/resources/pixel/endobj10.in
@@ -0,0 +1,59 @@
+{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+{{object 2 0}} <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+{{object 3 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+{{object 4 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+{{object 5 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+% Case 10:
+% /Length identifies end of stream, and embedded endstream/endobj
+% keyword to trip us up, but missing endstream keyword.
+{{object 6 0}} <<
+ /Length 97
+>>
+stream
+BT
+20 50 Td
+/F1 12 Tf
+(endstream is not text) Tj
+0 50 Td
+/F2 13 Tf
+(endobj is not text) Tj
+ET
+endobj
+{{xref}}
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+{{startxref}}
+%%EOF
diff --git a/testing/resources/pixel/endobj10.pdf b/testing/resources/pixel/endobj10.pdf
new file mode 100644
index 0000000000..7d3f25239f
--- /dev/null
+++ b/testing/resources/pixel/endobj10.pdf
@@ -0,0 +1,69 @@
+%PDF-1.7
+% ò¤ô
+1 0 obj <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+2 0 obj <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+3 0 obj <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+4 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+5 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+% Case 10:
+% /Length identifies end of stream, and embedded endstream/endobj
+% keyword to trip us up, but missing endstream keyword.
+6 0 obj <<
+ /Length 97
+>>
+stream
+BT
+20 50 Td
+/F1 12 Tf
+(endstream is not text) Tj
+0 50 Td
+/F2 13 Tf
+(endobj is not text) Tj
+ET
+endobj
+xref
+0 7
+0000000000 65535 f
+0000000015 00000 n
+0000000061 00000 n
+0000000154 00000 n
+0000000296 00000 n
+0000000374 00000 n
+0000000587 00000 n
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+startxref
+722
+%%EOF
diff --git a/testing/resources/pixel/endobj10_expected.pdf.0.png b/testing/resources/pixel/endobj10_expected.pdf.0.png
new file mode 100644
index 0000000000..3edcc2db89
--- /dev/null
+++ b/testing/resources/pixel/endobj10_expected.pdf.0.png
Binary files differ
diff --git a/testing/resources/pixel/endobj11.in b/testing/resources/pixel/endobj11.in
new file mode 100644
index 0000000000..6bccbe5f0e
--- /dev/null
+++ b/testing/resources/pixel/endobj11.in
@@ -0,0 +1,65 @@
+{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+{{object 2 0}} <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+{{object 3 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+{{object 4 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+{{object 5 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+% Case 11:
+% /Length points past intended end of stream, with embedded keywords.
+% Both should render as text.
+{{object 6 0}} <<
+ /Length 128
+>>
+stream
+BT
+20 50 Td
+/F1 12 Tf
+(endobj is text) Tj
+0 50 Td
+/F2 13 Tf
+(endstream is text per /Length) Tj
+ET
+endstream
+endobj
+
+% blah blah blah.
+% blah blah blah.
+% blah blah blah.
+
+{{xref}}
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+{{startxref}}
+%%EOF
diff --git a/testing/resources/pixel/endobj11.pdf b/testing/resources/pixel/endobj11.pdf
new file mode 100644
index 0000000000..e72cff8698
--- /dev/null
+++ b/testing/resources/pixel/endobj11.pdf
@@ -0,0 +1,75 @@
+%PDF-1.7
+% ò¤ô
+1 0 obj <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+2 0 obj <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+3 0 obj <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+4 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+5 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+% Case 11:
+% /Length points past intended end of stream, with embedded keywords.
+% Both should render as text.
+6 0 obj <<
+ /Length 128
+>>
+stream
+BT
+20 50 Td
+/F1 12 Tf
+(endobj is text) Tj
+0 50 Td
+/F2 13 Tf
+(endstream is text per /Length) Tj
+ET
+endstream
+endobj
+
+% blah blah blah.
+% blah blah blah.
+% blah blah blah.
+
+xref
+0 7
+0000000000 65535 f
+0000000015 00000 n
+0000000061 00000 n
+0000000154 00000 n
+0000000296 00000 n
+0000000374 00000 n
+0000000565 00000 n
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+startxref
+771
+%%EOF
diff --git a/testing/resources/pixel/endobj11_expected.pdf.0.png b/testing/resources/pixel/endobj11_expected.pdf.0.png
new file mode 100644
index 0000000000..3edcc2db89
--- /dev/null
+++ b/testing/resources/pixel/endobj11_expected.pdf.0.png
Binary files differ
diff --git a/testing/resources/pixel/endobj12.in b/testing/resources/pixel/endobj12.in
new file mode 100644
index 0000000000..1a89b31650
--- /dev/null
+++ b/testing/resources/pixel/endobj12.in
@@ -0,0 +1,65 @@
+{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+{{object 2 0}} <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+{{object 3 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+{{object 4 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+{{object 5 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+% Case 11:
+% /Length points well past intended end of stream, with embedded keywords.
+% Both should render as text.
+{{object 6 0}} <<
+ /Length 210
+>>
+stream
+BT
+20 50 Td
+/F1 12 Tf
+(endobj is text) Tj
+0 50 Td
+/F2 13 Tf
+(endstream is text per /Length) Tj
+ET
+endstream
+endobj
+
+% blah blah blah.
+% blah blah blah.
+% blah blah blah.
+
+{{xref}}
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+{{startxref}}
+%%EOF
diff --git a/testing/resources/pixel/endobj12.pdf b/testing/resources/pixel/endobj12.pdf
new file mode 100644
index 0000000000..3d07ab52fb
--- /dev/null
+++ b/testing/resources/pixel/endobj12.pdf
@@ -0,0 +1,75 @@
+%PDF-1.7
+% ò¤ô
+1 0 obj <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+2 0 obj <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+3 0 obj <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+4 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+5 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+% Case 11:
+% /Length points well past intended end of stream, with embedded keywords.
+% Both should render as text.
+6 0 obj <<
+ /Length 210
+>>
+stream
+BT
+20 50 Td
+/F1 12 Tf
+(endobj is text) Tj
+0 50 Td
+/F2 13 Tf
+(endstream is text per /Length) Tj
+ET
+endstream
+endobj
+
+% blah blah blah.
+% blah blah blah.
+% blah blah blah.
+
+xref
+0 7
+0000000000 65535 f
+0000000015 00000 n
+0000000061 00000 n
+0000000154 00000 n
+0000000296 00000 n
+0000000374 00000 n
+0000000570 00000 n
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+startxref
+776
+%%EOF
diff --git a/testing/resources/pixel/endobj12_expected.pdf.0.png b/testing/resources/pixel/endobj12_expected.pdf.0.png
new file mode 100644
index 0000000000..3edcc2db89
--- /dev/null
+++ b/testing/resources/pixel/endobj12_expected.pdf.0.png
Binary files differ
diff --git a/testing/resources/pixel/endobj13.in b/testing/resources/pixel/endobj13.in
new file mode 100644
index 0000000000..81623a2b03
--- /dev/null
+++ b/testing/resources/pixel/endobj13.in
@@ -0,0 +1,65 @@
+{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+{{object 2 0}} <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+{{object 3 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+{{object 4 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+{{object 5 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+% Case 11:
+% /Length points well past EOF, with embedded keywords.
+% Both should render as text.
+{{object 6 0}} <<
+ /Length 1000
+>>
+stream
+BT
+20 50 Td
+/F1 12 Tf
+(endobj is text) Tj
+0 50 Td
+/F2 13 Tf
+(endstream is text per /Length) Tj
+ET
+endstream
+endobj
+
+% blah blah blah.
+% blah blah blah.
+% blah blah blah.
+
+{{xref}}
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+{{startxref}}
+%%EOF
diff --git a/testing/resources/pixel/endobj13.pdf b/testing/resources/pixel/endobj13.pdf
new file mode 100644
index 0000000000..8193e53f56
--- /dev/null
+++ b/testing/resources/pixel/endobj13.pdf
@@ -0,0 +1,75 @@
+%PDF-1.7
+% ò¤ô
+1 0 obj <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+2 0 obj <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+3 0 obj <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+4 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+5 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+% Case 11:
+% /Length points well past EOF, with embedded keywords.
+% Both should render as text.
+6 0 obj <<
+ /Length 1000
+>>
+stream
+BT
+20 50 Td
+/F1 12 Tf
+(endobj is text) Tj
+0 50 Td
+/F2 13 Tf
+(endstream is text per /Length) Tj
+ET
+endstream
+endobj
+
+% blah blah blah.
+% blah blah blah.
+% blah blah blah.
+
+xref
+0 7
+0000000000 65535 f
+0000000015 00000 n
+0000000061 00000 n
+0000000154 00000 n
+0000000296 00000 n
+0000000374 00000 n
+0000000551 00000 n
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+startxref
+758
+%%EOF
diff --git a/testing/resources/pixel/endobj13_expected.pdf.0.png b/testing/resources/pixel/endobj13_expected.pdf.0.png
new file mode 100644
index 0000000000..3edcc2db89
--- /dev/null
+++ b/testing/resources/pixel/endobj13_expected.pdf.0.png
Binary files differ
diff --git a/testing/resources/pixel/endobj1_expected.pdf.0.png b/testing/resources/pixel/endobj1_expected.pdf.0.png
new file mode 100644
index 0000000000..a044bb0c37
--- /dev/null
+++ b/testing/resources/pixel/endobj1_expected.pdf.0.png
Binary files differ
diff --git a/testing/resources/pixel/endobj2.in b/testing/resources/pixel/endobj2.in
new file mode 100644
index 0000000000..341fe7edb3
--- /dev/null
+++ b/testing/resources/pixel/endobj2.in
@@ -0,0 +1,59 @@
+{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+{{object 2 0}} <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+{{object 3 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+{{object 4 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+{{object 5 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+% Case 4:
+% /Length identifies intended end of stream, but whitespace rather than
+% newline following the stream keyword.
+{{object 6 0}} <<
+ /Length 97
+>>
+stream BT
+20 50 Td
+/F1 12 Tf
+(endobj is text) Tj
+0 50 Td
+/F2 13 Tf
+(endstream is text per /Length) Tj
+ET
+endstream
+endobj
+{{xref}}
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+{{startxref}}
+%%EOF
diff --git a/testing/resources/pixel/endobj2.pdf b/testing/resources/pixel/endobj2.pdf
new file mode 100644
index 0000000000..6c5982a315
--- /dev/null
+++ b/testing/resources/pixel/endobj2.pdf
@@ -0,0 +1,69 @@
+%PDF-1.7
+% ò¤ô
+1 0 obj <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+2 0 obj <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+3 0 obj <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+4 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+5 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+% Case 4:
+% /Length identifies intended end of stream, but whitespace rather than
+% newline following the stream keyword.
+6 0 obj <<
+ /Length 97
+>>
+stream BT
+20 50 Td
+/F1 12 Tf
+(endobj is text) Tj
+0 50 Td
+/F2 13 Tf
+(endstream is text per /Length) Tj
+ET
+endstream
+endobj
+xref
+0 7
+0000000000 65535 f
+0000000015 00000 n
+0000000061 00000 n
+0000000154 00000 n
+0000000296 00000 n
+0000000374 00000 n
+0000000576 00000 n
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+startxref
+725
+%%EOF
diff --git a/testing/resources/pixel/endobj2_expected.pdf.0.png b/testing/resources/pixel/endobj2_expected.pdf.0.png
new file mode 100644
index 0000000000..3edcc2db89
--- /dev/null
+++ b/testing/resources/pixel/endobj2_expected.pdf.0.png
Binary files differ
diff --git a/testing/resources/pixel/endobj3.in b/testing/resources/pixel/endobj3.in
new file mode 100644
index 0000000000..11f5a99480
--- /dev/null
+++ b/testing/resources/pixel/endobj3.in
@@ -0,0 +1,59 @@
+{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+{{object 2 0}} <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+{{object 3 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+{{object 4 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+{{object 5 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+% Case 3:
+% /Length identifies intended end of stream, but whitespace rather than
+% newline following the endstream keyword.
+{{object 6 0}} <<
+ /Length 97
+>>
+stream
+BT
+20 50 Td
+/F1 12 Tf
+(endobj is text) Tj
+0 50 Td
+/F2 13 Tf
+(endstream is text per /Length) Tj
+ET
+endstream endobj
+{{xref}}
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+{{startxref}}
+%%EOF
diff --git a/testing/resources/pixel/endobj3.pdf b/testing/resources/pixel/endobj3.pdf
new file mode 100644
index 0000000000..65f3b1335d
--- /dev/null
+++ b/testing/resources/pixel/endobj3.pdf
@@ -0,0 +1,69 @@
+%PDF-1.7
+% ò¤ô
+1 0 obj <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+2 0 obj <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+3 0 obj <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+4 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+5 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+% Case 3:
+% /Length identifies intended end of stream, but whitespace rather than
+% newline following the endstream keyword.
+6 0 obj <<
+ /Length 97
+>>
+stream
+BT
+20 50 Td
+/F1 12 Tf
+(endobj is text) Tj
+0 50 Td
+/F2 13 Tf
+(endstream is text per /Length) Tj
+ET
+endstream endobj
+xref
+0 7
+0000000000 65535 f
+0000000015 00000 n
+0000000061 00000 n
+0000000154 00000 n
+0000000296 00000 n
+0000000374 00000 n
+0000000579 00000 n
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+startxref
+728
+%%EOF
diff --git a/testing/resources/pixel/endobj3_expected.pdf.0.png b/testing/resources/pixel/endobj3_expected.pdf.0.png
new file mode 100644
index 0000000000..a044bb0c37
--- /dev/null
+++ b/testing/resources/pixel/endobj3_expected.pdf.0.png
Binary files differ
diff --git a/testing/resources/pixel/endobj4.in b/testing/resources/pixel/endobj4.in
new file mode 100644
index 0000000000..a49a5c2775
--- /dev/null
+++ b/testing/resources/pixel/endobj4.in
@@ -0,0 +1,59 @@
+{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+{{object 2 0}} <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+{{object 3 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+{{object 4 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+{{object 5 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+% Case 5:
+% /Length identifies intended end of stream, but whitespace rather than
+% newline following the endobj keyword.
+{{object 6 0}} <<
+ /Length 97
+>>
+stream
+BT
+20 50 Td
+/F1 12 Tf
+(endobj is text) Tj
+0 50 Td
+/F2 13 Tf
+(endstream is text per /Length) Tj
+ET
+endstream
+endobj {{xref}}
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+{{startxref}}
+%%EOF
diff --git a/testing/resources/pixel/endobj4.pdf b/testing/resources/pixel/endobj4.pdf
new file mode 100644
index 0000000000..3758492eb0
--- /dev/null
+++ b/testing/resources/pixel/endobj4.pdf
@@ -0,0 +1,69 @@
+%PDF-1.7
+% ò¤ô
+1 0 obj <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+2 0 obj <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+3 0 obj <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+4 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+5 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+% Case 5:
+% /Length identifies intended end of stream, but whitespace rather than
+% newline following the endobj keyword.
+6 0 obj <<
+ /Length 97
+>>
+stream
+BT
+20 50 Td
+/F1 12 Tf
+(endobj is text) Tj
+0 50 Td
+/F2 13 Tf
+(endstream is text per /Length) Tj
+ET
+endstream
+xref
+0 7
+0000000000 65535 f
+0000000015 00000 n
+0000000061 00000 n
+0000000154 00000 n
+0000000296 00000 n
+0000000374 00000 n
+0000000576 00000 n
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+startxref
+718
+%%EOF
diff --git a/testing/resources/pixel/endobj4_expected.pdf.0.png b/testing/resources/pixel/endobj4_expected.pdf.0.png
new file mode 100644
index 0000000000..a044bb0c37
--- /dev/null
+++ b/testing/resources/pixel/endobj4_expected.pdf.0.png
Binary files differ
diff --git a/testing/resources/pixel/endobj5.in b/testing/resources/pixel/endobj5.in
new file mode 100644
index 0000000000..dce87954ec
--- /dev/null
+++ b/testing/resources/pixel/endobj5.in
@@ -0,0 +1,60 @@
+{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+{{object 2 0}} <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+{{object 3 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+{{object 4 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+{{object 5 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+% Case 5:
+% /Length incorrectly identifies middle of stream, no confusing
+% keywords to trip us up.
+{{object 6 0}} <<
+ /Length 50
+>>
+stream
+BT
+20 50 Td
+/F1 12 Tf
+(xxxxxx is text) Tj
+0 50 Td
+/F2 13 Tf
+(yyyyyyyyy after bad /Length) Tj
+ET
+endstream
+endobj
+{{xref}}
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+{{startxref}}
+%%EOF
diff --git a/testing/resources/pixel/endobj5.pdf b/testing/resources/pixel/endobj5.pdf
new file mode 100644
index 0000000000..02c99f3d54
--- /dev/null
+++ b/testing/resources/pixel/endobj5.pdf
@@ -0,0 +1,70 @@
+%PDF-1.7
+% ò¤ô
+1 0 obj <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+2 0 obj <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+3 0 obj <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+4 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+5 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+% Case 5:
+% /Length incorrectly identifies middle of stream, no confusing
+% keywords to trip us up.
+6 0 obj <<
+ /Length 50
+>>
+stream
+BT
+20 50 Td
+/F1 12 Tf
+(xxxxxx is text) Tj
+0 50 Td
+/F2 13 Tf
+(yyyyyyyyy after bad /Length) Tj
+ET
+endstream
+endobj
+xref
+0 7
+0000000000 65535 f
+0000000015 00000 n
+0000000061 00000 n
+0000000154 00000 n
+0000000296 00000 n
+0000000374 00000 n
+0000000554 00000 n
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+startxref
+701
+%%EOF
diff --git a/testing/resources/pixel/endobj5_expected.pdf.0.png b/testing/resources/pixel/endobj5_expected.pdf.0.png
new file mode 100644
index 0000000000..87f2a9b32d
--- /dev/null
+++ b/testing/resources/pixel/endobj5_expected.pdf.0.png
Binary files differ
diff --git a/testing/resources/pixel/endobj6.in b/testing/resources/pixel/endobj6.in
new file mode 100644
index 0000000000..53f546f519
--- /dev/null
+++ b/testing/resources/pixel/endobj6.in
@@ -0,0 +1,60 @@
+{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+{{object 2 0}} <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+{{object 3 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+{{object 4 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+{{object 5 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+% Case 6:
+% /Length incorrectly identifies middle of stream, and confusing
+% keywords to trip us up. Should only render |endobj| as text.
+{{object 6 0}} <<
+ /Length 50
+>>
+stream
+BT
+20 50 Td
+/F1 12 Tf
+(endobj is text) Tj
+0 50 Td
+/F2 13 Tf
+(endstream after bad /Length) Tj
+ET
+endstream
+endobj
+{{xref}}
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+{{startxref}}
+%%EOF
diff --git a/testing/resources/pixel/endobj6.pdf b/testing/resources/pixel/endobj6.pdf
new file mode 100644
index 0000000000..1e0006e99c
--- /dev/null
+++ b/testing/resources/pixel/endobj6.pdf
@@ -0,0 +1,70 @@
+%PDF-1.7
+% ò¤ô
+1 0 obj <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+2 0 obj <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+3 0 obj <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+4 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+5 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+% Case 6:
+% /Length incorrectly identifies middle of stream, and confusing
+% keywords to trip us up. Should only render |endobj| as text.
+6 0 obj <<
+ /Length 50
+>>
+stream
+BT
+20 50 Td
+/F1 12 Tf
+(endobj is text) Tj
+0 50 Td
+/F2 13 Tf
+(endstream after bad /Length) Tj
+ET
+endstream
+endobj
+xref
+0 7
+0000000000 65535 f
+0000000015 00000 n
+0000000061 00000 n
+0000000154 00000 n
+0000000296 00000 n
+0000000374 00000 n
+0000000593 00000 n
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+startxref
+740
+%%EOF
diff --git a/testing/resources/pixel/endobj6_expected.pdf.0.png b/testing/resources/pixel/endobj6_expected.pdf.0.png
new file mode 100644
index 0000000000..3edcc2db89
--- /dev/null
+++ b/testing/resources/pixel/endobj6_expected.pdf.0.png
Binary files differ
diff --git a/testing/resources/pixel/endobj7.in b/testing/resources/pixel/endobj7.in
new file mode 100644
index 0000000000..747514fa80
--- /dev/null
+++ b/testing/resources/pixel/endobj7.in
@@ -0,0 +1,60 @@
+{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+{{object 2 0}} <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+{{object 3 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+{{object 4 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+{{object 5 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+% Case 7:
+% /Length identifies intended end of stream, but endstream/endobj
+% keywords swapped. Should render |endobj| and |endstream| as text.
+{{object 6 0}} <<
+ /Length 97
+>>
+stream
+BT
+20 50 Td
+/F1 12 Tf
+(endobj is text) Tj
+0 50 Td
+/F2 13 Tf
+(endstream is text per /Length) Tj
+ET
+endobj
+endstream
+{{xref}}
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+{{startxref}}
+%%EOF
diff --git a/testing/resources/pixel/endobj7.pdf b/testing/resources/pixel/endobj7.pdf
new file mode 100644
index 0000000000..787b61ab51
--- /dev/null
+++ b/testing/resources/pixel/endobj7.pdf
@@ -0,0 +1,70 @@
+%PDF-1.7
+% ò¤ô
+1 0 obj <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+2 0 obj <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+3 0 obj <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+4 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+5 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+% Case 7:
+% /Length identifies intended end of stream, but endstream/endobj
+% keywords swapped. Should render |endobj| and |endstream| as text.
+6 0 obj <<
+ /Length 97
+>>
+stream
+BT
+20 50 Td
+/F1 12 Tf
+(endobj is text) Tj
+0 50 Td
+/F2 13 Tf
+(endstream is text per /Length) Tj
+ET
+endobj
+endstream
+xref
+0 7
+0000000000 65535 f
+0000000015 00000 n
+0000000061 00000 n
+0000000154 00000 n
+0000000296 00000 n
+0000000374 00000 n
+0000000598 00000 n
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+startxref
+747
+%%EOF
diff --git a/testing/resources/pixel/endobj7_expected.pdf.0.png b/testing/resources/pixel/endobj7_expected.pdf.0.png
new file mode 100644
index 0000000000..3edcc2db89
--- /dev/null
+++ b/testing/resources/pixel/endobj7_expected.pdf.0.png
Binary files differ
diff --git a/testing/resources/pixel/endobj8.in b/testing/resources/pixel/endobj8.in
new file mode 100644
index 0000000000..66892e239a
--- /dev/null
+++ b/testing/resources/pixel/endobj8.in
@@ -0,0 +1,59 @@
+{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+{{object 2 0}} <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+{{object 3 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+{{object 4 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+{{object 5 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+% Case 8:
+% No /Length to identify end of stream, but embedded endobj/endstream
+% keywords to trip us up. Should only render |endobj| as text.
+{{object 6 0}} <<
+>>
+stream
+BT
+20 50 Td
+/F1 12 Tf
+(endobj is text) Tj
+0 50 Td
+/F2 13 Tf
+(endstream is not text) Tj
+ET
+endstream
+endobj
+{{xref}}
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+{{startxref}}
+%%EOF
diff --git a/testing/resources/pixel/endobj8.pdf b/testing/resources/pixel/endobj8.pdf
new file mode 100644
index 0000000000..26f70adbb9
--- /dev/null
+++ b/testing/resources/pixel/endobj8.pdf
@@ -0,0 +1,69 @@
+%PDF-1.7
+% ò¤ô
+1 0 obj <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+2 0 obj <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+3 0 obj <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+4 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+5 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+% Case 8:
+% No /Length to identify end of stream, but embedded endobj/endstream
+% keywords to trip us up. Should only render |endobj| as text.
+6 0 obj <<
+>>
+stream
+BT
+20 50 Td
+/F1 12 Tf
+(endobj is text) Tj
+0 50 Td
+/F2 13 Tf
+(endstream is not text) Tj
+ET
+endstream
+endobj
+xref
+0 7
+0000000000 65535 f
+0000000015 00000 n
+0000000061 00000 n
+0000000154 00000 n
+0000000296 00000 n
+0000000374 00000 n
+0000000598 00000 n
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+startxref
+726
+%%EOF
diff --git a/testing/resources/pixel/endobj8_expected.pdf.0.png b/testing/resources/pixel/endobj8_expected.pdf.0.png
new file mode 100644
index 0000000000..3edcc2db89
--- /dev/null
+++ b/testing/resources/pixel/endobj8_expected.pdf.0.png
Binary files differ
diff --git a/testing/resources/pixel/endobj9.in b/testing/resources/pixel/endobj9.in
new file mode 100644
index 0000000000..fb156faa9f
--- /dev/null
+++ b/testing/resources/pixel/endobj9.in
@@ -0,0 +1,59 @@
+{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+{{object 2 0}} <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+{{object 3 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+{{object 4 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+{{object 5 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+% Case 9:
+% No /Length to identify end of stream, but embedded endstream/endobj
+% keyword to trip us up. Should render nothing as text.
+{{object 6 0}} <<
+>>
+stream
+BT
+20 50 Td
+/F1 12 Tf
+(endstream is not text) Tj
+0 50 Td
+/F2 13 Tf
+(endobj is not text) Tj
+ET
+endstream
+endobj
+{{xref}}
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+{{startxref}}
+%%EOF
diff --git a/testing/resources/pixel/endobj9.pdf b/testing/resources/pixel/endobj9.pdf
new file mode 100644
index 0000000000..b08595631b
--- /dev/null
+++ b/testing/resources/pixel/endobj9.pdf
@@ -0,0 +1,69 @@
+%PDF-1.7
+% ò¤ô
+1 0 obj <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+2 0 obj <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+3 0 obj <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+4 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+5 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+% Case 9:
+% No /Length to identify end of stream, but embedded endstream/endobj
+% keyword to trip us up. Should render nothing as text.
+6 0 obj <<
+>>
+stream
+BT
+20 50 Td
+/F1 12 Tf
+(endstream is not text) Tj
+0 50 Td
+/F2 13 Tf
+(endobj is not text) Tj
+ET
+endstream
+endobj
+xref
+0 7
+0000000000 65535 f
+0000000015 00000 n
+0000000061 00000 n
+0000000154 00000 n
+0000000296 00000 n
+0000000374 00000 n
+0000000591 00000 n
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+startxref
+723
+%%EOF
diff --git a/testing/resources/pixel/endobj9_expected.pdf.0.png b/testing/resources/pixel/endobj9_expected.pdf.0.png
new file mode 100644
index 0000000000..3edcc2db89
--- /dev/null
+++ b/testing/resources/pixel/endobj9_expected.pdf.0.png
Binary files differ