From dac0598b94c877bec92a1edd78ae00021cfa1638 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Fri, 23 Aug 2019 19:54:08 -0400 Subject: Add ability to set zlib compression level globally --- include/qpdf/Pl_Flate.hh | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include') diff --git a/include/qpdf/Pl_Flate.hh b/include/qpdf/Pl_Flate.hh index f25adfbb..96e09d4b 100644 --- a/include/qpdf/Pl_Flate.hh +++ b/include/qpdf/Pl_Flate.hh @@ -28,6 +28,7 @@ class Pl_Flate: public Pipeline { public: static unsigned int const def_bufsize = 65536; + static int compression_level; enum action_e { a_inflate, a_deflate }; @@ -42,6 +43,15 @@ class Pl_Flate: public Pipeline QPDF_DLL virtual void finish(); + // Globally set compression level from 1 (fastest, least + // compression) to 9 (slowest, most compression). Use -1 to set + // the default compression level. This is passed directly to zlib. + // This method returns a pointer to the current Pl_Flate object so + // you can create a pipeline with + // Pl_Flate(...)->setCompressionLevel(...) + QPDF_DLL + static void setCompressionLevel(int); + private: void handleData(unsigned char* data, size_t len, int flush); void checkError(char const* prefix, int error_code); -- cgit v1.2.3-54-g00ecf