Difference between revisions of "File formats/3D PDF"

From Jmol
Jump to navigation Jump to search
(bibliography (Pymol))
 
(47 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
= PDF documents with integrated 3D interactive models =
 
= PDF documents with integrated 3D interactive models =
 +
== Easy procedure ==
 +
This is currently the easiest way to create a PDF document containing an interactive 3D molecular model, using only '''free software''' (at least free in Windows; solutions for the Mac need more investigation to confirm).
  
== Installations ==
+
=== Downloads ===
=== Jmol ===
+
* ''Windows'' ''and MacOS'': download the '''graphic user interface version of IDTFConverter''' from [https://jmol.sourceforge.net/download/ the Jmol website]:
You need at least version 12.0.RC26 to do this.
+
** ''Windows'': download the {{file|IDTF_U3D_Converter.zip}}, unpack the zip file and put the single {{file|IDTF_U3D_Converter.exe}} file wherever you want in your local disk. If you find it convenient, create a shortcut for it in the desktop or the Start menu.
 +
** ''MacOS'': choose and download the app suitable for your system:
 +
*** {{file|IDTF_U3D_Converter_Intel.zip}} if your computer is based on an [https://en.wikipedia.org/wiki/MacBook_Pro_(Intel-based) Intel processor]. Unpack the zip file to obtain the executable file, {{file|IDTF_U3D_Converter.app}}
 +
*** {{file|IDTF_U3D_Converter_Silicon.zip}} if your computer is based on a [https://en.wikipedia.org/wiki/Apple_silicon Silicon processor] (usually ARM). Unpack the zip file to obtain the executable file, {{file|IDTF_U3D_Converter.app}}
  
=== IDTF to U3D ===
+
=== Create the IDTF file ===
(See also descriptions and comments for Jmol output to [[File_formats/3D_Objects#IDTF|IDTF]] and [[File_formats/3D_Objects#U3D|U3D]] formats.)
 
  
Conversion from IDTF to U3D can be done using a simple command-line utility, IDTFConverter.
+
# Get a current version of '''Jmol''' application. Open your molecule; display it in the desired orientation and style.
 +
#* ''Suggestion: make the Jmol window square'', using <code>top menu > Display > Resize</code> and entering two equal numbers. The result will look better if you insert it later into a square box within the pdf.
 +
#* ''Note:'' you can also do it with JSmol embedded in some webpage. Generation of the idtf file may take longer, though, if the model is complex.
 +
# If the export to IDTF option has been implemented in the menu:
 +
#* Top menu bar > <code>File > Export > Export to IDTF</code>
 +
#* Pop-up context menu > <code>File > Export > Export IDTF 3D model</code>
 +
# Otherwise, open the console and enter <code>write myMol.idtf</code>
 +
# Two files will be created: {{file|myMol.idtf}} and {{file|myMol.idtf.tex}}. For the current method, you may discard the <code>.tex</code> file.
  
* ''Windows'' installation of IDTFConverter
+
=== Create the U3D file ===
# The converter is available from Universal 3D Sample Software and from Michail Vidiassov's site (see refs. below). Download and unzip into, perhaps, {{file|c:\idtf\}}
 
# Create a simple command file {{file|u3d.bat}} and place it in a folder where it is easily accessible (e.g. the Windows directory or a folder included in the system's path). This {{file|u3d.bat}} file must contain this text:
 
:: <code>c:\idtf\idtfconverter.exe -input %1.idtf -output %1.u3d</code>
 
  
* ''MacOS and Linux'' installation of IDTFConverter
+
* Open the '''IDTF_U3D_Converter''' program or app, browse to load your {{file|.idtf}} file, choose the output folder and click on "Convert". The output will have the same filename as the input, with extension {{file|.u3d}}
# You can get a port of IDTFConverter from Michail Vidiassov's site (see refs. below).
+
[[File:IDTF_U3D_Converter.png|thumb|center|x200px]]
# Create a command file similarly to the one described for Windows.
 
  
==== References ====
+
=== Prepare your PDF document ===
* ''Windows:'' [http://sourceforge.net/projects/u3d/ Universal 3D Sample Software]. Go to 'View All Files' and download the latest {{file|U3D_A_??.zip}} file. Within it, see {{file|Docs/IntermediateFormat/IDTF Format Description.pdf}}) and {{file|Bin/Win32/Release/IDTFConverter.exe}}.
 
* ''Windows:'' Alternatively, get just the necessary files from http://www.iaas.msu.ru/tmp/u3d/u3dIntelWin.zip (thanks to Michail Vidiassov).
 
* ''MacOS and Linux:'' A port of the software is available from http://www.iaas.msu.ru/tmp/u3d/u3d-1.2.852.tar.gz (thanks to Michail Vidiassov).
 
  
=== LaTeX to PDF ===
+
# Use your preferred program (word processor, presentation, ...) to create a document with text and images, leaving square space(s) where you will later insert the 3D molecular models, and export to pdf format.
There are several '''pdfLatex''' software, like '''[http://www.tug.org/tetex/ teTeX]''' (Unix; discontinued in 2006), '''[http://miktex.org/ MiKTeX]''' (Windows), '''[http://www.tug.org/texlive/ TeX Live]''' (Unix, Linux, Windows), '''[http://www.tug.org/mactex/2009/ MacTeX]'''...
+
#* If your application cannot export to PDF directly, you may use a virtual PDF printer like [https://www.pdfforge.org/ PDFforge PDF Creator] or [https://www.pdf-xchange.com/product/pdf-xchange-lite PDF-XChange Lite Printer] (both available for free).
 +
# To insert the 3D models you need a pdf editor that is compatible with the 3D-PDF standard. Examples: Adobe Acrobat Pro and  [https://www.pdf-xchange.com/product/pdf-xchange-editor PDF-XChange Editor] (Windows-only, free or paid version)
 +
# In PDF-XChange Editor: open the previous PDF, find the place where your left blank space. To insert a ''3D annotation'' there:
 +
#* If you are using the Ribbon interface: <code>Comment > Add 3D</code>
 +
#* If you are using the classical Toolbar interface: <code>Tools > Media tools > Add or edit 3D annotations</code>
 +
#* Draw the rectangle area with the mouse. ''Suggestion:'' draw a square by holding the Shift key while dragging to define the area.
 +
#* In <code>3D Artwork</code>, select your {{file|myMol.u3d}} file.
 +
#* Choose among any other display options offered (like activation of the content, border and background color)
 +
#* Accept and save the file.
 +
# In Adobe Acrobat Pro: open the previous PDF, find the place where your left a blank space. To insert ''3D media'' there:
 +
#* From the upper left of the screen, select <code>All tools > Add rich media > 3D media</code>.
 +
#* Drag a rectangle (better, a square) to define the area for the 3D model. An Insert 3D dialog box appears.
 +
#* In the <code>Insert 3D</code> dialog box, browse to select your {{file|myMol.u3d}} file. Check <code>Show Advanced Options</code> to set the initial properties.
 +
#* [https://helpx.adobe.com/acrobat/using/adding-3d-models-pdfs-acrobat.html Adobe help] for this procedure.
  
* Installation of MiKTeX (Windows)
+
=== Viewing the result ===
# Download and install '''MiKTeX "basic"''' from http://miktex.org/
+
* Check the 3D display in a PDF viewer application. Note that not all viewers support this kind of 3D content.  
# Do an update (menu <code>Programs > MiKTeX > Maintenance > Update</code>).
+
** The pdf viewers implemented internally in web browsers '''do not''' currently support 3D objects and will just display a static image.
# Download the '''movie15''' package (menu <code>Programs > MikTex > Maintenance > Package Manager</code>).
+
** Adobe Acrobat Pro and the free Adobe Reader support 3D objects.
 
+
** PDF-XChange Editor supports 3D objects.  
* You can avoid installing software and use instead an '''online service''' like '''[http://www.scribtex.com/ ScribTeX]''' (they have a Free Plan that gives you 50 MB storage space; you can even test-run it without signing up).
+
** Recent versions of [https://www.foxit.com/pdf-reader/ Foxit PDF Reader] support 3D objects. Display of 3D objects may be disabled by default. You may enable it either by '''trusting''' the document or by setting: ''File > Preferences > 3D > Enable the playing of 3D content''.
 
+
* In Android devices you may use '3D PDF Viewer' or possibly other apps (search the Google Play store).
== Creating the document ==
+
* In iOS devices you may use '3D PDF Viewer' (search the App Store) or possibly other apps. This may also be run in a Mac computer.
1. Within Jmol script console: <code>write c:/temp/xxx.idtf</code>
 
: or from the application's pop-up menu: <code>File > Export IDTF 3D model</code> (a dialog prompts for destination folder and filename).
 
: Either of those will create two files: {{file|xxx.idtf}} and {{file|xxx.idtf.tex}}
 
 
 
2. At the system command line or terminal, call the {{file|u3d.bat}} file (Windows), or equivalent MacOS or Linux command file, to convert the {{file|.idtf}} to {{file|.u3d}} format:
 
: <code>u3d c:\temp\xxx</code>
 
 
 
''If using MikTeX:''
 
 
 
:3.1. Run the '''TeXworks''' program --included in MiKTeX-- and open in it your {{file|xxx.idtf.tex}}.
 
 
 
:3.2. Click menu item <code>Typeset > Typeset</code>, or click on the green 'play'-like button (leftmost in the toolbar).
 
: When processing ends, you will see a blank document in a new TeXworks window, because MiKTeX can't display the model, but {{file|xxx.idtf.pdf}} should have been created.
 
 
 
''If using ScribTeX:''
 
 
 
:3.1. Go the [http://www.scribtex.com/ ScribTeX website], sign up or use the guest account.
 
 
 
:3.2. Click on [<code>Upload file</code>] and select in turn your {{file|xxx.idtf.tex}} and {{file|xxx.u3d}} files (or a {{file|.zip}} file containing both, it will be automatically unzipped in the server).
 
 
 
:3.3. In the file listing on the server, click on the {{file|xxx.idtf.tex}} file to display it, then click on [<code>Compile</code>].
 
 
 
:3.4. When the {{file|.pdf}} file opens in the browser, click on the [<code>Save copy as</code>] button in your viewer's toolbar, to store it in your local disk.
 
 
 
4. Open the {{file|.pdf}} file using a reader/viewer that supports 3D PDF (see a list below).
 
: If you don't see the model in its panel inside the document, right-click on it and choose <code>Partial options > Fit visible</code>
 
 
 
=== Caveats ===
 
* If you move in Jmol the model rotation center away from screen center (as with CTRL-ALT-drag), the model in the 3D PDF will be a very close but not quite perfect reproduction. (The reason for this is that moving the center of perspective seems to be not supported in virtual reality formats like VRML and U3D.)  
 
* Lighting is not working properly: the light moves with the model. If someone knows how to do that, please let us know.
 
* Perspective canot be orthographic from the beginning (Jmol uses this by default for crystal structures). Once in the 3D PDF, there is a right-mouse-button option to go into that mode. Please let us know if you know how to do that.
 
* Don't expect rotation and translation using the mouse in the 3D PDF to be like in Jmol. It is harder to control, and you can even completely loose the rotation center.
 
* For large models (big proteins, surfaces, electron density maps), files are quite big, and seeing and manipulating the model in the PDF will need substantial computer power. To alleviate this, you can try to set the image frequency to a lower value in the Reader's 3D options and/or to change the optimisation method for small frequency to 'Abandon'. Also, if you are using it in a presentation, it is a good idea to preload the PDF document in the Reader ahead of time.
 
 
 
== Documents with text ==
 
In order to have text, images etc. alongside the 3D model, ideally you need a full PDF editor, which is normally commercial like Adobe Acrobat Pro.
 
 
 
As an alternative, some of the freeware PDF viewers, like [http://www.tracker-software.com/product/pdf-xchange-viewer PDF-XChange Viewer], allow you to add text and images onto the generated 3D PDF and save the modified document.
 
  
 
== Sample documents ==
 
== Sample documents ==
(Text in these documents has been added externally to the process descrbed here.)
+
These have been created following the above procedure
 
+
* [[:File:Cys_3D.pdf|Cysteine]]
* 3D PDF with an [http://biomodel.uah.es/Jmol/3d-pdf/dan002.pdf organic molecule], ball and stick.
+
* [[:File:Ala_3D.pdf|Alanine]]
: Model {{file|.hin}} 5 kB; {{file|.idtf}} 121 kB; {{file|.u3d}} 47 kB; {{file|.pdf}} 18 kB.
+
* [[:File:Factor_Xa.pdf|Coagulation Factor Xa]]
* 3D PDF with a small protein, [http://chemapps.stolaf.edu/jmol/docs/examples-11/pdf/test1.idtf.pdf crambin] (1crn.pdb), in cartoon rendering.
+
Note the model will not display as 3D and interactive if you view it inside the web browser; you need to download the file and open it in a compatible PDF viewer.
* 3D PDF with a polyhedra rendering of [http://chemapps.stolaf.edu/jmol/docs/examples-11/pdf/quartzPolyhedra.idtf.pdf quartz].
 
* 3D PDF with a carbon [http://biomodel.uah.es/Jmol/3d-pdf/nanotube.pdf nanotube], ball and stick and molecular surface.
 
: Model {{file|.hin}} 16 kB; {{file|.idtf}} 1800 kB; {{file|.u3d}} 182 kB; {{file|.pdf}} 113 kB.
 
 
 
= Software for creating or viewing 3D PDF =
 
(This aims to be a compilation of resources; if you know of another software, please add it here).
 
 
 
== 3D PDF Viewers ==
 
* Adobe Reader v.7 or later (proprietary, freeware).
 
 
 
== 3D PDF Editors ==
 
* Adobe Acrobat Pro (proprietary, commercial), with the approproate complement (maybe Acrobat 3D).
 
: Note that you do not ''create'' the 3D model using Adobe; you just ''insert'' or ''embed'' it from an available {{file|.u3d}} file that you have prepared with another software (like Jmol + IDTFConverter). The Adobe editor will mainly serve to position the 3D model within the page and to insert the other content of the document.
 
 
 
 
 
= Bibliography =
 
Related articles:
 
  
1. '''Grasping molecular structures through publication-integrated 3D models'''.
+
= Older reference =
: (2008) P. Kumar, A. Ziegler, J. Ziegler, B. Uchanska-Ziegler & A. Ziegler. ''Trends in Biochemical Sciences'' '''33''':408-412.
+
This old content may or not be currently useful, but it is kept for the record at [[File_formats/3D_PDF/Legacy]]
: [http://dx.doi.org/10.1016/j.tibs.2008.06.004 doi:j.tibs.2008.06.004]
 
2. '''A step-by-step guide to creating PDF-integrated 3D models'''.
 
: (Published online as Supplementary Material to #1)
 
: Part 1: PyMOL ~ Part 2: Adobe 3D Reviewer ~ Part 3: PDF Export (Acrobat 9 Pro Extended)
 
: http://www.charite.de/immungenetik/model3d.html
 
: Pymol exports to VRML2; Adobe 3D Reviewer imports that and exports to U3D; Acrobat 9 Pro Extended is used to insert and finish off the 3D model in the PDF.
 

Latest revision as of 12:30, 26 March 2026

PDF documents with integrated 3D interactive models

Easy procedure

This is currently the easiest way to create a PDF document containing an interactive 3D molecular model, using only free software (at least free in Windows; solutions for the Mac need more investigation to confirm).

Downloads

  • Windows and MacOS: download the graphic user interface version of IDTFConverter from the Jmol website:
    • Windows: download the File icon.gifIDTF_U3D_Converter.zip, unpack the zip file and put the single File icon.gifIDTF_U3D_Converter.exe file wherever you want in your local disk. If you find it convenient, create a shortcut for it in the desktop or the Start menu.
    • MacOS: choose and download the app suitable for your system:
      • File icon.gifIDTF_U3D_Converter_Intel.zip if your computer is based on an Intel processor. Unpack the zip file to obtain the executable file, File icon.gifIDTF_U3D_Converter.app
      • File icon.gifIDTF_U3D_Converter_Silicon.zip if your computer is based on a Silicon processor (usually ARM). Unpack the zip file to obtain the executable file, File icon.gifIDTF_U3D_Converter.app

Create the IDTF file

  1. Get a current version of Jmol application. Open your molecule; display it in the desired orientation and style.
    • Suggestion: make the Jmol window square, using top menu > Display > Resize and entering two equal numbers. The result will look better if you insert it later into a square box within the pdf.
    • Note: you can also do it with JSmol embedded in some webpage. Generation of the idtf file may take longer, though, if the model is complex.
  2. If the export to IDTF option has been implemented in the menu:
    • Top menu bar > File > Export > Export to IDTF
    • Pop-up context menu > File > Export > Export IDTF 3D model
  3. Otherwise, open the console and enter write myMol.idtf
  4. Two files will be created: File icon.gifmyMol.idtf and File icon.gifmyMol.idtf.tex. For the current method, you may discard the .tex file.

Create the U3D file

  • Open the IDTF_U3D_Converter program or app, browse to load your File icon.gif.idtf file, choose the output folder and click on "Convert". The output will have the same filename as the input, with extension File icon.gif.u3d
IDTF U3D Converter.png

Prepare your PDF document

  1. Use your preferred program (word processor, presentation, ...) to create a document with text and images, leaving square space(s) where you will later insert the 3D molecular models, and export to pdf format.
  2. To insert the 3D models you need a pdf editor that is compatible with the 3D-PDF standard. Examples: Adobe Acrobat Pro and PDF-XChange Editor (Windows-only, free or paid version)
  3. In PDF-XChange Editor: open the previous PDF, find the place where your left blank space. To insert a 3D annotation there:
    • If you are using the Ribbon interface: Comment > Add 3D
    • If you are using the classical Toolbar interface: Tools > Media tools > Add or edit 3D annotations
    • Draw the rectangle area with the mouse. Suggestion: draw a square by holding the Shift key while dragging to define the area.
    • In 3D Artwork, select your File icon.gifmyMol.u3d file.
    • Choose among any other display options offered (like activation of the content, border and background color)
    • Accept and save the file.
  4. In Adobe Acrobat Pro: open the previous PDF, find the place where your left a blank space. To insert 3D media there:
    • From the upper left of the screen, select All tools > Add rich media > 3D media.
    • Drag a rectangle (better, a square) to define the area for the 3D model. An Insert 3D dialog box appears.
    • In the Insert 3D dialog box, browse to select your File icon.gifmyMol.u3d file. Check Show Advanced Options to set the initial properties.
    • Adobe help for this procedure.

Viewing the result

  • Check the 3D display in a PDF viewer application. Note that not all viewers support this kind of 3D content.
    • The pdf viewers implemented internally in web browsers do not currently support 3D objects and will just display a static image.
    • Adobe Acrobat Pro and the free Adobe Reader support 3D objects.
    • PDF-XChange Editor supports 3D objects.
    • Recent versions of Foxit PDF Reader support 3D objects. Display of 3D objects may be disabled by default. You may enable it either by trusting the document or by setting: File > Preferences > 3D > Enable the playing of 3D content.
  • In Android devices you may use '3D PDF Viewer' or possibly other apps (search the Google Play store).
  • In iOS devices you may use '3D PDF Viewer' (search the App Store) or possibly other apps. This may also be run in a Mac computer.

Sample documents

These have been created following the above procedure

Note the model will not display as 3D and interactive if you view it inside the web browser; you need to download the file and open it in a compatible PDF viewer.

Older reference

This old content may or not be currently useful, but it is kept for the record at File_formats/3D_PDF/Legacy

Contributors

AngelHerraez, Vdlee