e: [OS X TeX] Compressing pdf graphics

Chabot Denis chabotd at globetrotter.net
Wed May 23 22:20:43 EDT 2007


Hi,

Thanks to many of you who sent suggestions about compressing  
"graphics-to-be-included" individually, or the whole LaTeX-produced  
pdf document all at once. In a second message I'll mention some tests  
I've done.

But I'd like to show you these extracts from the pdftex manual and  
ask those of you who understand TeX better than me if one or the  
other of these two options would be helpful.

I do not understand the difference between stream and non-stream  
objects...

And I obviously do not know how to use these commands. Putting them  
in my preamble had hardly any effect. For my 20.6 MB pdf, adding


\pdfcompresslevel{9}

to the preamble still resulted in a 20.6 MB pdf output.

adding these:

\pdfminorversion=5
\pdfcompresslevel=9
\pdfobjcompresslevel=2

resulted in a minor saving (down to 20.4 MB). Remember, this is the  
file that shrinks down to a bit less than 7 MB using Acrobat "reduce- 
file compatibility Acrobat 6" command & setting.

Now the text from the pdftex doc:

>  \pdfcompresslevel (integer)
> This integer parameter specifies the level of stream compression  
> (text, in--line graphics, and embedded
> png images (only if they are un- and re--compressed during the  
> embedding process); all done by the zlib
> library). Zero means no compression, 1 means fastest, 9 means best,  
> 2..8 means something in between.
> A value outside this range will be adjusted to the nearest  
> meaningful value. This parameter is read each
> time pdfTEX starts a stream. Setting \pdfcompresslevel=0 is great  
> for pdf stream debugging.
>
>  \pdfobjcompresslevel (integer)
> This integer parameter controls the compression of non-stream  
> objects. In the pdf-1.4 specification these
> objects still had to go into the pdf file as clear text,  
> uncompressed. The pdf-1.5 specification now allows
> to collect non-stream objects as “compressed objects” into “object  
> stream” objects (/Type /ObjStm, see
> pdf Ref. 5th ed., sect. 3.4.6). At the pdf file end instead of the  
> object table then an /XRef cross-reference
> stream is written out. This results in considerably smaller pdf  
> files, particularly if lots of annotations and
> links are used. The primitive has been introduced in pdfTEX 1.40.0.
> The writing of compressed objects is enabled by setting  
> \pdfobjcompresslevel to a value between
> 1 and 3; it’s disabled by value 0 (default). Enabling requires that  
> also \pdfminorversion > 4. If
> \pdfobjcompresslevel > 0, but \pdfminorversion < 5, a warning is  
> given and object stream writing
> is disabled. The \pdfobjcompresslevel value is clipped to the range  
> 0..3. Using values outside this
> range is not recommended (for future extension).
> The \pdfobjcompresslevel settings have the following effects: When  
> set to 0, no object streams are
> generated at all. When set to 1, all non-stream objects are  
> compressed with the exception of any objects
> coming with embedded pdf files (“paranoid” mode, to avoid yet  
> unknown problems), and also the
> /Info dictionary is not compressed for clear-text legibility. When  
> set to 2, also all non-stream objects
> coming with embedded pdf files are compressed, but the /Info  
> dictionary is still not compressed.
> Finally, when set to 3, all non-stream objects are compressed,  
> including the /Info dictionary (this
> means that the /Info can’t be read as clear text any more). If  
> object streams are to be used, currently
> \pdfobjcompresslevel=2 is recommended,
> Caveat: pdf files generated with object streams enabled can’t be  
> read with (old) pdf viewers that don’t
> understand pdf-1.5 files. For widest distribution and unknown  
> audience, don’t activate object stream
> writing. The pdf-1.5 standard describes also a hybrid object  
> compression mode that gives some backward
> compatibility, but this is currently not implemented, as pdf-1.5  
> seems to be rather quickly adopted by
> modern pdf viewers. Also not implemented is the optional /Extends key.



So if any of you can translate this into something I can understand  
and tell me if this goes into the preamble as I did above, I'd  
greatly appreciate. Being able to shrink the size of some of my  
documents without using Acrobat would be nice.

In another message I explore ways of shrinking individual graphics  
which have been suggested here and in personal emails.

Cheers,

Denis 
------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/





More information about the MacOSX-TeX mailing list