mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 10:58:58 +00:00
In QPDFWriter::writeLinearized remember whether streams are filtered
This commit is contained in:
parent
634d924986
commit
99f3a7b5a3
@ -2544,14 +2544,20 @@ QPDFWriter::writeLinearized()
|
||||
{
|
||||
// Optimize file and enqueue objects in order
|
||||
|
||||
auto skip_stream_parameters = [this](QPDFObjectHandle& stream) {
|
||||
std::map<int, int> stream_cache;
|
||||
|
||||
auto skip_stream_parameters = [this, &stream_cache](QPDFObjectHandle& stream) {
|
||||
auto& result = stream_cache[stream.getObjectID()];
|
||||
if (result == 0) {
|
||||
bool compress_stream;
|
||||
bool is_metadata;
|
||||
if (willFilterStream(stream, compress_stream, is_metadata, nullptr)) {
|
||||
return 2;
|
||||
result = 2;
|
||||
} else {
|
||||
return 1;
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
QPDF::Writer::optimize(m->pdf, m->obj, skip_stream_parameters);
|
||||
|
Loading…
Reference in New Issue
Block a user