Commit 078cf9bf90ec22ba141ebf379e6993b491c2995d

Authored by Jay Berkenbilt
1 parent b8ccbff4

newline before endstream fix for object streams (fixes #205)

ChangeLog
  1 +2018-05-12 Jay Berkenbilt <ejb@ql.org>
  2 +
  3 + * In newline before endstream mode, an extra newline was not
  4 + inserted prior to the endstream that ends object streams.
  5 + Fixes #205.
  6 +
1 2018-04-15 Jay Berkenbilt <ejb@ql.org> 7 2018-04-15 Jay Berkenbilt <ejb@ql.org>
2 8
3 * Arbitrarily limit the depth of data structures represented by 9 * Arbitrarily limit the depth of data structures represented by
libqpdf/QPDFWriter.cc
@@ -1907,6 +1907,10 @@ QPDFWriter::writeObjectStream(QPDFObjectHandle object) @@ -1907,6 +1907,10 @@ QPDFWriter::writeObjectStream(QPDFObjectHandle object)
1907 pushEncryptionFilter(); 1907 pushEncryptionFilter();
1908 writeBuffer(stream_buffer); 1908 writeBuffer(stream_buffer);
1909 popPipelineStack(); 1909 popPipelineStack();
  1910 + if (this->m->newline_before_endstream)
  1911 + {
  1912 + writeString("\n");
  1913 + }
1910 writeString("endstream"); 1914 writeString("endstream");
1911 this->m->cur_data_key.clear(); 1915 this->m->cur_data_key.clear();
1912 closeObject(new_id); 1916 closeObject(new_id);
qpdf/qtest/qpdf.test
@@ -964,7 +964,7 @@ $td-&gt;runtest(&quot;check output&quot;, @@ -964,7 +964,7 @@ $td-&gt;runtest(&quot;check output&quot;,
964 show_ntests(); 964 show_ntests();
965 # ---------- 965 # ----------
966 $td->notify("--- Newline before endstream ---"); 966 $td->notify("--- Newline before endstream ---");
967 -$n_tests += 10; 967 +$n_tests += 12;
968 968
969 # From issue 133, http://verapdf.org/software/ is an open source 969 # From issue 133, http://verapdf.org/software/ is an open source
970 # package that can verify PDF/A compliance. This could potentially be 970 # package that can verify PDF/A compliance. This could potentially be
@@ -975,6 +975,8 @@ foreach my $d ( @@ -975,6 +975,8 @@ foreach my $d (
975 ['--qdf', 'qdf', 'qdf'], 975 ['--qdf', 'qdf', 'qdf'],
976 ['--newline-before-endstream', 'newline', 'nl'], 976 ['--newline-before-endstream', 'newline', 'nl'],
977 ['--qdf --newline-before-endstream', 'newline and qdf', 'nl-qdf'], 977 ['--qdf --newline-before-endstream', 'newline and qdf', 'nl-qdf'],
  978 + ['--object-streams=generate --newline-before-endstream',
  979 + 'newline and object streams', 'nl-objstm'],
978 ) 980 )
979 { 981 {
980 my ($flags, $description, $suffix) = @$d; 982 my ($flags, $description, $suffix) = @$d;
qpdf/qtest/qpdf/newline-before-endstream-nl-objstm.pdf 0 → 100644
No preview for this file type