Note: Fixed in version 10. See Verbeia's answer.

I've upgraded from Mathematica 8 to 9 (which apparently leaves the old version installed and usable which I didn't expect). I see a significant difference in the size of the PDFs produced by 'Save Graphic As', or Export[].

For example, with this very simple plot:

 Abs[Sinc[x]], {x, 0, 4 Pi}
 , AxesLabel -> {x, Abs[Sinc[x]]}
 , PlotRange -> Full
Export["foo8.pdf", %]

I see a pretty reasonable seeming size with Mathematica 8

-rwxrwxrwx  1 Peeter None    35493 Dec  7 12:18 foo8.pdf

But with Mathematica9 the files, even for this very simple plot are very much bigger:

-rwxrwxrwx 1 Peeter None 1550317 Dec  7 12:19 foo9.pdf

(44 times bigger).

Are there any Export[] options that allow the file size to be reduced? What accounts for the drastic increase in size when using the new Mathematica release (bug or feature)?

I can choose to export in other formats (like PNG), but when I embed a Mathematica generated png in a latex doc, it always looks fuzzy, so I liked the pdf save format (at least when the size was smaller).

  • 1
    The main reason why such bloat happens is that too many (unnecessary or standard) fonts are embedded in the PDF. I bet that's happening here too. One thing that always fixes this is to do this with your plot: Export["foo.pdf",First[ImportString[ExportString[%,"PDF"],"PDF"]]]; However, that's not a real solution. Alternatively, you'll most likely be able to fix the size by opening the PDF in another application and saving it back to PDF from there. – Jens Dec 7 '12 at 18:22
  • I get a file of 3.5 MB, even larger. After opening it with Acrobat and looking at the properties, it seems that Mathematica 9 embeds the Times font too, while Mathematica 8 does not (I vaguely remember someone complaining that these fonts should be embedded for some situations... even though Times is a standard that any PDF reader should be able to substitute even if it is not embedded) – Szabolcs Dec 7 '12 at 18:30
  • Here's a comment on this: Even there the reply was that the base 14 fonts do not need to be embedded. Perhaps this is a bug. Could you write support and ask them about it? 3.5 MB is certainly much larger than reasonable for such a plot. – Szabolcs Dec 7 '12 at 18:35
  • 2
    Usually, PDF writers should embed only a subset of a font definition if only a small number of characters in that font is required. – cormullion Dec 7 '12 at 19:31
  • I was experiencing the same issue with Mathematica 9 and apparently the issue is gone in version 9.0.1. I didn't change the default settings. Now the plot size is O(10) KB, while it was O(1) MB with version 9. – Pincopallino Feb 17 '14 at 10:21
up vote 15 down vote accepted

As others noted, the increase in file size is due to font embedding. There is a set of 14 standard fonts that every PDF reader should know about and should be able to handle. The usually do not need to embedded in PDFs.

It seems that previous versions of Mathematica did not embed these fonts by default, but version 9 does. There are two relevant Front End options controlling front embedding:

  • EmbedExternalFonts

  • EmbedStandardPostScriptFonts

You can find them in Format -> Option Inspector after selecting Global Preferences.

If you set the latter to False, standard fonts won't be embedded (the earlier behaviour). If you set the first to False, no font will be embedded.

Note that the PDF/A standard requires all fonts (including base 14 fonts) to be embedded (thanks @Verbeia for the comment).

Note: the problem affected me as well, so I contacted support about it. They mentioned the options, but I guessed about their precise meanings, so my guess might of course be wrong. They said the change in v9 was intentional as not embedding all fonts has caused problems in the past.

  • 3
    It's worth noting that the PDF/A standard requires even those standard fonts to be embedded. But it's possible they aren't being properly subsetted? – Verbeia Dec 14 '12 at 7:20
  • 4
    @Verbeia Mathematica doesn't (yet) support subsetting of fonts. I'm well aware of how useful this would be. – John Fultz Feb 3 '13 at 23:10
  • 2
    @Szabolcs For me, it doesn't seem to be doing so in 9.0.1, although I can reproduce the 9.0.0 behavior. My example, on Mac, export of Plot[Sin[x], {x, 0, 2Pi}, PlotLabel->Sin[x], BaseStyle -> {PrivateFontOptions -> {"OperatorSubstitution" -> False}}] was 3.5M in 9.0.0 and 6.3K in 9.0.1. I think this was just a bug, but I was unable to quickly find a bug report referencing this. – John Fultz Feb 3 '13 at 23:24
  • 1
    @JohnFultz Thanks for pointing this out, I'll update the answer later. Just to clear up the confusion and explain why I asked you about this: Support told me that "This change is intentional since there were a number of font issues occurring in PDFs in Mathematica 8." Also I did not notice that the behaviour changed in 9.0.1, as I did not reset my settings when installing 9.0.1. I thought turning off EmbedStandardPostScriptFonts may cause problems. – Szabolcs Feb 4 '13 at 0:00
  • 2
    I know this is not a solution within Mathematica, but for those not willing/able to upgrade to Mathematica 10 yet you can use the simple Linux tool ps2pdf, which accepts PDFs as inputs as well: ps2pdf -dEPSCrop figure.pdf figure-nofonts.pdf. This will remove unnecessary embedded fonts, greatly reducing filesize (the dEPSCrop saves the original bounding box). – Guillochon Jul 28 '14 at 18:27

This has been fixed in version 10.

Fonts are now correctly subsetted, even an OpenType font like Calluna, as shown here.

enter image description here

The graphic was produced with the following code, and the resulting file size is just 11kb.

test = Plot[{Sin[x], Cos[x]}, {x, 0, 5}, 
 BaseStyle -> {FontFamily -> "Calluna Sans", FontSize -> 16}]
Export["testcalluna.pdf", test]

The PDF export functionality was completely revamped in version 10, using the Cairo library.

enter image description here

  • I think the PDF exporter has been rewritten. Many PDF export bugs are fixed. – Szabolcs Jul 11 '14 at 22:57
  • @Szabolcs - I know for a fact it has. See my edit. This might have had something to do with user feedback. – Verbeia Jul 11 '14 at 22:59
  • 2
    This one, however, has not been fixed. Beware of saving graphics interactively. Use Export instead. – Szabolcs Jul 11 '14 at 23:02

When exported to EPS, your plot produces a much smaller file - about 85Kb. When converted to PDF (eg via or by running /usr/bin/pstopdf) it gets even smaller - 19Kb. Some kind of batch/automatic conversion set-up might be worth developing if the sizes become significant.

  • 1
    But you lose some things when exporting to EPS, for example transparency. – Szabolcs Dec 7 '12 at 20:55
  • @Szabolcs Tangentially related: what does it look like when re-importing the EPS in version 9? Are the fonts messed up? They are on version 8. Anyway, I couldn't figure out a way from the documentation how to suppress including the fonts in the PDF - and that's probably what the question really requires. – Jens Dec 7 '12 at 21:08
  • @Jens The result is exactly the same in 9 as in 8. – Szabolcs Dec 7 '12 at 23:07

Select the figure, and use your AdobePDF to print it. The quality remains while the size is significantly reduced.

  • That's not a task that could easily be automated. – Peeter Joot Sep 10 '13 at 19:05

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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