70

I created a simple MS Word document containing just this sentence:

This is a small document.

Nothing else. Then I've saved this document as DOCX and a PDF. Here are the file sizes:

DOCX: 12 kB
PDF: 89 kB

This difference is huge, technically, and it really starts bothering me when mostly textual documents that are tens of kB in DOCX start generating PDFs that are hundreds of kB large. What's so inefficient about the PDF format? Or is just Word using some terrible output algorithm?

BTW, the PDF output settings were set to create the smallest file possible:

PDF output options

  • 28
    My guess is that the PDF embeds the font, which is necessary if a document is to be truly portable. – AFH Sep 30 '15 at 8:29
  • 2
    Yes, the font subset is embedded. That might be it. I've tried to repeat the same sentence a few hundred times and the PDF file size only grew by 4 kB which is just about right. (DOCX stayed on 12kB which is no surprise as that is a zipped format and repeated text will take hardly any new bytes.) – Borek Bernard Sep 30 '15 at 8:37
  • 1
    @AFH It does not embed Arial. i.stack.imgur.com/aUZgt.png – MonkeyZeus Sep 30 '15 at 12:43
  • 1
    Thinking about it from a Kolmogorov complexity standpoint, Microsoft Word is larger than your average PDF viewer, by much more than a few hundred kB. – hobbs Sep 30 '15 at 15:06
  • 8
    I think the real question is why your wordprocessing format is so much bigger than the equivalent LaTeX ... :-p – Toby Speight Sep 30 '15 at 16:40
104

If you open the PDF in notepad++ you'll find:

9 0 obj
<</Filter/FlateDecode/Length 79100/Length1 171804>>
stream
xœì}    XTGºvÕ9½/t7Ðl
..... many more bytes  ...   ëH|  
endstream
endobj
10 0 obj

and that object is referenced here at the end in the /FontFile2 instruction:

6 0 obj
<</Type/FontDescriptor/FontName/ABCDEE+Calibri/Flags 32/ItalicAngle 0/Ascent 750/Descent -250/CapHeight 750/AvgWidth 521/MaxWidth 1743/FontWeight 400/XHeight 250/StemV 52/FontBBox[ -503 -250 1240 750] /FontFile2 9 0 R>>
endobj

The Fonts used by the Word document gets embedded into the PDF so the pdf is self-contained.

I used this slide-deck to decypher the PDF instructions.

If you want to prevent the fonts being embedded in the PDF file make sure your Word document makes use of one of the 14 standard typefaces available in PDF viewers, (source Wikipedia)

  • Times New Roman > Times (v3) (in regular, italic, bold, and bold italic)
  • Courier New > Courier (in regular, oblique, bold and bold oblique)
  • Arial > Helvetica (v3) (in regular, oblique, bold and bold oblique)
  • Symbol > Symbol
  • Wingdings > Zapf Dingbats
3

This has happened to me many times in Microsoft Word when trying to export a simple manuscript to PDF. A 5–8 page Word document, ~50 KB in size, will end up as a 10+ MB PDF file, which is far too large to reasonably email to someone.

Rene's answer is on the right track—the problem is that fonts get embedded into the document—but just using one of the standard typefaces won't necessarily solve the problem.

All of my documents were in Times New Roman, using nothing fancier than bold and italics. Or so I thought. It turns out that I have automatic kerning enabled in my default template (for obvious reasons). When exporting to PDF, Word was actually embedding each of those ligatures as a separate font object into the document, bloating it beyond all belief.

The fix is simple, you just have to remember to do it each time:

  1. Select all of the text in the document.
  2. Format → Font → Advanced
  3. Uncheck "Kerning for fonts"

Interestingly, you can leave ligatures, contextual alternatives, and other advanced typography features enabled; they have no perceptible effect on the size of the resulting PDF.

Re-export the document as a PDF, and it's down to a hundred or so KB. Unfortunately, the kerning is sub-par, so I wouldn't recommend printing this way, but it works fine for emailing a document.

-3

To give a less technical answer that may help is that PDFs use vectors (i.e.: mathematical equations) to describe everything you see. All the curves and lines are defined by mathematical equations, and so there will necessarily be a lot of information to hold, particularly when you have images in your documents.

The benefit of this is that you can theoretically zoom in infinitely close without losing any resolution or detail, because the lines and curves have no width, so they can scale with your zoom.

Just like how Google's recent font change reduced the size of the logo from ~14KB to ~300B, simpler fonts will likely help reduce your file size.

  • 4
    That analogy doesn't work. At all. Google's logo change was not just the font, but also from gradients to flat which makes the size difference. Furthermore, exporting a document to a large bitmap will be much larger than a font + text. The mathematical equations, as you misleadingly put it, are just integer coordinate pairs, of which there are maybe a few dozen per glyph. And since it's a font it doesn't need to be repeated for every letter. – Joey Oct 2 '15 at 5:56

protected by Community Oct 6 '15 at 4:15

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.