Commit cb85d369b4f9772b6e203c843d427f9473f2b2f3
Committed by
m-holger
1 parent
2a4495dd
Don't apply filters to empty stream objects
Showing
1 changed file
with
6 additions
and
0 deletions
libqpdf/QPDFWriter.cc
| ... | ... | @@ -1293,6 +1293,12 @@ QPDFWriter::willFilterStream( |
| 1293 | 1293 | QTC::TC("qpdf", "QPDFWriter compressing uncompressed stream"); |
| 1294 | 1294 | } |
| 1295 | 1295 | |
| 1296 | + // Disable compression for empty streams to improve compatibility | |
| 1297 | + if (stream_dict.getKey("/Length").isInteger() && stream_dict.getKey("/Length").getIntValue() == 0) { | |
| 1298 | + filter = true; | |
| 1299 | + compress_stream = false; | |
| 1300 | + } | |
| 1301 | + | |
| 1296 | 1302 | bool filtered = false; |
| 1297 | 1303 | for (bool first_attempt: {true, false}) { |
| 1298 | 1304 | PipelinePopper pp_stream_data(this); | ... | ... |