Commit 36b3fe5af761b7032a506808cf6ce6d37c297bfc
1 parent
46611f07
Fix --newline-before-endstream option (fixes #133)
Add a newline unconditionally before endstream even if a newline was already written as part of the stream data.
Showing
9 changed files
with
720 additions
and
23 deletions
ChangeLog
| 1 | 2017-08-11 Jay Berkenbilt <ejb@ql.org> | 1 | 2017-08-11 Jay Berkenbilt <ejb@ql.org> |
| 2 | 2 | ||
| 3 | + * Fix --newline-before-endstream to always add a newline before | ||
| 4 | + endstream even if the last character was already a newline. This | ||
| 5 | + is actually what's required by PDF/A. Fixes #133. | ||
| 6 | + | ||
| 3 | * Handle encrypted files whose encryption parameters are too | 7 | * Handle encrypted files whose encryption parameters are too |
| 4 | short. Fixes #96. | 8 | short. Fixes #96. |
| 5 | 9 |
libqpdf/QPDFWriter.cc
| @@ -1587,18 +1587,16 @@ QPDFWriter::unparseObject(QPDFObjectHandle object, int level, | @@ -1587,18 +1587,16 @@ QPDFWriter::unparseObject(QPDFObjectHandle object, int level, | ||
| 1587 | char last_char = this->pipeline->getLastChar(); | 1587 | char last_char = this->pipeline->getLastChar(); |
| 1588 | popPipelineStack(); | 1588 | popPipelineStack(); |
| 1589 | 1589 | ||
| 1590 | - if (this->qdf_mode || this->newline_before_endstream) | ||
| 1591 | - { | ||
| 1592 | - if (last_char != '\n') | ||
| 1593 | - { | ||
| 1594 | - writeString("\n"); | ||
| 1595 | - this->added_newline = true; | ||
| 1596 | - } | ||
| 1597 | - else | ||
| 1598 | - { | ||
| 1599 | - this->added_newline = false; | ||
| 1600 | - } | ||
| 1601 | - } | 1590 | + if (this->newline_before_endstream || |
| 1591 | + (this->qdf_mode && (last_char != '\n'))) | ||
| 1592 | + { | ||
| 1593 | + writeString("\n"); | ||
| 1594 | + this->added_newline = true; | ||
| 1595 | + } | ||
| 1596 | + else | ||
| 1597 | + { | ||
| 1598 | + this->added_newline = false; | ||
| 1599 | + } | ||
| 1602 | writeString("endstream"); | 1600 | writeString("endstream"); |
| 1603 | } | 1601 | } |
| 1604 | else if (object.isString()) | 1602 | else if (object.isString()) |
manual/qpdf-manual.xml
| @@ -932,6 +932,21 @@ outfile.pdf</option> | @@ -932,6 +932,21 @@ outfile.pdf</option> | ||
| 932 | </listitem> | 932 | </listitem> |
| 933 | </varlistentry> | 933 | </varlistentry> |
| 934 | <varlistentry> | 934 | <varlistentry> |
| 935 | + <term><option>--newline-before-endstream</option></term> | ||
| 936 | + <listitem> | ||
| 937 | + <para> | ||
| 938 | + Tells qpdf to insert a newline before the | ||
| 939 | + <literal>endstream</literal> keyword, not counted in the | ||
| 940 | + length, after any stream content even if the last character of | ||
| 941 | + the stream was a newline. This may result in two newlines in | ||
| 942 | + some cases. This is a requirement of PDF/A. While qpdf doesn't | ||
| 943 | + specifically know how to generate PDF/A-compliant PDFs, this | ||
| 944 | + at least prevents it from removing compliance on already | ||
| 945 | + compliant files. | ||
| 946 | + </para> | ||
| 947 | + </listitem> | ||
| 948 | + </varlistentry> | ||
| 949 | + <varlistentry> | ||
| 935 | <term><option>--qdf</option></term> | 950 | <term><option>--qdf</option></term> |
| 936 | <listitem> | 951 | <listitem> |
| 937 | <para> | 952 | <para> |
qpdf/qtest/qpdf.test
| @@ -234,7 +234,7 @@ foreach my $d (@bug_tests) | @@ -234,7 +234,7 @@ foreach my $d (@bug_tests) | ||
| 234 | show_ntests(); | 234 | show_ntests(); |
| 235 | # ---------- | 235 | # ---------- |
| 236 | $td->notify("--- Miscellaneous Tests ---"); | 236 | $td->notify("--- Miscellaneous Tests ---"); |
| 237 | -$n_tests += 88; | 237 | +$n_tests += 86; |
| 238 | 238 | ||
| 239 | $td->runtest("qpdf version", | 239 | $td->runtest("qpdf version", |
| 240 | {$td->COMMAND => "qpdf --version"}, | 240 | {$td->COMMAND => "qpdf --version"}, |
| @@ -623,16 +623,6 @@ $td->runtest("split content stream errors", | @@ -623,16 +623,6 @@ $td->runtest("split content stream errors", | ||
| 623 | $td->EXIT_STATUS => 3}, | 623 | $td->EXIT_STATUS => 3}, |
| 624 | $td->NORMALIZE_NEWLINES); | 624 | $td->NORMALIZE_NEWLINES); |
| 625 | 625 | ||
| 626 | -$td->runtest("newline before endstream", | ||
| 627 | - {$td->COMMAND => | ||
| 628 | - "qpdf --static-id --newline-before-endstream" . | ||
| 629 | - " minimal.pdf a.pdf"}, | ||
| 630 | - {$td->STRING => "", $td->EXIT_STATUS => 0}, | ||
| 631 | - $td->NORMALIZE_NEWLINES); | ||
| 632 | -$td->runtest("check output", | ||
| 633 | - {$td->FILE => "a.pdf"}, | ||
| 634 | - {$td->FILE => "newline-before-endstream.pdf"}); | ||
| 635 | - | ||
| 636 | # Demonstrate show-xref after check and not after check to illustrate | 626 | # Demonstrate show-xref after check and not after check to illustrate |
| 637 | # that it can dump the real xref or the recovered xref. | 627 | # that it can dump the real xref or the recovered xref. |
| 638 | $td->runtest("dump bad xref", | 628 | $td->runtest("dump bad xref", |
| @@ -690,6 +680,32 @@ $td->runtest("short /O or /U", | @@ -690,6 +680,32 @@ $td->runtest("short /O or /U", | ||
| 690 | 680 | ||
| 691 | show_ntests(); | 681 | show_ntests(); |
| 692 | # ---------- | 682 | # ---------- |
| 683 | +$td->notify("--- Newline before endstream ---"); | ||
| 684 | +$n_tests += 8; | ||
| 685 | +foreach my $d ( | ||
| 686 | + ['--qdf', 'qdf', 'qdf'], | ||
| 687 | + ['--newline-before-endstream', 'newline', 'nl'], | ||
| 688 | + ['--qdf --newline-before-endstream', 'newline and qdf', 'nl-qdf'], | ||
| 689 | + ) | ||
| 690 | +{ | ||
| 691 | + my ($flags, $description, $suffix) = @$d; | ||
| 692 | + $td->runtest("newline before endstream: $description", | ||
| 693 | + {$td->COMMAND => "qpdf --static-id --stream-data=preserve" . | ||
| 694 | + " $flags streams-with-newlines.pdf a.pdf"}, | ||
| 695 | + {$td->STRING => "", $td->EXIT_STATUS => 0}, | ||
| 696 | + $td->NORMALIZE_NEWLINES); | ||
| 697 | + $td->runtest("check output", | ||
| 698 | + {$td->FILE => "a.pdf"}, | ||
| 699 | + {$td->FILE => "newline-before-endstream-$suffix.pdf"}); | ||
| 700 | + if ($flags =~ /qdf/) | ||
| 701 | + { | ||
| 702 | + $td->runtest("fix-qdf", | ||
| 703 | + {$td->COMMAND => "fix-qdf a.pdf"}, | ||
| 704 | + {$td->FILE => "a.pdf", $td->EXIT_STATUS => 0}); | ||
| 705 | + } | ||
| 706 | +} | ||
| 707 | +show_ntests(); | ||
| 708 | +# ---------- | ||
| 693 | $td->notify("--- Single Page ---"); | 709 | $td->notify("--- Single Page ---"); |
| 694 | # sp = single-pages | 710 | # sp = single-pages |
| 695 | my @sp_cases = ( | 711 | my @sp_cases = ( |
qpdf/qtest/qpdf/newline-before-endstream-nl-qdf.pdf
0 โ 100644
| 1 | +%PDF-1.3 | ||
| 2 | +%ยฟรทยขรพ | ||
| 3 | +%QDF-1.0 | ||
| 4 | + | ||
| 5 | +%% Original object ID: 1 0 | ||
| 6 | +1 0 obj | ||
| 7 | +<< | ||
| 8 | + /Pages 2 0 R | ||
| 9 | + /Type /Catalog | ||
| 10 | +>> | ||
| 11 | +endobj | ||
| 12 | + | ||
| 13 | +%% Original object ID: 2 0 | ||
| 14 | +2 0 obj | ||
| 15 | +<< | ||
| 16 | + /Count 3 | ||
| 17 | + /Kids [ | ||
| 18 | + 3 0 R | ||
| 19 | + 4 0 R | ||
| 20 | + 5 0 R | ||
| 21 | + ] | ||
| 22 | + /Type /Pages | ||
| 23 | +>> | ||
| 24 | +endobj | ||
| 25 | + | ||
| 26 | +%% Page 1 | ||
| 27 | +%% Original object ID: 3 0 | ||
| 28 | +3 0 obj | ||
| 29 | +<< | ||
| 30 | + /Contents 6 0 R | ||
| 31 | + /MediaBox [ | ||
| 32 | + 0 | ||
| 33 | + 0 | ||
| 34 | + 612 | ||
| 35 | + 792 | ||
| 36 | + ] | ||
| 37 | + /Parent 2 0 R | ||
| 38 | + /Resources << | ||
| 39 | + /Font << | ||
| 40 | + /F1 8 0 R | ||
| 41 | + >> | ||
| 42 | + /ProcSet 9 0 R | ||
| 43 | + >> | ||
| 44 | + /Type /Page | ||
| 45 | +>> | ||
| 46 | +endobj | ||
| 47 | + | ||
| 48 | +%% Page 2 | ||
| 49 | +%% Original object ID: 4 0 | ||
| 50 | +4 0 obj | ||
| 51 | +<< | ||
| 52 | + /Contents 10 0 R | ||
| 53 | + /MediaBox [ | ||
| 54 | + 0 | ||
| 55 | + 0 | ||
| 56 | + 612 | ||
| 57 | + 792 | ||
| 58 | + ] | ||
| 59 | + /Parent 2 0 R | ||
| 60 | + /Resources << | ||
| 61 | + /Font << | ||
| 62 | + /F1 12 0 R | ||
| 63 | + >> | ||
| 64 | + /ProcSet 13 0 R | ||
| 65 | + >> | ||
| 66 | + /Type /Page | ||
| 67 | +>> | ||
| 68 | +endobj | ||
| 69 | + | ||
| 70 | +%% Page 3 | ||
| 71 | +%% Original object ID: 5 0 | ||
| 72 | +5 0 obj | ||
| 73 | +<< | ||
| 74 | + /Contents 14 0 R | ||
| 75 | + /MediaBox [ | ||
| 76 | + 0 | ||
| 77 | + 0 | ||
| 78 | + 612 | ||
| 79 | + 792 | ||
| 80 | + ] | ||
| 81 | + /Parent 2 0 R | ||
| 82 | + /Resources << | ||
| 83 | + /Font << | ||
| 84 | + /F1 16 0 R | ||
| 85 | + >> | ||
| 86 | + /ProcSet 17 0 R | ||
| 87 | + >> | ||
| 88 | + /Type /Page | ||
| 89 | +>> | ||
| 90 | +endobj | ||
| 91 | + | ||
| 92 | +%% Contents for page 1 | ||
| 93 | +%% Original object ID: 6 0 | ||
| 94 | +6 0 obj | ||
| 95 | +<< | ||
| 96 | + /Length 7 0 R | ||
| 97 | +>> | ||
| 98 | +stream | ||
| 99 | +% Stream contains a newline as part of its length | ||
| 100 | +BT | ||
| 101 | + /F1 24 Tf | ||
| 102 | + 72 720 Td | ||
| 103 | + (Potato) Tj | ||
| 104 | +ET | ||
| 105 | + | ||
| 106 | +endstream | ||
| 107 | +endobj | ||
| 108 | + | ||
| 109 | +%QDF: ignore_newline | ||
| 110 | +7 0 obj | ||
| 111 | +94 | ||
| 112 | +endobj | ||
| 113 | + | ||
| 114 | +%% Original object ID: 7 0 | ||
| 115 | +8 0 obj | ||
| 116 | +<< | ||
| 117 | + /BaseFont /Helvetica | ||
| 118 | + /Encoding /WinAnsiEncoding | ||
| 119 | + /Name /F1 | ||
| 120 | + /Subtype /Type1 | ||
| 121 | + /Type /Font | ||
| 122 | +>> | ||
| 123 | +endobj | ||
| 124 | + | ||
| 125 | +%% Original object ID: 8 0 | ||
| 126 | +9 0 obj | ||
| 127 | +[ | ||
| 128 | |||
| 129 | + /Text | ||
| 130 | +] | ||
| 131 | +endobj | ||
| 132 | + | ||
| 133 | +%% Contents for page 2 | ||
| 134 | +%% Original object ID: 9 0 | ||
| 135 | +10 0 obj | ||
| 136 | +<< | ||
| 137 | + /Length 11 0 R | ||
| 138 | +>> | ||
| 139 | +stream | ||
| 140 | +% Stream data does not end with a newline but endstream is preceded by | ||
| 141 | +% a newline. | ||
| 142 | +BT | ||
| 143 | + /F1 24 Tf | ||
| 144 | + 72 720 Td | ||
| 145 | + (Potato) Tj | ||
| 146 | +ET | ||
| 147 | + | ||
| 148 | +endstream | ||
| 149 | +endobj | ||
| 150 | + | ||
| 151 | +%QDF: ignore_newline | ||
| 152 | +11 0 obj | ||
| 153 | +128 | ||
| 154 | +endobj | ||
| 155 | + | ||
| 156 | +%% Original object ID: 10 0 | ||
| 157 | +12 0 obj | ||
| 158 | +<< | ||
| 159 | + /BaseFont /Helvetica | ||
| 160 | + /Encoding /WinAnsiEncoding | ||
| 161 | + /Name /F1 | ||
| 162 | + /Subtype /Type1 | ||
| 163 | + /Type /Font | ||
| 164 | +>> | ||
| 165 | +endobj | ||
| 166 | + | ||
| 167 | +%% Original object ID: 11 0 | ||
| 168 | +13 0 obj | ||
| 169 | +[ | ||
| 170 | |||
| 171 | + /Text | ||
| 172 | +] | ||
| 173 | +endobj | ||
| 174 | + | ||
| 175 | +%% Contents for page 3 | ||
| 176 | +%% Original object ID: 12 0 | ||
| 177 | +14 0 obj | ||
| 178 | +<< | ||
| 179 | + /Length 15 0 R | ||
| 180 | +>> | ||
| 181 | +stream | ||
| 182 | +% Stream data does not end with a newline and endstream is not | ||
| 183 | +% preceded by a newline. | ||
| 184 | +BT | ||
| 185 | + /F1 24 Tf | ||
| 186 | + 72 720 Td | ||
| 187 | + (Potato) Tj | ||
| 188 | +ET | ||
| 189 | + | ||
| 190 | +endstream | ||
| 191 | +endobj | ||
| 192 | + | ||
| 193 | +%QDF: ignore_newline | ||
| 194 | +15 0 obj | ||
| 195 | +132 | ||
| 196 | +endobj | ||
| 197 | + | ||
| 198 | +%% Original object ID: 13 0 | ||
| 199 | +16 0 obj | ||
| 200 | +<< | ||
| 201 | + /BaseFont /Helvetica | ||
| 202 | + /Encoding /WinAnsiEncoding | ||
| 203 | + /Name /F1 | ||
| 204 | + /Subtype /Type1 | ||
| 205 | + /Type /Font | ||
| 206 | +>> | ||
| 207 | +endobj | ||
| 208 | + | ||
| 209 | +%% Original object ID: 14 0 | ||
| 210 | +17 0 obj | ||
| 211 | +[ | ||
| 212 | |||
| 213 | + /Text | ||
| 214 | +] | ||
| 215 | +endobj | ||
| 216 | + | ||
| 217 | +xref | ||
| 218 | +0 18 | ||
| 219 | +0000000000 65535 f | ||
| 220 | +0000000052 00000 n | ||
| 221 | +0000000133 00000 n | ||
| 222 | +0000000262 00000 n | ||
| 223 | +0000000491 00000 n | ||
| 224 | +0000000723 00000 n | ||
| 225 | +0000000968 00000 n | ||
| 226 | +0000001139 00000 n | ||
| 227 | +0000001185 00000 n | ||
| 228 | +0000001330 00000 n | ||
| 229 | +0000001415 00000 n | ||
| 230 | +0000001622 00000 n | ||
| 231 | +0000001671 00000 n | ||
| 232 | +0000001818 00000 n | ||
| 233 | +0000001905 00000 n | ||
| 234 | +0000002116 00000 n | ||
| 235 | +0000002165 00000 n | ||
| 236 | +0000002312 00000 n | ||
| 237 | +trailer << | ||
| 238 | + /Root 1 0 R | ||
| 239 | + /Size 18 | ||
| 240 | + /ID [<ff82013f9cede898ae8db2f2f177aa1d><31415926535897932384626433832795>] | ||
| 241 | +>> | ||
| 242 | +startxref | ||
| 243 | +2348 | ||
| 244 | +%%EOF |
qpdf/qtest/qpdf/newline-before-endstream-nl.pdf
0 โ 100644
| 1 | +%PDF-1.3 | ||
| 2 | +%ยฟรทยขรพ | ||
| 3 | +1 0 obj | ||
| 4 | +<< /Pages 2 0 R /Type /Catalog >> | ||
| 5 | +endobj | ||
| 6 | +2 0 obj | ||
| 7 | +<< /Count 3 /Kids [ 3 0 R 4 0 R 5 0 R ] /Type /Pages >> | ||
| 8 | +endobj | ||
| 9 | +3 0 obj | ||
| 10 | +<< /Contents 6 0 R /MediaBox [ 0 0 612 792 ] /Parent 2 0 R /Resources << /Font << /F1 7 0 R >> /ProcSet 8 0 R >> /Type /Page >> | ||
| 11 | +endobj | ||
| 12 | +4 0 obj | ||
| 13 | +<< /Contents 9 0 R /MediaBox [ 0 0 612 792 ] /Parent 2 0 R /Resources << /Font << /F1 10 0 R >> /ProcSet 11 0 R >> /Type /Page >> | ||
| 14 | +endobj | ||
| 15 | +5 0 obj | ||
| 16 | +<< /Contents 12 0 R /MediaBox [ 0 0 612 792 ] /Parent 2 0 R /Resources << /Font << /F1 13 0 R >> /ProcSet 14 0 R >> /Type /Page >> | ||
| 17 | +endobj | ||
| 18 | +6 0 obj | ||
| 19 | +<< /Length 94 >> | ||
| 20 | +stream | ||
| 21 | +% Stream contains a newline as part of its length | ||
| 22 | +BT | ||
| 23 | + /F1 24 Tf | ||
| 24 | + 72 720 Td | ||
| 25 | + (Potato) Tj | ||
| 26 | +ET | ||
| 27 | + | ||
| 28 | +endstream | ||
| 29 | +endobj | ||
| 30 | +7 0 obj | ||
| 31 | +<< /BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font >> | ||
| 32 | +endobj | ||
| 33 | +8 0 obj | ||
| 34 | +[ /PDF /Text ] | ||
| 35 | +endobj | ||
| 36 | +9 0 obj | ||
| 37 | +<< /Length 127 >> | ||
| 38 | +stream | ||
| 39 | +% Stream data does not end with a newline but endstream is preceded by | ||
| 40 | +% a newline. | ||
| 41 | +BT | ||
| 42 | + /F1 24 Tf | ||
| 43 | + 72 720 Td | ||
| 44 | + (Potato) Tj | ||
| 45 | +ET | ||
| 46 | +endstream | ||
| 47 | +endobj | ||
| 48 | +10 0 obj | ||
| 49 | +<< /BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font >> | ||
| 50 | +endobj | ||
| 51 | +11 0 obj | ||
| 52 | +[ /PDF /Text ] | ||
| 53 | +endobj | ||
| 54 | +12 0 obj | ||
| 55 | +<< /Length 131 >> | ||
| 56 | +stream | ||
| 57 | +% Stream data does not end with a newline and endstream is not | ||
| 58 | +% preceded by a newline. | ||
| 59 | +BT | ||
| 60 | + /F1 24 Tf | ||
| 61 | + 72 720 Td | ||
| 62 | + (Potato) Tj | ||
| 63 | +ET | ||
| 64 | +endstream | ||
| 65 | +endobj | ||
| 66 | +13 0 obj | ||
| 67 | +<< /BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font >> | ||
| 68 | +endobj | ||
| 69 | +14 0 obj | ||
| 70 | +[ /PDF /Text ] | ||
| 71 | +endobj | ||
| 72 | +xref | ||
| 73 | +0 15 | ||
| 74 | +0000000000 65535 f | ||
| 75 | +0000000015 00000 n | ||
| 76 | +0000000064 00000 n | ||
| 77 | +0000000135 00000 n | ||
| 78 | +0000000278 00000 n | ||
| 79 | +0000000423 00000 n | ||
| 80 | +0000000569 00000 n | ||
| 81 | +0000000713 00000 n | ||
| 82 | +0000000820 00000 n | ||
| 83 | +0000000850 00000 n | ||
| 84 | +0000001028 00000 n | ||
| 85 | +0000001136 00000 n | ||
| 86 | +0000001167 00000 n | ||
| 87 | +0000001350 00000 n | ||
| 88 | +0000001458 00000 n | ||
| 89 | +trailer << /Root 1 0 R /Size 15 /ID [<ff82013f9cede898ae8db2f2f177aa1d><31415926535897932384626433832795>] >> | ||
| 90 | +startxref | ||
| 91 | +1489 | ||
| 92 | +%%EOF |
qpdf/qtest/qpdf/newline-before-endstream-qdf.pdf
0 โ 100644
| 1 | +%PDF-1.3 | ||
| 2 | +%ยฟรทยขรพ | ||
| 3 | +%QDF-1.0 | ||
| 4 | + | ||
| 5 | +%% Original object ID: 1 0 | ||
| 6 | +1 0 obj | ||
| 7 | +<< | ||
| 8 | + /Pages 2 0 R | ||
| 9 | + /Type /Catalog | ||
| 10 | +>> | ||
| 11 | +endobj | ||
| 12 | + | ||
| 13 | +%% Original object ID: 2 0 | ||
| 14 | +2 0 obj | ||
| 15 | +<< | ||
| 16 | + /Count 3 | ||
| 17 | + /Kids [ | ||
| 18 | + 3 0 R | ||
| 19 | + 4 0 R | ||
| 20 | + 5 0 R | ||
| 21 | + ] | ||
| 22 | + /Type /Pages | ||
| 23 | +>> | ||
| 24 | +endobj | ||
| 25 | + | ||
| 26 | +%% Page 1 | ||
| 27 | +%% Original object ID: 3 0 | ||
| 28 | +3 0 obj | ||
| 29 | +<< | ||
| 30 | + /Contents 6 0 R | ||
| 31 | + /MediaBox [ | ||
| 32 | + 0 | ||
| 33 | + 0 | ||
| 34 | + 612 | ||
| 35 | + 792 | ||
| 36 | + ] | ||
| 37 | + /Parent 2 0 R | ||
| 38 | + /Resources << | ||
| 39 | + /Font << | ||
| 40 | + /F1 8 0 R | ||
| 41 | + >> | ||
| 42 | + /ProcSet 9 0 R | ||
| 43 | + >> | ||
| 44 | + /Type /Page | ||
| 45 | +>> | ||
| 46 | +endobj | ||
| 47 | + | ||
| 48 | +%% Page 2 | ||
| 49 | +%% Original object ID: 4 0 | ||
| 50 | +4 0 obj | ||
| 51 | +<< | ||
| 52 | + /Contents 10 0 R | ||
| 53 | + /MediaBox [ | ||
| 54 | + 0 | ||
| 55 | + 0 | ||
| 56 | + 612 | ||
| 57 | + 792 | ||
| 58 | + ] | ||
| 59 | + /Parent 2 0 R | ||
| 60 | + /Resources << | ||
| 61 | + /Font << | ||
| 62 | + /F1 12 0 R | ||
| 63 | + >> | ||
| 64 | + /ProcSet 13 0 R | ||
| 65 | + >> | ||
| 66 | + /Type /Page | ||
| 67 | +>> | ||
| 68 | +endobj | ||
| 69 | + | ||
| 70 | +%% Page 3 | ||
| 71 | +%% Original object ID: 5 0 | ||
| 72 | +5 0 obj | ||
| 73 | +<< | ||
| 74 | + /Contents 14 0 R | ||
| 75 | + /MediaBox [ | ||
| 76 | + 0 | ||
| 77 | + 0 | ||
| 78 | + 612 | ||
| 79 | + 792 | ||
| 80 | + ] | ||
| 81 | + /Parent 2 0 R | ||
| 82 | + /Resources << | ||
| 83 | + /Font << | ||
| 84 | + /F1 16 0 R | ||
| 85 | + >> | ||
| 86 | + /ProcSet 17 0 R | ||
| 87 | + >> | ||
| 88 | + /Type /Page | ||
| 89 | +>> | ||
| 90 | +endobj | ||
| 91 | + | ||
| 92 | +%% Contents for page 1 | ||
| 93 | +%% Original object ID: 6 0 | ||
| 94 | +6 0 obj | ||
| 95 | +<< | ||
| 96 | + /Length 7 0 R | ||
| 97 | +>> | ||
| 98 | +stream | ||
| 99 | +% Stream contains a newline as part of its length | ||
| 100 | +BT | ||
| 101 | + /F1 24 Tf | ||
| 102 | + 72 720 Td | ||
| 103 | + (Potato) Tj | ||
| 104 | +ET | ||
| 105 | +endstream | ||
| 106 | +endobj | ||
| 107 | + | ||
| 108 | +7 0 obj | ||
| 109 | +94 | ||
| 110 | +endobj | ||
| 111 | + | ||
| 112 | +%% Original object ID: 7 0 | ||
| 113 | +8 0 obj | ||
| 114 | +<< | ||
| 115 | + /BaseFont /Helvetica | ||
| 116 | + /Encoding /WinAnsiEncoding | ||
| 117 | + /Name /F1 | ||
| 118 | + /Subtype /Type1 | ||
| 119 | + /Type /Font | ||
| 120 | +>> | ||
| 121 | +endobj | ||
| 122 | + | ||
| 123 | +%% Original object ID: 8 0 | ||
| 124 | +9 0 obj | ||
| 125 | +[ | ||
| 126 | |||
| 127 | + /Text | ||
| 128 | +] | ||
| 129 | +endobj | ||
| 130 | + | ||
| 131 | +%% Contents for page 2 | ||
| 132 | +%% Original object ID: 9 0 | ||
| 133 | +10 0 obj | ||
| 134 | +<< | ||
| 135 | + /Length 11 0 R | ||
| 136 | +>> | ||
| 137 | +stream | ||
| 138 | +% Stream data does not end with a newline but endstream is preceded by | ||
| 139 | +% a newline. | ||
| 140 | +BT | ||
| 141 | + /F1 24 Tf | ||
| 142 | + 72 720 Td | ||
| 143 | + (Potato) Tj | ||
| 144 | +ET | ||
| 145 | +endstream | ||
| 146 | +endobj | ||
| 147 | + | ||
| 148 | +11 0 obj | ||
| 149 | +128 | ||
| 150 | +endobj | ||
| 151 | + | ||
| 152 | +%% Original object ID: 10 0 | ||
| 153 | +12 0 obj | ||
| 154 | +<< | ||
| 155 | + /BaseFont /Helvetica | ||
| 156 | + /Encoding /WinAnsiEncoding | ||
| 157 | + /Name /F1 | ||
| 158 | + /Subtype /Type1 | ||
| 159 | + /Type /Font | ||
| 160 | +>> | ||
| 161 | +endobj | ||
| 162 | + | ||
| 163 | +%% Original object ID: 11 0 | ||
| 164 | +13 0 obj | ||
| 165 | +[ | ||
| 166 | |||
| 167 | + /Text | ||
| 168 | +] | ||
| 169 | +endobj | ||
| 170 | + | ||
| 171 | +%% Contents for page 3 | ||
| 172 | +%% Original object ID: 12 0 | ||
| 173 | +14 0 obj | ||
| 174 | +<< | ||
| 175 | + /Length 15 0 R | ||
| 176 | +>> | ||
| 177 | +stream | ||
| 178 | +% Stream data does not end with a newline and endstream is not | ||
| 179 | +% preceded by a newline. | ||
| 180 | +BT | ||
| 181 | + /F1 24 Tf | ||
| 182 | + 72 720 Td | ||
| 183 | + (Potato) Tj | ||
| 184 | +ET | ||
| 185 | +endstream | ||
| 186 | +endobj | ||
| 187 | + | ||
| 188 | +15 0 obj | ||
| 189 | +132 | ||
| 190 | +endobj | ||
| 191 | + | ||
| 192 | +%% Original object ID: 13 0 | ||
| 193 | +16 0 obj | ||
| 194 | +<< | ||
| 195 | + /BaseFont /Helvetica | ||
| 196 | + /Encoding /WinAnsiEncoding | ||
| 197 | + /Name /F1 | ||
| 198 | + /Subtype /Type1 | ||
| 199 | + /Type /Font | ||
| 200 | +>> | ||
| 201 | +endobj | ||
| 202 | + | ||
| 203 | +%% Original object ID: 14 0 | ||
| 204 | +17 0 obj | ||
| 205 | +[ | ||
| 206 | |||
| 207 | + /Text | ||
| 208 | +] | ||
| 209 | +endobj | ||
| 210 | + | ||
| 211 | +xref | ||
| 212 | +0 18 | ||
| 213 | +0000000000 65535 f | ||
| 214 | +0000000052 00000 n | ||
| 215 | +0000000133 00000 n | ||
| 216 | +0000000262 00000 n | ||
| 217 | +0000000491 00000 n | ||
| 218 | +0000000723 00000 n | ||
| 219 | +0000000968 00000 n | ||
| 220 | +0000001117 00000 n | ||
| 221 | +0000001163 00000 n | ||
| 222 | +0000001308 00000 n | ||
| 223 | +0000001393 00000 n | ||
| 224 | +0000001578 00000 n | ||
| 225 | +0000001627 00000 n | ||
| 226 | +0000001774 00000 n | ||
| 227 | +0000001861 00000 n | ||
| 228 | +0000002050 00000 n | ||
| 229 | +0000002099 00000 n | ||
| 230 | +0000002246 00000 n | ||
| 231 | +trailer << | ||
| 232 | + /Root 1 0 R | ||
| 233 | + /Size 18 | ||
| 234 | + /ID [<ff82013f9cede898ae8db2f2f177aa1d><31415926535897932384626433832795>] | ||
| 235 | +>> | ||
| 236 | +startxref | ||
| 237 | +2282 | ||
| 238 | +%%EOF |
qpdf/qtest/qpdf/newline-before-endstream.pdf deleted
No preview for this file type
qpdf/qtest/qpdf/streams-with-newlines.pdf
0 โ 100644
| 1 | +%PDF-1.3 | ||
| 2 | +%ยฟรทยขรพ | ||
| 3 | +1 0 obj | ||
| 4 | +<< /Pages 2 0 R /Type /Catalog >> | ||
| 5 | +endobj | ||
| 6 | +2 0 obj | ||
| 7 | +<< /Count 3 /Kids [ 3 0 R 4 0 R 5 0 R ] /Type /Pages >> | ||
| 8 | +endobj | ||
| 9 | +3 0 obj | ||
| 10 | +<< /Contents 6 0 R /MediaBox [ 0 0 612 792 ] /Parent 2 0 R /Resources << /Font << /F1 7 0 R >> /ProcSet 8 0 R >> /Type /Page >> | ||
| 11 | +endobj | ||
| 12 | +4 0 obj | ||
| 13 | +<< /Contents 9 0 R /MediaBox [ 0 0 612 792 ] /Parent 2 0 R /Resources << /Font << /F1 10 0 R >> /ProcSet 11 0 R >> /Type /Page >> | ||
| 14 | +endobj | ||
| 15 | +5 0 obj | ||
| 16 | +<< /Contents 12 0 R /MediaBox [ 0 0 612 792 ] /Parent 2 0 R /Resources << /Font << /F1 13 0 R >> /ProcSet 14 0 R >> /Type /Page >> | ||
| 17 | +endobj | ||
| 18 | +6 0 obj | ||
| 19 | +<< /Length 94 >> | ||
| 20 | +stream | ||
| 21 | +% Stream contains a newline as part of its length | ||
| 22 | +BT | ||
| 23 | + /F1 24 Tf | ||
| 24 | + 72 720 Td | ||
| 25 | + (Potato) Tj | ||
| 26 | +ET | ||
| 27 | +endstream | ||
| 28 | +endobj | ||
| 29 | +7 0 obj | ||
| 30 | +<< /BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font >> | ||
| 31 | +endobj | ||
| 32 | +8 0 obj | ||
| 33 | +[ /PDF /Text ] | ||
| 34 | +endobj | ||
| 35 | +9 0 obj | ||
| 36 | +<< /Length 127 >> | ||
| 37 | +stream | ||
| 38 | +% Stream data does not end with a newline but endstream is preceded by | ||
| 39 | +% a newline. | ||
| 40 | +BT | ||
| 41 | + /F1 24 Tf | ||
| 42 | + 72 720 Td | ||
| 43 | + (Potato) Tj | ||
| 44 | +ET | ||
| 45 | +endstream | ||
| 46 | +endobj | ||
| 47 | +10 0 obj | ||
| 48 | +<< /BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font >> | ||
| 49 | +endobj | ||
| 50 | +11 0 obj | ||
| 51 | +[ /PDF /Text ] | ||
| 52 | +endobj | ||
| 53 | +12 0 obj | ||
| 54 | +<< /Length 131 >> | ||
| 55 | +stream | ||
| 56 | +% Stream data does not end with a newline and endstream is not | ||
| 57 | +% preceded by a newline. | ||
| 58 | +BT | ||
| 59 | + /F1 24 Tf | ||
| 60 | + 72 720 Td | ||
| 61 | + (Potato) Tj | ||
| 62 | +ETendstream | ||
| 63 | +endobj | ||
| 64 | +13 0 obj | ||
| 65 | +<< /BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font >> | ||
| 66 | +endobj | ||
| 67 | +14 0 obj | ||
| 68 | +[ /PDF /Text ] | ||
| 69 | +endobj | ||
| 70 | +xref | ||
| 71 | +0 15 | ||
| 72 | +0000000000 65535 f | ||
| 73 | +0000000015 00000 n | ||
| 74 | +0000000064 00000 n | ||
| 75 | +0000000135 00000 n | ||
| 76 | +0000000278 00000 n | ||
| 77 | +0000000423 00000 n | ||
| 78 | +0000000569 00000 n | ||
| 79 | +0000000712 00000 n | ||
| 80 | +0000000819 00000 n | ||
| 81 | +0000000849 00000 n | ||
| 82 | +0000001027 00000 n | ||
| 83 | +0000001135 00000 n | ||
| 84 | +0000001166 00000 n | ||
| 85 | +0000001348 00000 n | ||
| 86 | +0000001456 00000 n | ||
| 87 | +trailer << /Root 1 0 R /Size 15 /ID [<ff82013f9cede898ae8db2f2f177aa1d><7eb8172a38e90a48184c5bf01c8020b0>] >> | ||
| 88 | +startxref | ||
| 89 | +1487 | ||
| 90 | +%%EOF |