The problem is the file size. Most of the 3D graphics on Mathematica 6
are exported to PDF files as large as several megabytes
(even several tens MB sometimes).
For example, this simple 3D graphics
ContourPlot3D[
Exp[-(x^2 + y^2 + z^2)/2], {x, 0, 2}, {y, 0, 2}, {z, 0, 2},
Mesh -> None]
generates a PDF as large as 3.7 MB!!
With Mathematica 5, the file size was reasonable.
Is there something I'm missing with Mathematica 6?
Thanks in advance for any help.
mahn-soo
Export["your countour plot 3D.pdf"] gives indeed awful results: huge
files with a mesh of white lines (it is a know unsolved issue...)
You may try to use, after selecting your graphics, "Print Selection"
from the "File" menu, and then save the selected graphics to a PDF
file (this step depends on your system: on Mac OS you habe a PDF
button). The problem is that you lose the bounding box.
Alberto Verga.
On my system (Mac OS X Leopard 1.5.4) I would select the plot, then use
menu "Print Selection" and choose "PDF". The Mac built-in PDF rendering
engine produces a file of only 628 KB (rather than the 3.6 MB file
produce by Mathematica), file that is rendered virtually instantaneously
within Preview (built-in PDF viewer) rather than showing a animation of
the polygons being drawn.
Having say that, if you need an even smaller size, setting a lower value
for the option *MaxRecursion* might dramatically decrease the size of
the PDF file generated by Mathematica. For instance,
ContourPlot3D[
Exp[-(x^2 + y^2 + z^2)/2], {x, 0, 2}, {y, 0, 2}, {z, 0, 2},
Mesh -> None, MaxRecursion -> 0]
yields a 68 KB PDF file when the plot is exported by Mathematica.
Regards,
-- Jean-Marc
See the discussion at
http://groups.google.com/group/comp.soft-sys.math.mathematica/browse_frm/th=
read/1656afeb09496586/4a9711e06f69abc0?lnk=gst&q=large+PDF#4a9711e06f69=
abc0
It covers this in much detail...
-Bob
Unfortunately, this results in a larger file size because of a
limitation of Mathematica 6 where it does not compress exported
bitmaps. This limitation has been removed for a future release.
-Rob
Wolfram Research
Thibaut Jonckheere
Mahn-Soo Choi a =E9crit :
Note that PDFCreator is a Windows program. Is there something similar
that also works with Mac OS X?
-Bob
> On Aug 3, 3:34 am, tuab...@gmail.com wrote:
>> One possible workaround is to use PDFcreator (just google for this
>> name to get the program, which is free). Once installed, it is a
>> virtual printer to which you can send files and get a pdf. With your
>> example, I get a 3.7 Mb pdf file using the export command from
>> Mathematica, and a 164 Kb pdf file with pdfcreator (and it looks good
>> once opened).
<snip>
> Note that PDFCreator is a Windows program. Is there something similar
> that also works with Mac OS X?
Mac OS X can *natively* save files and documents as PDF files from any
applications that have print capability, because Mac OS X comes with a
built-in PDF writer and reader engine.
In the lower-left of every Print dialog you can see a "PDF" button that
allows to save your document to a PDF file.
Even more, in the same print dialog, you also have a "Preview" button
that will render your document the Mac OS X built-in program *Preview*,
form there you can save your work as a PDF or to a variety of image
formats.
(Note that Preview is also accessible as a stand alone program and can
merge different files or reorganize the layout of the document, and much
more...)
Regards,
-- Jean-Marc
I have found one partial solution. I say partial as it shrinks the PDF
to about 2/3 the size, which is still much larger than people achieve
with Adobe's software.
1) Export as an EPS file - this makes a massive 18 GB file for the
above example
2) Use the tool ps2pdf which uses Ghostscript.
I would add, this was done on Mathematica 6.0.2 on a machine running
Solaris x86, on an Intel CPU. This involved the modifications (posted
on here some time back) to run on an Intel CPU. However, I very much
doubt this would change the result. But running ps2pdf on Windows
Linux or Mac might well give differerate results.
Is there any way to post-rocess the pdf to compress the bitmap?
> I would add, this was done on Mathematica 6.0.2 on a machine running
> Solaris x86, on an Intel CPU. This involved the modifications (posted
> on here some time back) to run on an Intel CPU. However, I very much
> doubt this would change the result. But running ps2pdf on Windows
> Linux or Mac might well give differerate results.
Sorry, before anyone waste's there time looking for it, the method to
run Mathematica 6 on Solaris with an Intel CPU was posted on another
newsgroup.
In the resulting dialog, you can change the Quartz Filter from 'None'
to 'Reduce file size'.
In the example I just tested, the file size went from 2.8 MBytes to
148 kb.
I don't use Acrobat anymore, but I'm pretty sure that the same thing
can be done there.
george
> > File > Print Selection > Save As PDF causes the graphic to be
> > rasterized. This is why it displays so much quicker in the viewer
> > application. You can get the same behavior from File > Save Selection
> > As > PDF by clicking on the Options button in the Save As dialog and
> > setting Graphics Containing Smooth Shading > Use Bitmap
> > Representation.
> >
> > Unfortunately, this results in a larger file size because of a
> > limitation of Mathematica 6 where it does not compress exported
> > bitmaps. This limitation has been removed for a future release.
> >
> > -Rob
> > Wolfram Research
As best I can tell these statements are not correct, or at least do not
apply directly, for Mathematica 6 on Macs. Is this statement limited to other
non-Mac platforms?
And some related questions:
1) Following the most straightforward Print Selection to PDF procedures
on a Mac seems to produce a vector graphics file in which all the text
has been converted into outline form, which means it can no longer be
readily edited in Illustrator.
Is there a way to prevent this behavior, and keep all the text as
characters in embedded fonts, so that one can edit the text, make font
changes, change font sizes, and the like?
2) Following the alternative chain of steps involved in Save Selection
to PDF (again, on a Mac) leads one to a menu of options that includes
choosing between "Highest Quality Vector Representation" and "Most
Compatible Vector Representation". What do these terms mean?
[Or is this a Mac OS X question rather than an Matheamtica question? It's not
clear to me whether the dialog box that presents these options is a Mac
OS dialog box or an Mathematica 6 dialog box . . . ]
3) More broadly, if one's overall objective is to routinely transfer
Mathematica 6-generated graphics from Mathematica 6 notebooks into vector graphics PDF files
on a Mac HD, such that the resulting PDF files will be:
* Of primary concern, "most fully and readily editable" in
some other graphic application such as Illustrator, and
* Of secondary importance, not excessively large in file size,
what is the _best_ way to do this in Mathematica 6, on a Mac?
Yes. I send it to you as email (so you can get a faster answer) and to
MathGroup (aka comp.soft-sys.math.mathematica) via the mailing list
math...@smc.vnet.net. The message should be visible on the newsgroup
by tomorrow.
Regards,
- Jean-Marc
> AES wrote:
>
> <snip>
>
> 2) Following the alternative chain of steps involved in Save Selection to
> PDF (again, on a Mac) leads one to a menu of options that includes choosing
> between "Highest Quality Vector Representation" and "Most Compatible Vector
> Representation". What do these terms mean?
>
> <snip>
>
> The quote below is from ragfield's answer to one of these many similar
> questions asked in this forum:
>
> [...]
>
> * Use Highest Quality Vector Representation. This should match what
> you see in Mathematica nearly exactly, but it will not be compatible
> with all viewer applications. For PS/EPS this uses PS level 3
> features. For PDF it uses features that are not supported by Apple's
> PDF engine prior to Mac OS X 10.5.
>
> * Use Most Compatible Vector Representation. This will not exactly
> match what you see on screen in Mathematica, but it will produce a
> small file that works in all viewers."
>
> (ragfield, "Re: version 6 Plot3D exporting results in HUGE files",
> MathGroup, Sun, 26 Aug 2007,
> http://forums.wolfram.com/mathgroup/archive/2007/Aug/msg00981.html)
>
> Regards,
> -- Jean-Marc
>
--
Jean-Marc
<snip>
> 2) Following the alternative chain of steps involved in Save Selection
> to PDF (again, on a Mac) leads one to a menu of options that includes
> choosing between "Highest Quality Vector Representation" and "Most
> Compatible Vector Representation". What do these terms mean?
<snip>
These statements compare the behavior of PDF export when using the Mac
OS X PDF printing support (from File > Print [Selection] > Save As
PDF, which is only available on Mac) to Mathematica's built in PDF
export (from File > Save [Selection] As > PDF or Export[_, _, "PDF"],
which is available on all platforms).
> And some related questions:
>
> 1) Following the most straightforward Print Selection to PDF procedure=
s
> on a Mac seems to produce a vector graphics file
Mathematica will create a vector graphics file wherever possible. The
only time the graphics will be rasterized is when they contain smooth
shading (VertexColors/VertexNormals) AND the "Graphics Containing
Smooth Shading" option I mentioned earlier is set to "Use Bitmap
Representation."
> in which all the text
> has been converted into outline form, which means it can no longer be
> readily edited in Illustrator.
Mathematica does this for spanning characters which cannot be
represented as standard glyphs from any font. Mathematica does not do
this for any other text. Are you perhaps testing this theory using
Mathematica's PDF Import[] (because PDF import currently *does*
convert text to outlines) or some other application?
> Is there a way to prevent this behavior, and keep all the text as
> characters in embedded fonts, so that one can edit the text, make font
> changes, change font sizes, and the like?
This should just work. If it doesn't it would be a bug and should be
reported to Wolfram Research with a specific reproducible example.
> 2) Following the alternative chain of steps involved in Save Selection
> to PDF (again, on a Mac) leads one to a menu of options that includes
> choosing between "Highest Quality Vector Representation" and "Most
> Compatible Vector Representation". What do these terms mean?
>
> [Or is this a Mac OS X question rather than an Matheamtica question? I=
t's not
> clear to me whether the dialog box that presents these options is a Mac
> OS dialog box or an Mathematica 6 dialog box . . . ]
These settings apply to all platforms. See this earlier message and
read below:
http://groups.google.com/group/comp.soft-sys.math.mathematica/browse_thread=
/thread/a669fd00915cbbf5/6b0387ea4f8732d4?#6b0387ea4f8732d4
> 3) More broadly, if one's overall objective is to routinely transfer
> Mathematica 6-generated graphics from Mathematica 6 notebooks into vector=
graphics PDF files
> on a Mac HD, such that the resulting PDF files will be:
>
> * Of primary concern, "most fully and readily editable" in
> some other graphic application such as Illustrator, and
>
> * Of secondary importance, not excessively large in file size,
>
> what is the _best_ way to do this in Mathematica 6, on a Mac?
The problem is, there is not a *best* way to do this. Arbitrary
Mathematica 6 graphics can contain features which are not supported by
the PDF vector graphics format. There is not one setting that will
give you exactly what you want in all cases. You have to decide which
criteria are the most important to you for a given graphic. If the
graphic contains smooth shading (as graphics created by most 3D and
some 2D visualization functions do), use one of the following
settings. Each has advantages and disadvantages.
* Use Bitmap Representation. The graphic to look *exactly* identical
to how it looks on screen in Mathematica. It will open quickly in
viewer applications. The file size may be large (particularly in
6.0.x). Printing may take a long time due to large size. Use the
bitmap resolution option to fine tune the file size vs. image quality
issue. If the PDF is only ever intended to be viewed, you can use
screen resolution for the bitmap (72 or "Screen"). If it is intended
for print you might want something higher like 300 or 600.
* Use Highest Quality Vector Representation. The graphic will look
very close to how it looks on screen in Mathematica. It will be
editable by applications such as Illustrator. The file size may be
slightly large. The graphic will likely take a long time to load in a
viewer application. Not all viewer applications support these
features (notably Preview.app prior to Mac OS X 10.5) so they may
appear blank.
* Use Most Compatible Vector Representation. The graphic will look
approximately (but not exactly) how it looks on screen in
Mathematica. The file size will be relatively small. It will be
editable by applications such as Illustrator.
The other alternative is to change your graphics using various options
to the plotting functions. There are certain combinations of options
that will produce graphics that, when exported to PDF, are editable
and look the same as in Mathematica. Unfortunately, this typically
means losing lots of neat version 6 plotting features. Here's an
example:
Plot3D[Sin[x y], {x, 0, 3}, {y, 0, 3}, MaxRecursion -> 0,
PlotPoints -> 20, Mesh -> Full, NormalsFunction -> None]
-Rob
Wolfram Research
<snip>
> Plot3D[Sin[x y], {x, 0, 3}, {y, 0, 3}, MaxRecursion -> 0,
> PlotPoints -> 20, Mesh -> Full, NormalsFunction -> None]
>
This gives a "version 5-like" plot but the "white lines" of spurious
polygons, remain visible when exported as pdf.
One solution to this problem can be found in
http://library.wolfram.com/infocenter/MathSource/7029/
by Will Robertson. Saving as "print selection PDF", or using bitmap,
also remove these lines.
Is Wolfram Research planing to solve this issue in a future upgrade?
Thank you,
A. Verga.
Aix-Marseille Universite