Browse > Home / Computer, Data Visualization, How To / Blog article: Embedding a 3D figure into a PDF

Embedding a 3D figure into a PDF

November 9th, 2009 Posted in Computer, Data Visualization, How To

Why use a PDF for 3D?

Some data really needs to be seen in 3D, but how do you eas­ily dis­trib­ute a 3D dia­gram? VRML, the erst­while 3D web stan­dard, seems to have all but dis­ap­peared leav­ing no widely-adopted replace­ment (O3D not with­stand­ing).

It turns out that Adobe Acro­bat reader con­tains a 3D engine! And since it’s in the ordi­nary Acro­bat Reader, it’s pretty much ubiq­ui­tously installed. Here are a cou­ple of exam­ples, with links to two of the 3D pdfs I made for the paper; there are more in the sup­port­ing infor­ma­tion (view with Acro­bat for the 3D to work):

2-D projections (left) and corresponding 1interactive 3-D reconstructions (right) of unconstrained beads (15-µm spacers) showing bilobed and trilobed structure.

In silico network trajectory relative to bead during smooth motion.

How to make a 3D PDF

There are essen­tially just two steps to mak­ing a 3D pdf:

  1. con­vert­ing your model into the U3D for­mat that acro­bat uses, and
  2. embed­ding that U3D file into a pdf.

Converting VRML to U3D

VTK will pro­duce VRML directly with the vtkVRM­L­Ex­porter class (take a look at the comet_vtk.cpp file to see how we used it).  Call­ing comet with a sin­gle frame (e.g. ‘comet vtk 200:200’) will write out a .vrml file (see the cometwiki for more details).

To con­vert the VRML files that VTK pro­duces to the U3D for­mat needed for the pdf you need to buy Acro­bat 3D or Deep Explo­ration (the con­verter in Acro­bat 3D is just a re-branded copy of Deep Explo­ration any­way). The aca­d­e­mic price for Acro­bat 3D was only $70, and my fel­low­ship payed for it, but the non-academic price for Acro­bat 3D (now called Acro­bat Pro Extended) is a rather steep $699.

Embedding the U3D into the PDF

Once you have the 3D mod­els con­verted into U3D for­mat, you can just copy and paste them into a pdf using Acro­bat itself.  This might work if you only have one model, but I actu­ally found using Acro­bat to place the mod­els to be sur­pris­ingly dif­fi­cult.  Past­ing the model into the pdf result in a model big­ger than the page itself, and I couldn’t fig­ure out how to resize other than drag­ging the cor­ner, which doesn’t pre­serve the aspect ratio.  It was all very hap­haz­ard, and hav­ing all the sub­fig­ures sized and aligned cor­rectly was nearly impos­si­ble.

In the end, I used the LaTeX movie15 pack­age, which I would rec­om­mend over Acro­bat 3D if you’re at all famil­iar with LaTeX.  Not only does it allow you to eas­ily size and place all the sub­fig­ures cor­rectly, but makes it very easy to have a con­sis­tent lay­out between fig­ures.

One Response to “Embedding a 3D figure into a PDF

  1. Maybe you’ve seen this already, but Mesh­lab ( http://meshlab.sourceforge.net/ ) does a pretty good job of con­vert­ing most stan­dard for­mats into U3D, and it is open source. I’ve been using vtk+meshlab+movie15 for a few years for shar­ing x-ray uCT scans, and have had great suc­cess with this.

Leave a Reply

*
To prove you're a person (not a spam script), type the security text shown in the picture. Click here to regenerate some new text.
Click to hear an audio file of the anti-spam word