MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

General PDF/EMF export problems and solutons

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119249] General PDF/EMF export problems and solutons
  • From: Alexey Popkov <lehin.p at gmail.com>
  • Date: Thu, 26 May 2011 06:36:47 -0400 (EDT)

Good day,

I wish to share a couple of Export-related observations that I feel
could potentially be very useful for others. Anyway I would have saved
a lot of time if I knew it all before...

1) It is completely unexpected and undocumented, but Mathematica
exports and saves graphics in PDF and EPS formats using a set of style
definitions that differs from the one used for displaying Notebooks on
screen. By default Notebooks are displayed on screen in the "Working"
style environment (which is default value for the
ScreenStyleEvironment global $FrontEnd option) but are printed in the
"Printout" style environment (which is default value for the
PrintingStyleEnvironment global $FrontEnd option). When one exports
graphics in raster formats such as GIF and PNG or in EMF format
Mathematica generates graphics that looks exactly like it looks inside
Notebook. It seems that the "Working" style environment is used for
rendering in this case. But it is not the case when you export/save
anything in PDF or EPS formats! In this case the "Printout" style
environment is used by default:

http://groups.google.com/group/comp.soft-sys.math.mathematica/msg/7f5cb9e2d4677855

The "Printout" environment differs very deeply from the "Working"
style environment. First of all, it sets Magnification to 80%.
Secondly, it uses its own values for the font sizes of different
styles and it results in inconsistent font size changes in the
generated PDF file as compared with the original on-screen
representation.

But happily all these problems can be avoided by setting the
PrintingStyleEnvironment global $FrontEnd option to "Working":

SetOptions[$FrontEnd, PrintingStyleEnvironment -> "Working"]

2) The common problem with exporting to EMF format is that most of
programs (not only Mathematica) generate a file that looks nice at the
default size but becomes ugly when you zoom it in. It is because
metafiles are sampled at screen resolution fidelity:

http://groups.google.com/group/comp.soft-sys.math.mathematica/msg/443befb422e4e25a

The quality of the generated EMF file can easily be enhanced by
Magnifying the original graphical object so that exactness of sampling
of the original graphics becomes much more precise. Compare two files:

graphics1 = Style["a", FontFamily -> "Times"];
graphics2 = Magnify[graphics1, 10];
Export["C:\\test1.emf",
 First@ImportString[ExportString[graphics1, "PDF"], "PDF"]]
Export["C:\\test2.emf",
 First@ImportString[ExportString[graphics2, "PDF"], "PDF"]]

If you insert these files into Microsoft Word and zoom in you will see
that the first "a" has sawtooth on it while the second has not.


  • Prev by Date: Re: Multiple Subregions Background In a Grid
  • Next by Date: Re: General PDF/EMF export problems and solutons
  • Previous by thread: Re: Unicode path names not supported on Windows?
  • Next by thread: Re: General PDF/EMF export problems and solutons