Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to optimizing the output of pdflatex?

1,768 views
Skip to first unread message

Meihui Fan

unread,
May 4, 2004, 2:57:08 PM5/4/04
to
Hi,

I have generated a PDF file from a LaTeX source file with pdflatex, but
it's so big a file that don't be proper for exchanging in the Internet.

I found the PDF files downloaded from the Internet have smart size,
because they have none embedded fonts and are in a compressed PDF format.

I don't know how to reach it? Anybody kindly point it out?

Meihui Fan

Till Halbach

unread,
May 4, 2004, 2:26:53 AM5/4/04
to


\pdfcompresslevel=9

Robin Fairbairns

unread,
May 4, 2004, 8:59:10 AM5/4/04
to
Meihui Fan <mh...@ustc.edu> writes:
>I have generated a PDF file from a LaTeX source file with pdflatex, but
>it's so big a file that don't be proper for exchanging in the Internet.

really large pdf is usually the result of lots of figures.

>I found the PDF files downloaded from the Internet have smart size,
>because they have none embedded fonts and are in a compressed PDF format.
>
>I don't know how to reach it? Anybody kindly point it out?

if you're using mathematics at all, you have no choice but to embed
the fonts (the alternative is to have 99% of your audience not able to
read the mathematics).

pdflatex compresses by default (but doesn't compress as well as adobe
distiller).

what pdflatex _doesn't_ do, which does a lot for browser usability, is
to linearise its output. maybe someone more expert than i, in that
area, can suggest a way of doing that.

otherwise you've to generate postscript and use acrobat distiller.
--
Robin (http://www.tex.ac.uk/faq) Fairbairns, Cambridge

Walter Schmidt

unread,
May 4, 2004, 9:30:31 AM5/4/04
to
Meihui Fan schrieb:

> I have generated a PDF file from a LaTeX source file with pdflatex, but
> it's so big a file that don't be proper for exchanging in the Internet.
>
> I found the PDF files downloaded from the Internet have smart size,
> because they have none embedded fonts

This is not recommended and may cause lots of trouble.

> and are in a compressed PDF format.

Huh? IIRC pdfTeX does compression, too.

Walter

Stefano Ghirlanda

unread,
May 4, 2004, 9:43:23 AM5/4/04
to
r...@cl.cam.ac.uk (Robin Fairbairns) writes:

> what pdflatex _doesn't_ do, which does a lot for browser usability,
> is to linearise its output. maybe someone more expert than i, in
> that area, can suggest a way of doing that.

Ghostscript comes with pdfopt, which does exaclty this. From the
manual page:

pdfopt uses gs(1) to convert the Adobe Portable Document
Format (PDF) file "input.pdf" to a so-called optimized
form in "output.pdf". Optimization puts the elements of
the file into a more linear order and adds "hint" point-
ers, allowing Adobe's Acrobat(TM) products to display
individual pages of the file more quickly when accessing
the file through a network.

--
Stefano | Department of Psychology, University of Bologna
Ghirlanda | Interdisciplinary cultural research, Stockholm University
http://www.intercult.su.se/~stefano

Dan Luecking

unread,
May 4, 2004, 12:07:38 PM5/4/04
to
On 4 May 2004 12:59:10 GMT, r...@cl.cam.ac.uk (Robin Fairbairns) wrote:

> Meihui Fan <mh...@ustc.edu> writes:
>>I have generated a PDF file from a LaTeX source file with pdflatex, but
>>it's so big a file that don't be proper for exchanging in the Internet.
>
>really large pdf is usually the result of lots of figures.
>
>>I found the PDF files downloaded from the Internet have smart size,
>>because they have none embedded fonts and are in a compressed PDF format.
>>
>>I don't know how to reach it? Anybody kindly point it out?
>
>if you're using mathematics at all, you have no choice but to embed
>the fonts (the alternative is to have 99% of your audience not able to
>read the mathematics).

The pslatex package will attempt to replace as much as possible with
standard Times, Helvetica and Courier, which are not embedded by
default. This almost always has to rely on a couple of cm math fonts
being embedded, but it can shrink a file somewhat (from 590K to 430K
in one example of mine) and still allow math (and bullets, etc.) to be
seen. However, this difference is minor on large documents.


Dan

--
Dan Luecking Department of Mathematical Sciences
University of Arkansas Fayetteville, Arkansas 72701
To reply by email, change Look-In-Sig to luecking

George N. White III

unread,
May 5, 2004, 10:06:02 AM5/5/04
to
On Tue, 4 May 2004, Meihui Fan wrote:

> I have generated a PDF file from a LaTeX source file with pdflatex, but
> it's so big a file that don't be proper for exchanging in the Internet.

What do you consider "big"? The median size of the pdf files in
my teTeX tree is 200Kb.

> I found the PDF files downloaded from the Internet have smart size,
> because they have none embedded fonts and are in a compressed PDF format.

Adobe provide a basic set of fonts with the reader for documents with no
embedded fonts, but these base fonts have very limited support for maths.
Pdftex does not load entire fonts when only a few glyphs are used and
there are LaTeX packages that use the base fonts for text, so the penalty
for using math need not be huge. You do have to watch out for the
differences in the base fonts provided with different versions of
Adobe Reader or other PDF viewers.

> I don't know how to reach it? Anybody kindly point it out?

You don't mention if you have figures -- in my experience the biggest
reason for bloated PDF's is in the handling of images.

--
George N. White III <aa...@chebucto.ns.ca>
Head of St. Margarets Bay, Nova Scotia, Canada

Maarten Sneep

unread,
May 5, 2004, 10:41:11 AM5/5/04
to
"George N. White III" wrote:

> On Tue, 4 May 2004, Meihui Fan wrote:
>
> > I have generated a PDF file from a LaTeX source file with pdflatex, but
> > it's so big a file that don't be proper for exchanging in the Internet.

> > I found the PDF files downloaded from the Internet have smart size,
> > because they have none embedded fonts and are in a compressed PDF format.
>
> Adobe provide a basic set of fonts with the reader for documents with no
> embedded fonts, but these base fonts have very limited support for maths.
> Pdftex does not load entire fonts when only a few glyphs are used and
> there are LaTeX packages that use the base fonts for text, so the penalty
> for using math need not be huge.

Although I've found that using the cm-super fonts will produce fairly
large documents, if accented characters - combined with correct
hyphenation are needed, the latin modern fonts may provide a nice
alternative (of course at the moment this assumes that cyrillic is
_not_ used). In my experience, this can save about 400 K per pdf-file,
if a reasonable variety of characters is used (just some light maths).

> You don't mention if you have figures -- in my experience the biggest
> reason for bloated PDF's is in the handling of images.

Figures make a huge difference. if they are bitmapped (png or jpeg)
look no further for the culprits. If you include pdf, and the figures
contain lettering, you are likely to include the same typeface
multiple times. The java based multivalent tools may be of help here,
it allows you to compress a pdf file (with various options).

http://multivalent.sourceforge.net/

Maarten

0 new messages