LaTeX 3D PDF Placeholder Method

LaTeX 3D PDF Placeholder Method

A LaTeX 3D PDF Placeholder Method for ParaView Visualization and PDF3D ReportGen Conversion Publishing

For academic and research authors using LaTeX tools, it can be challenging to use 3D PDF. The method in this article involves commercial 3D PDF applications to close the gap and get direct publishing of interactive scientific data visualizations, mesh and attribute data and geometric models using LaTeX.

While current solutions exist for embedding U3D and PRC files in TeX documents using “media9”, and the “Asymptote” package generates 3D vector graphics, there is limited integration with mainstream applications for scientific data visualization and common 3D file format conversion.  For example, including STEP, DWG, FBX or X3D models as 3D PDF in a LaTeX document involves using several external packages with limitations for content, compression and advanced 3D PDF features. Using the method described below, the 3D PDF scene handling management JavaScript is provided, PRC-HCT high compression mode is available, and additional interactive controls on the PDF page can be added such as part-list navigator, custom buttons, or geospatial position, distance and grade read-out.

The method shows how the scientific and technical document systems LaTeX and MiKTeX can be used to set a placeholder to mark where an interactive 3D view is added by PV+ (ParaView-based application) PDF3D ReportGen for 3D model conversion and publishing to 3D PDF.

The PDF3D PV+ and ReportGen applications are able to post-process the PDF containing the placeholder and convert 3D model files with precise placement control defined by the placeholder image layout position.

Requirements

MiKTeX or LaTeX with pdfcomment package and its dependencies installed, manually extended with the pdfcomment1.sty available below, and PDF3D ReportGen or PV+ applications.

Method

The method is outlined here:

  1. First, adjust your LaTeX or MiKTeX environment by adding a new resource file:

Copy the new extension package file: pdfcomment1.sty (see below) to C:\MiKTeX 2.9\tex\latex\pdfcomment\, rename original version to pdfcomment-OLD.sty, then rename pdfcomment1.sty to pdfcomment.sty

  1. To use it in the .tex document, at the top header area add:
\usepackage{pdfcomment}

Then place an image, using the “pdftooltiphid” method:

\begin{figure}
  \pdftooltiphid{\includegraphics[width=\linewidth]{image.png}}{PDF3D1}%
  \caption{3D Viewport}%
\end{figure}
  1. Generate the PDF and specify it as a template input in the ReportGen or PV+ menu. Specify input 3D model and output PDF as normal, the new 3D view will be created at the place specified by the placeholder.

How to Use

As illustrated in the above step 2, an image is added to the document from an external PNG or JPEG file with the tooltip value set as ”PDF3D1”. If wishing to add more views, then repeat with additional placeholders using ”PDF3D2”, ”PDF3D3” etc. as needed.

When a colour legend bar is needed to go alongside the 3D view, such as when PV+ is showing contours of a scientific value, or when ReportGen maps an attribute from the 3D model surface using a loaded colormap file, then specify its position by adding another arbitrary image with tooltip value set to ”LEGEND1”.

In both PV+ and ReportGen the merge mode “At Placeholder” is specified to enable this method.

This method enables merging multiple 3D models into the same 3D scene, such as elevation grid data, multiple sub-surfaces, 3D billboard text labels, and sequence animation for transient results.

Other PDF3D systems for batch production processing and custom development using PDF3D-SDK Pro can also be used based on this placeholder method.

Example

Here is working example of a small 1-page document with a 3D placeholder:

% Small sample TeX file with placeholder image, requires new pdfcomment.sty
\documentclass{article}
\usepackage{graphicx}
\usepackage{pdfcomment}
\begin{document}
\begin{figure}
  \pdftooltiphid{\includegraphics[width=\linewidth]{purple3d.png}}{PDF3D1}%
  \caption{3D Viewport}%
\end{figure}
\section{LaTeX PDF3D Placeholder Example}
  This is a very small 1-page document created using MikTeX, 
  showing a basic technique of adding a placeholder to mark where an interactive 3D view will be added. 
  The PDF3D ReportGen application is able post-process the PDF and convert 3D model files 
  with placement control defined by the image layout position.
\subsection{Adding a Placeholder Image}
  Here an image is imported and added to the document, 
  from an external PNG file named purple3d.png.
  The Alt-Text value is ''PDF3D1'', with additional placeholders using ''PDF3D2'', ''PDF3D3'' etc. 
  If also using an associated color legend bar, specify its position 
  by adding another image with Alt-Text value ''LEGEND1''.
\end{document}

Credit

The pdfcomment1.sty extensions are courtesy of Dr.  Anton Donchev, Ernst Mach fellow at the University of Salzburg, Austria.

Resources & Downloads

  • tex_placeholder.tex
  • pdfcomment1.sty
  • tex_placeholder.pdf
  • tex_doc_with_STL_3D.pdf

Download Resource Files in ZIP (1Mb)

Follow the technical implementation discussion at tex.stackexchange.com