# File size difference between XeLaTeX and pdfLaTeX

When working with MacTeX 2010, I noticed that XeLaTeX generates files considerably smaller than pdfLaTeX on the same input.

Even with the small example

\documentclass[11pt]{article}
\begin{document}
Test
\end{document}


pdfLaTeX generates a pdf-file around 10KB, while XeLaTeX produces one around 2KB. With larger projects, I was still able to reduce the size by a factor of 2 with no noticable changes in the output.

Does anyone know what causes the difference in the file size?

-
The discussion on this question may be relevant. – ESultanik Mar 23 '11 at 15:40
As mentioned in the thread posted by @ESultanik: The compiler version is important. Which version of pdflatex and xelatex are you using? They print its version onto the terminal and into the log file. I don't know which version come with MacTeX 2010. – Martin Scharrer Mar 23 '11 at 15:42
The versions are pdflatex: 3.1415926-1.40.11; xelatex: 3.1415926-2.2-0.9997.4. – noumea Mar 23 '11 at 15:52

For you minimal example it is the font format which makes the difference. This can be seen by comparing the PDFs in an editor which supports binary (like vim).

Also pdffonts is helpful:

xelatex: (1874 bytes compressed, 2444 bytes uncompressed)
name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
ZOJBFE+CMR10                         Type 1C           yes yes no       6  0

pdflatex: (10785 bytes compressed, 11677 bytes uncompressed)
name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
SLFVOY+CMR10                         Type 1            yes yes no       2  0


The pdffonts manual states that "Type 1C" is the Compact Font Format (CFF) which is as the name says more compact.

With larger projects, I was still able to reduce the size by a factor of 2 with no noticeable changes in the output.

It depends on what font you are using and what you mean with "larger". I recently figured out that changing to T1 increase a 9-page manual (ydoc package) from 217K to 323K. Changing to the libertine font makes 482K out of it. See How to create small final PDF files for the Internet for tips on how to reduce the file size.

-
I was too slow to post an answer so I just add that in some cases, pdfLaTeX output could be smaller than XeTeX as described here: web.archiveorange.com/archive/v/tMRBZxjM24pXVoAkUcZU If you want to achieve the smallest possible size, it is also worth trying latex+dvips+ps2pdf. – Harold Cavendish Mar 23 '11 at 15:43