Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #2736 > unrolled thread
| Started by | Alexey Popkov <lehin.p@gmail.com> |
|---|---|
| First post | 2011-05-26 10:36 +0000 |
| Last post | 2011-05-26 11:47 +0000 |
| Articles | 2 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
General PDF/EMF export problems and solutons Alexey Popkov <lehin.p@gmail.com> - 2011-05-26 10:36 +0000
Re: General PDF/EMF export problems and solutons Alexey Popkov <lehin.p@gmail.com> - 2011-05-26 11:47 +0000
| From | Alexey Popkov <lehin.p@gmail.com> |
|---|---|
| Date | 2011-05-26 10:36 +0000 |
| Subject | General PDF/EMF export problems and solutons |
| Message-ID | <irlafs$dv4$1@smc.vnet.net> |
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.
[toc] | [next] | [standalone]
| From | Alexey Popkov <lehin.p@gmail.com> |
|---|---|
| Date | 2011-05-26 11:47 +0000 |
| Message-ID | <irlele$eo6$1@smc.vnet.net> |
| In reply to | #2736 |
One correction for the original post.
Here is much more clear and correct example for the EMF export
section:
graphics1 =
First@ImportString[
ExportString[Style["a", FontFamily -> "Times"], "PDF"], "PDF"];
graphics2 = Magnify[graphics1, 10];
Export["C:\\test1.emf", graphics1]
Export["C:\\test2.emf", graphics2]
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.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web