From 2794bfb1a665cad93a38144bea0ba0daea7152e7 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Fri, 23 Aug 2019 19:59:38 -0400 Subject: Add flags to control zlib compression level (fixes #113) --- manual/build.mk | 3 +- manual/qpdf-manual.xml | 98 +++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 88 insertions(+), 13 deletions(-) (limited to 'manual') diff --git a/manual/build.mk b/manual/build.mk index 03e8fe56..3911b8e2 100644 --- a/manual/build.mk +++ b/manual/build.mk @@ -26,7 +26,8 @@ endif $(OUTDOC).pdf: $(OUTDOC).fo qpdf/build/qpdf $(FOP) $< -pdf $@.tmp - qpdf/build/qpdf --linearize $@.tmp $@ + qpdf/build/qpdf --linearize --object-streams=generate \ + --recompress-flate --compression-level=9 $@.tmp $@ $(OUTDOC).html: $(INDOC).xml manual/html.xsl $(VALIDATE) $(XSLTPROC) --output $@ manual/html.xsl $< diff --git a/manual/qpdf-manual.xml b/manual/qpdf-manual.xml index db2a54fa..6e72456e 100644 --- a/manual/qpdf-manual.xml +++ b/manual/qpdf-manual.xml @@ -1433,27 +1433,32 @@ outfile.pdf : decode streams filtered with - supported generalized filters: , - , - , and - . We define generalized + supported generalized filters: + /LZWDecode, + /FlateDecode, + /ASCII85Decode, and + /ASCIIHexDecode. We define generalized filters as those to be used for general-purpose compression or encoding, as opposed to filters specifically designed - for image data. + for image data. Note that, by default, streams already + compressed with /FlateDecode are not + uncompressed and recompressed unless you also specify + . : in addition to generalized, decode streams with supported non-lossy specialized - filters; currently this is just + filters; currently this is just + /RunLengthDecode : in addition to generalized and specialized, decode streams with supported lossy filters; - currently this is just (JPEG) + currently this is just /DCTDecode (JPEG) @@ -1476,7 +1481,10 @@ outfile.pdf : recompress stream data when possible (default); equivalent to - + . Does not + recompress streams already compressed with + /FlateDecode unless + is also specified. @@ -1498,6 +1506,37 @@ outfile.pdf + + + + + By default, streams already compressed with + /FlateDecode are left alone rather than + being uncompressed and recompressed. This option causes qpdf + to uncompress and recompress the streams. There is a + significant performance cost to using this option, but you + probably want to use it if you specify + . + + + + + + + + When writing new streams that are compressed with + /FlateDecode, use the specified compression + level. The value of should be a number + from 1 to 9 and is passed directly to zlib, which implements + deflate compression. Note that qpdf doesn't uncompress and + recompress streams by default. To have this option apply to + already compressed streams, you should also specify + . If your goal is to shrink + the size of PDF files, you should also use + . + + + @@ -4449,7 +4488,7 @@ print "\n"; - Library Enhancements + Library and CLI Enhancements @@ -4508,6 +4547,41 @@ print "\n"; bytes of the combined contents. + + + Static method + Pl_Flate::setCompressionLevel can be + called to set the zlib compression level globally used by + all instances of Pl_Flate in deflate mode. + + + + + The method + QPDFWriter::setRecompressFlate can be + called to tell QPDFWriter to + uncompress and recompress streams already compressed with + /FlateDecode. + + + + + CLI enhancement: the + instructs qpdf to recompress streams that + are already compressed with /FlateDecode. + Useful with . + + + + + CLI enhancement: the + + sets the zlib compression level used for any streams + compressed by /FlateDecode. Most + effective when combined with + . + + The underlying implementation of QPDF arrays has been @@ -5699,9 +5773,9 @@ print "\n"; Disregard data check errors when uncompressing - streams. This is consistent with - most other PDF readers and allows qpdf to recover data from - another class of malformed PDF files. + /FlateDecode streams. This is consistent + with most other PDF readers and allows qpdf to recover data + from another class of malformed PDF files. -- cgit v1.2.3-54-g00ecf