Commit c5f622a09e6a68d87d3591346d872cf828cf82c7

Authored by Jay Berkenbilt
1 parent 4c3c658e

Bug fix: don't compress object/xref streams with --compress-streams=n

ChangeLog
  1 +2023-12-20 Jay Berkenbilt <ejb@ql.org>
  2 +
  3 + * Bug fix: with --compress-streams=n, don't compress object or
  4 + XRef streams.
  5 +
1 2023-12-16 Jay Berkenbilt <ejb@ql.org> 6 2023-12-16 Jay Berkenbilt <ejb@ql.org>
2 7
3 * Add new C++ functions "qpdf_c_get_qpdf" and "qpdf_c_wrap" to 8 * Add new C++ functions "qpdf_c_get_qpdf" and "qpdf_c_wrap" to
libqpdf/QPDFWriter.cc
@@ -1658,8 +1658,7 @@ QPDFWriter::writeObjectStream(QPDFObjectHandle object) @@ -1658,8 +1658,7 @@ QPDFWriter::writeObjectStream(QPDFObjectHandle object)
1658 1658
1659 // Set up a stream to write the stream data into a buffer. 1659 // Set up a stream to write the stream data into a buffer.
1660 Pipeline* next = pushPipeline(new Pl_Buffer("object stream")); 1660 Pipeline* next = pushPipeline(new Pl_Buffer("object stream"));
1661 - if ((m->compress_streams || (m->stream_decode_level == qpdf_dl_none)) &&  
1662 - (!m->qdf_mode)) { 1661 + if (m->compress_streams && !m->qdf_mode) {
1663 compressed = true; 1662 compressed = true;
1664 next = 1663 next =
1665 pushPipeline(new Pl_Flate("compress object stream", next, Pl_Flate::a_deflate)); 1664 pushPipeline(new Pl_Flate("compress object stream", next, Pl_Flate::a_deflate));
@@ -2417,7 +2416,7 @@ QPDFWriter::writeXRefStream( @@ -2417,7 +2416,7 @@ QPDFWriter::writeXRefStream(
2417 2416
2418 Pipeline* p = pushPipeline(new Pl_Buffer("xref stream")); 2417 Pipeline* p = pushPipeline(new Pl_Buffer("xref stream"));
2419 bool compressed = false; 2418 bool compressed = false;
2420 - if ((m->compress_streams || (m->stream_decode_level == qpdf_dl_none)) && (!m->qdf_mode)) { 2419 + if (m->compress_streams && !m->qdf_mode) {
2421 compressed = true; 2420 compressed = true;
2422 if (!skip_compression) { 2421 if (!skip_compression) {
2423 // Write the stream dictionary for compression but don't actually compress. This helps 2422 // Write the stream dictionary for compression but don't actually compress. This helps
qpdf/qtest/qpdf/good17-not-recompressed.pdf
No preview for this file type
qpdf/qtest/qpdf/newline-before-endstream-nl-objstm.pdf
No preview for this file type