17
$\begingroup$

I have recently (perhaps since Mathematica Version 10?) encountered a change in how PDF images are saved and how they behave after being loaded into Adobe Illustrator (v16.0.4 under Mac OS X 10.10.5).

In short: for 2D graphics, Illustrator can edit the graphics--all elements are accessible. For 3D graphics, some rasterization of the graphics is all that is in the exported PDF, and so individual elements cannot be edited in Illustrator.

Here are examples. First, simple 2D graphics:

g = Graphics[
  Line[{{0, 0}, {1, 1}, {0, 1}}]] 

Export from Mathematica to PDF. Open in Illustrator. (Or just copy the graphic from Mathematica and paste into Illustrator.) Then the elements can be edited. Here is a snapshot from Illustrator:


AI2D
Now, 3D graphics:

g = Graphics3D[
   Polygon[{{0, 0, 0}, {1, 1, 0}, {1, 1, 1/2}}]
   ,Boxed -> False];
Export["PDFTestExport.pdf", g, "PDF"]

This is what it looks like within Mathematica:


MmaFig3D
Opening the exported PDF in Illustrator reads in a rasterization, as this snapshot in Illustrator shows:
AI3DRaster
I tried following @Szabolcs suggestion in another thread to use Preview to resave the PDF, but this didn't change matters.

I certainly used to be able to even copy from 3D Mathematica graphics, and paste into Illustrator, with full ability to edit the elements in Illustrator. So something has changed as various software has progressed through newer versions (Mathematica, Illustrator, Mac OS X). I would love the regain that useful editing capability. If anyone has ideas, I would appreciate hearing them.

(Incidentally, exporting to EPS is not a solution: All such files crash my version of Illustrator upon opening.)

$\endgroup$
10
  • $\begingroup$ Even opening in Acrobat, you can see image is rasterized. I think your best bet will be to export at high res & get paths in either photoshop or Illustrator - probably best in this instance do image processing from those platforms - see here on GDSE. $\endgroup$
    – martin
    Aug 22, 2015 at 15:35
  • 2
    $\begingroup$ @martin: Good point, this has nothing to do with Illustrator. It is just that 3D PDF exports from Mathematica now export rasterized images, whereas at some point in the past editable elements were exported. Thanks for the link to GDSE. $\endgroup$ Aug 22, 2015 at 15:43
  • 3
    $\begingroup$ Sigh. I suspected as much. Unfortunately it seems that v.10 has introduced enforced rasterization of 3D graphics when exported to PDF. This has actually come up recently, and I had even participated in that discussion, but couldn't find it before: Export Plot3D in MMA 10.1 is rasterized by default in which a partial workaround was proposed. I wonder if you could test that as well. I'm still on the tablet... :-) $\endgroup$
    – MarcoB
    Aug 22, 2015 at 16:06
  • 1
    $\begingroup$ Hmm… should this behavior be regarded as a design change, a backslide, or a bug? @MarcoB $\endgroup$
    – xzczd
    Jul 20, 2020 at 8:30
  • 2
    $\begingroup$ @xzczd Personally I consider it a backslide, but I think it’s really a design change. Others have argued on this site in favor of the change, as it produces more manageable images rather than complex vector expressions. I would contend that the vector expressions were better no matter their size and complexity, particularly considering how difficult it is at times to get reasonable rasterization results from MMA (ticks, text are not scaled correctly, etc.). $\endgroup$
    – MarcoB
    Aug 3, 2020 at 2:55

1 Answer 1

19
$\begingroup$

I consider this question pretty much answered by @MarcoB, as follows:

  1. Mathematica 10 apparently forces rasterization by default when exporting 3D graphics to PDF, even when one adds the option "AllowRasterization" -> False to Export.

  2. The only way to disable it is to use the Inset workaround suggested by Jens:

    Export["PDFTestExport.pdf", Graphics[Inset[g, Automatic, Automatic, Scaled[1]]]];
    

    Here is how the output is rendered by Adobe Acrobat:

screenshot

  1. A workaround via Print Graphic (also suggested by @Jens) does export the vector elements for 3D graphics ...

  2. ... unless the 3D graphic is too complex (e.g., includes transparency). Then even Print Graphic rasterizes.

$\endgroup$
2
  • 3
    $\begingroup$ Joseph, thank you for summarizing your findings here. This will be a useful cross-reference. (+1) I'd love to see somebody else come up with an alternative workaround, since being able to export Graphics3D results as vectors would make my day job a lot easier. $\endgroup$
    – MarcoB
    Aug 22, 2015 at 17:47
  • 1
    $\begingroup$ i cannot make it work in version 13 $\endgroup$
    – elbOlita
    Nov 9, 2022 at 17:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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