File Exchange

image thumbnail

Export figure to 3D interactive PDF

version 1.3 (282 KB) by

Export figure as U3D file or directly to 3D interactive graphics within PDF.

26 Ratings



FIG2U3D saves the figure as a U3D file for inclusion as an interactive 3-dimensional figure within a PDF. Either LaTeX or Adobe Acrobat can be used to embed the U3D file in the PDF.
Development and releases on GitHub:
including binaries there:
(linked also here).

The IDTF2U3D executables available in package from github are originally from:
and can be downloaded from:
If obtaining them from there, then place the "bin" directory in the "idtf2u3d" directory of the fig2u3d distribution.

A VWS file is also created, which contains the current camera view of the axes saved. This file can be used to set the figure's default view in the PDF to be the same with the open figure window in MATLAB.

The media9 LaTeX package can import U3D files with their associated VWS files in a PDF document. It can be found here:

For PDF readers which do not render 3D figures, it is possible to include an alternative 2D image as a substitute to the 3D object. For conveniency, the script saves a 2D image together with U3D file. File type and other options for exporting this 2D image can be specified as additional arguments.

FIG2PDF3D Converts the figure directly to a PDF containing only an interactive 3D graphics object.

Graphics object supported for export include:

   line, surface, patch, quivergroup, contourgroup.

Line colors and marker styles, surfaces and quivers with NaNs and surface shading are supported. Multiple instances of various objects can be plotted in the same axes and exported. Note that some limitations apply, for example filled contours are not yet supported.

Dependency detailed info:

for fig2u3d: idtf2u3d converter executable, download:
and place the "bin" directory in the "idtf2u3d" directory of the fig2u3d distribution.

for fig2pdf3d: latex distribution (e.g. MikTeX, TeXLive, MacTeX etc.)

and media9 (preferred) or movie15 LaTeX package

Comments and Ratings (92)

Also, if anyone finds the opportunity to open a pull request on GitHub with a patch for the current Matlab version, that would be helpful. The findings up to now have been collected in this issue: Thanks.

@Frederic K: Looking at the examples to remind myself, you might have to do something along the lines of:

p = patch(isosurface(X, Y, Z, F, 0), 'Parent', ax);
set(p, 'FaceColor', 'r', 'EdgeColor', 'r');

In other words, I believe that this is unrelated to `fig2u3d`, which should output the surface as it has been painted. How the surface is painted is determined by the method of plotting it. The default coloring corresponds to the vertical coordinate.

@Pan Li: In order to look into the error you mentioned when time permits, I would need to reproduce the error. Could you please open an issue in the repository on GitHub, and provide the code for a minimal working example? Thanks.

Frederic K

Thank you for sharing this. This tool is amazing!

I managed to get everything working, apart from changing the surface color gradient to a uniform color. Any ideas?

I found a hint here, but apparently I am not succesful:

Pan Li

Pan Li (view profile)

the same error as Selim Cambazoglu!! Please give some advice!

@Philip Beng: from a quick look at the code [1] of the stackedplot entry, it appears to be calling `plot, plot3, mesh`. I expect that the figure's contents should be exported as normal (I'm not sure I understand what adaptations would be needed).

Regarding errors with `isnan`, please see the relevant GitHub issues, e.g., [2].



Philip Berg

Is there any way to adapt this script for the Stacked plot function ( Matlab 2015b also getting the error "Undefined function 'isnan' for input arguments of type ''.
Error in u3d_pre_quivergroup (line 63)
sh(isnan(sh) ) = [];
Error in fig2u3d (line 198)
[quiver_vertices, quiver_edges, quiver_colors] = u3d_pre_quivergroup(ax);"

Nick Fry

To fix the error in my previous comment download this:
I then also had to download verbatim, acrlength and vnorm which the documentation says are included.

Nick Fry

I am getting the same error as Right Grievous, Hassan and Conan Don.
Undefined function 'axes_extremal_xyz' for input arguments of type 'double'.

Error in view2vws (line 67)
    xyz_minmax = axes_extremal_xyz(ax);

Error in fig2u3d (line 242)
view2vws(ax, fname, part_renderers, fix_daspect)

Error in readSTL (line 4)
I have changed rm as per issue #1 which removed that error and I have done the changes suggested by markusha.
Am I simply missing a dependency? I included the 'bin' folder and everything is in the matlab path.

Thank you for sharing this. Excellent job!
I was wondering if anyone managed to export the line widths properties into the .u3d file. In my case, when I export it the .u3d file does not keep the different line widths of the plot. Thank you!

Dear all,
First of all, thank you for this great package and the previous commenters for the work around in later Matlab versions. I have managed to make it work with a plot3 but I am having issues with a figure I've generated with trisurf. As I'm a quite new to matlab, I'm not sure if it may work with a trisurf figure. You may find the error I get below. Thank you all in advance.
(Matlab 2014b, Windows 7 64bit)

#colors = 62824756
#points = 12697
#faces = 4948
Error using single_mesh_resource_str (line 45)
#colors ~= #points and #colors ~= #faces and #colors not empty.

Error in populate_mesh_resource_str (line 28)
    cur_mesh_resource = single_mesh_resource_str(faces, points,
    face_vertex_data, i);

Error in fig2idtf (line 63)
mesh_resources = populate_mesh_resource_str(faces, surface_vertices,

Error in fig2u3d (line 233)

@Dale Smith: I do not know what the cause is. Please see also an answer to Marios, dated 11 Dec 2015. More information (e.g., if the exit message says more) would be useful. You could also open a new issue on GitHub, although I expect that this may be an IDTFConverter issue.

You could try using a more recent (forked) version from [1], which claims that:

"This is a fork of ningfei/u3d which is a fork of the v1.4.5 U3D library. It has been updated to support x86 and x64 Windows (VS2008, VS2010, VS2015), Linux and OS X."

If it is a `fig2u3d` issue, then it may relate to the updates needed for compatibility with the graphics API of R2016a (and a few earlier versions). A relevant issue is [2], see also some earlier comments here.
(When time permits, I will test and apply the changes proposed by users to update to R2016b).


Dale Smith

Hello, I am running some of the examples included in the file. However, i get the error: "IDTFConverter executable returned with error"
Is there a known solution?
I'm running linux with MATLAB R2016a 64-bit

@Javier, thank you for the information. Please see also my response at the relevant issue:


Javier (view profile)

I confirm that the changes proposed by markusha work for fig2u3d in Matlab R2015a and R2016a. (On a Mac running 10.9.5 (R2015a) or 10.11.5 (R2016a) ).


Thanks for the details.


My usage of this package is restricted only to fig2u3d.m (and any functions it calls). In this scenario the changes below allow me to export U3D in R2016b, R2015a, R2014b and R2013b. I do not have access to other releases. It is probably the third change that needs to be chosen correctly for old vs. new ML releases.

@Andrea Arenz: Could you please list the functions that you used and worked?

Andrea Arenz

@markusha: With the three changes it works perfectly under Matlab R2013b 32bit und Matlab R2016b 64bit. Great job, thanks a lot!

@markusha: Thanks for reporting your patch. Please consider opening a pull request. Are these all the changes needed, or do these suffice specifically for your usage of the package? (if so, please let us know which functions work for you after these modifications). Also, do these changes work with older MATLAB versions?


First off, thank you very much for this nice toolset! My PDF documents have truly benefited from it.

I was able to make this work in R2016b after following changes:
1) in u3d_pre_quivergroup.m change
sh(isnan(sh) ) = [];
sh = [];
2) in u3d_pre_contourgroup.m, same as above
3) in mesh_normals.m, change
normals = get(hp,'VertexNormals');
normals = get(hp,'Vertices');

This works for me. It may or may not work for anyone else.

Michael Boyd

@Stefan: Have you added the directories where this package's files are located to your MATLAB path? The installation instructions should be covered by the package's manual (the PDF). If the error persists, then please consider opening an issue at:
In particular, a minimal working example would help (one that triggers the error), together with the relevant environment details (OS, MATLAB, paths, etc.)

Thank you very much for this tool, it really does seem to be the only one of its kind! I have the same error that Mohammed had below: I get the error

>In fig2u3d at 187
Undefined function 'u3d_pre_surface' for input arguments of type 'double'.

I have downloaded the Universal 3D Sample Software distribution and copied the bin folder from their into the idtf2u3d folder as per the instructions. Was this what I was actually supposed to do? I am quite inexperienced with MATLAB. I am running MATLAB R2013b.

Andrea Arenz

Thanks for this great tool. Under R2013b I got it working with some minor changes. Now using R2016b nothing is working due to the changed graphics API. Please update it or gibe some hints on how to upate it!

From what I can recall, letters are not supported, because they would have to be converted to paths, because .u3d doesn't support fonts (or at least that's what I remember).

Another problem is that letters are not very practical, because they cannot be read, unless they are re-oriented towards the viewing direction.
This is a dynamic operation, and requires two things:

1. JavaScript embedded within the PDF, and
2. a suitable PDF viewer that runs the JavaScript.

Regarding the ticks, they can be replicated, by drawing lines or small spheres at where the ticks are. Those will then be exported.

Nonetheless, there may be a better alternative for presenting this information than adding it as annotations to a 3D document.


Thanks a lot for your work!
I was wondering if there is any way to retain the labels and ticks on the axis.

No, `fig2u3d` has not been updated to the graphics API of the latest Matlab release. I would like to update it at some point. As of now, time has not permitted doing so. Please feel free to open pull requests to the GitHub repository.


Wessel (view profile)

I'm having the same problem as Jake and Victoria mentioned in 2014 (with Matlab 2015b):

Undefined function 'isnan' for input arguments of type ''.

Error in u3d_pre_quivergroup (line 63)
sh(isnan(sh) ) = [];

Error in fig2u3d (line 198)
[quiver_vertices, quiver_edges, quiver_colors] = u3d_pre_quivergroup(ax);

Is there already a fix developed for this issue?

Jim Sell

I am getting an error. It's broken.

Same error as Hassan and Conan Don


Hassan (view profile)

the same error as Conan Don!! any advice

Conan Don

Hi, I have attempted to use the fig2u3d function. However, it seems I am missing some dependencies. I have met with this error.
Undefined function 'axes_extremal_xyz' for input arguments of type ''.

Error in fig2u3d>plot_axes (line 262)
[xyz_minmax, dim] = axes_extremal_xyz(ax);

Error in fig2u3d (line 172)
plot_axes(ax, addaxes)

Please advice

@Marios: It looks like some sort of memory error or similar. I do not know the internals of the IDTF converter.

However, do you really need such a resolution ? It is unlikely to be rendered at this resolution on screen, and people will rarely keep zooming until they see all the detail. If the surface is sufficiently smooth, downsampling it is a good practice when the time comes to plot. The same applies to 2d plots. Also, this reduces the file size produced. If some adaptive sampling is needed, then you could try use MATLAB's infrastructure (I assume that it has some way of downsampling surfaces).

Otherwise, please feel free to open a github issue with an example that causes this behavior, together with the specs of your machine and OS.

@Andrew: It is the first that a projection issue is noted. The axes are exported here: Please feel free to open a GitHub issue with a minimal working example, including the MATLAB version that you used.

@Mark: I do not recall a way to remove the edges. You could try plotting as a mesh with interpolated color, or try to modify the output code (I assume for shading, but please take a look at the IDTF file definition) around here: and here:

@Kelaiya: Thank you, for posterity:


Marios (view profile)

Hi Ioannis,

I have a big data matrix A=[5000x7000] to plot as a surface.

If I use your code, i get this message

Model Resources (1) Exit code = 80000000

Error using idtf2u3d (line 111)
IDTFConverter executable returned with error.

If i "compress the big matrix" (say A=A[A(1:4:end),(1:4:end)], then I can create a pdf.

Any work around on this?



Andrew (view profile)

Hi Ioannis, really good code thanks!! I just wondered if anybody had any issues with projection. When am I saving the image it seems to flip the axis. From my image the 0,0 point is in the bottom left but the pdf has this at the top left. Is there anyway to resolve this?


Mark (view profile)

Hi Ioannis, thanks a lot for this code!
In the pdf file, all the faces in my image have triangulations in them, with black edges around the triangles. Is there any way to remove those black edges? My figure is created using 'patch'.

@Ioannis, I just opened issue with small example.

@Konark: If you could open an issue on github with a minimal working example, that would help fix the problem. Thank you.

With your script for Surf plot, color is not render as per original figure

surf(X,Y,Z,'FaceColor',[1 0.2 0],'FaceAlpha',0.65,'EdgeColor','none').

When I export this figure to PDF, it renders to solid jet color figure.

@Patrik: mathwork's comment system just overwrote my answer. Summarizing: trying without the pseudocolor image may work (I do not recall support for images).

If, on the other hand, the image is painted on the surface, then the coloring scheme may be the culprit.

The error you see arises here:
due to the variable `use_vertex_color` remaining undefined, with the warning you see from here:

@Darcy: Step-by-step instructions can be found in the PDF manual, available here:

@Darcy: It may be the case that `Cline` draws lines using patches, so these are degenerate patches (1 dimensional), and would need degenerate triangles to be triangulated. Perhaps try modifying to use normal lines, or write your own function for this purpose. I would guess that `Cline` uses patches in order to interpolate color, but not sure whether that is possible with normal line segments too (though cannot recall whether color interpolation is supported).


Darcy (view profile)

I am currently trying to convert the figure output from Cline (, which i beleive uses patch edges.

The error I receive is:

No surfaces found.
     Preprocessing patch No.1
Warning: Patch faces are not triangulated.
> In u3d_pre_patch>delaunay_triangulate_patch_face (line 166)
  In u3d_pre_patch>single_patch_preprocessor (line 95)
  In u3d_pre_patch (line 70)
  In fig2u3d (line 195)
  In file (line 1)
      Using Delanay triangulation.
Error using delaunay
Input points have invalid dimension.

Error in u3d_pre_patch>delaunay_triangulate_patch_face (line 194)
    curtrifaces = delaunay(xproj.');

Error in u3d_pre_patch>single_patch_preprocessor (line 95)
    faces = delaunay_triangulate_patch_face(faces, vertices);

Error in u3d_pre_patch (line 70)
    [v, f, fvx, r] = single_patch_preprocessor(h);

Error in fig2u3d (line 195)
[patch_vertices, patch_faces, patch_facevertexcdata, patch_renderers] = u3d_pre_patch(ax);

Error in file (line 1)


Darcy (view profile)

Great resource but I am having difficulty properly configuring all the downloadable content. I'm not sure what I need and basically need a step by step instruction. Any chance you could ellaborate?

Hi Ioannis,

First of all, thumbs up for this nicely done project, haven´t found a comparable one.

Second, I´ve got an issue processing the surf axes for a grayvalue image. I´m feeding it a 3D figure + an underlying pseudocolor image, both on the same axe handle of course.
The warning and following error is:

Empty cdata.
size(cdata, 1) = #points
Number of colors: 64
Warning: use_vertex_color: nfvd
otin {npoints, nfaces}
> In shaders_materials_modifiers at 46
  In fig2idtf at 78
  In fig2u3d at 233
  In fig2latex at 48
  In fig2pdf3d at

Undefined function or variable "use_vertex_color".

Error in shaders_materials_modifiers (line 49)
    shader_resources{1, i} = sprintf(shader_resource_str(use_vertex_color), [shidx, shidx, shidx].');

Any suggestions?


This sounds like an insufficient write permission.


snrlax (view profile)


I am having troubles using the package. In matlab 2014a i get the following error:

./IDTFConverter: Permission denied

Error using idtf2u3d (line 111)
IDTFConverter executable returned with error.

@Rene: The axes themselves can be easily included by drawing lines where the axes are supposed to be. Arrows at the tips can be constructed by placing small cones there.

Regarding text annotation, the u3d format does not natively support text glyphs. For this reason, there is no support for exporting text labels (thus also axis labels).

But including text in 3D graphics is problematic in the first place, because it is practically unreadable, unless either a javascript is embedded in the PDF to keep rotating the text so that it remain orthogonal to the user view direction, or the viewer do this automatically (not the case).

Text is supported by the PRC format, to which you can export from, e.g., Asymptote. So if you really require text, you might want to look into that.

This script is very nice but unfortunately not usable for scientific papers as one cannot include the axes - this makes most of my plots (if it isn´t a geometry) meaningless. This would be so nice but I see no way (also not with other programms/scripts) to do so.
Please, please correct me if I´m wrong!

@Alexandre: It's been a long time since writing this code, but it appears that changing the `NODE_NAME` here: may have the intended effect (otherwise, the u3d -> idtf converter may be intervening -- though I wouldn't expect such renaming behavior. The only difference appears to be that you write "mesh1", instead of "Mesh1" (perhaps it was capitalized ?).


@Ioannis - as a user of your code i have an additonnal question: When the 3Dpdf is created (or before) is it possible to change name of elements on the hierarchy tree? On my 3Dpdf there are only "mesh1" or "line1" and I wanted to change it in order to have the element name that i want. Otherwise code still very useful!! Thanks


Davide (view profile)

It works great on my Matlab2014a, however it has some limitations: it doesn't export the axes, the grid and scattered points...
Anyone has an idea of how to export scattered points?!


Has anybody succeeded in making it work in Matlab R2014b? I'm getting huge troubles.
Thank you.
If you have a solution please contact me:

Thank you

You seem to be missing the binaries.

Please follow the instructions for downloading all the required dependencies *and* binaries, and placing them so that they will be found (also adding to your matlab path those directories).

For the sources, better to download the tip of the repository as a tarball (or better still, to clone it).

Also, avoid spaces in the path.


nice program but i got an error...
i initialize folders based on your manual but this error happen when i type fig2pdf3d command :

"Undefined function 'fig2pdf3d' for input arguments of type 'double'."

after that i put all .m files in folder and type the command again.this thime lots of lines appear on the screen and then this error happen :

"No quivergroups found.
No contourgroups found.
Number of lines written to IDTF file: 6862073
"D:\Projects\Matlab\Export to 3d test\bin\w32\IDTFConverter.exe" -input "D:\Projects\Matlab\Export to 3d test\asd.idtf" -output "D:\Projects\Matlab\Export to 3d test\asd.u3d"
The system cannot find the path specified."

please give a hint

I'm not using MATLAB any more, so I am not familiar with the changes to graphics. I only know that graphics objects, instead of handles are used now. If there is a patch, please send a pull request on github.


This works great on R2014a.
We now have 2014b, which changes how matlab handles graphics. The issue that Jake has flagged below occurs the graphics objects no longer have 'children' and have to be handled differently. I'm trying to get it to work and I'm having some success, but I'm relatively new to matlab so it's taking time. I'll post an update if I have any luck, but if anyone gets there before me, please go ahead.

I am not sure what mathworks decided to change this time. In any case, please feel free to fork the project on github, make the fixes, and send a pull request.


Jake (view profile)

Delighted with this. However, not yet working with the Updated Graphics System on the 2014b Prerelease (can't see why). Is anyone else interested in trying this on the Prerelease?

Undefined function 'isnan' for input arguments of type

Error in u3d_pre_quivergroup (line 63)
sh(isnan(sh) ) = [];

Error in fig2u3d (line 198)
[quiver_vertices, quiver_edges, quiver_colors] = u3d_pre_quivergroup(ax);


Martin (view profile)

Very nice program, thanks a lot!

Sadly the opacity of every pixel in a surface plot is not copied to the pdf. :(

@Francesco: I changed vol3d to draw the 3d-array without texture mapping. But that didn't fix the problem because the opacity is not copied.


I was wondering is there a way to set the line properties (i.e., line width) for the 3D pdf image? Changing the line properties in the figure in Matlab doesn't change the 3D image, other than color. Also is there a way to add the axes labels to the 3D image? Thanks!


Horst (view profile)

Is there a way to export semi-transparent plots? It seems to always come out opaque but maybe I'm doing something wrong. Thanks a lot.


Diogo (view profile)

I would like to keep the shading as 'faceted' in the 3d pdf file, but the result looks like the 'interp' shading. How can I have 'faceted' shading in the 3d pdf?
How would I use this to plot oil wells or mining drill holes in 3d pdfs?


@ Ionnis: It works!!! Thanks again for your work!

@Alexandre: If the desired effect is removing the points which have NaN color, then using NaN for those x,y,z coordinates (not the color) should work.


Dear Ionnis,
Thank you for this very useful tool!!! Now I can export my matlab figures in a 3D pdf format!! wonderful! However I just have one question: I creat a surf figure using 4 matrix X,Y,Z and Cdata. In my cdata matrix I have some NaN in order to have no color at some specific area. On matlab the figure is ok but when I export into pdf3D areas where I have NaN become darkblue instead of no color!! Any idea to fix it?
Anyway thank you very much again for your work

No, there is no export for text annotations. One reason is that if I recollect correctly, U3D does not support text representation, so it would have to be exported as lines or surfaces (not very elegant and a lot of "manual" work on top of U3D). I think that text is supported much better by the PRC format ( which is used for example by Asymptote (


Jason (view profile)

Is there by chance a way to export text annotations on the 3d plot to explain what parts of the plot?


Hi Loannis,

This is a great tool and I've gotten it to work on my computer for the example files you provided. Unfortunately, it doesn't seem to work when I apply it to a figure produced by the "vol3d.m" function (by Joe Conti), which produces a volume rendering of 3-D data using the matlab "surface" function. I get a lot of outputs in the command line that say "Empty cdata". I don't get an error with fig2u3d.m but when I convert the u3d result to 3d pdf with acrobat, I get an empty white box. If I use fig2pdf3d.m I get the following error "Undefined function or variable "use_vertex_color". Error in shaders_materials_modifiers (line 49)". Do you know what could be wrong?


Ben (view profile)

Hi Ioannis,
I have emailed you my revision. Wish it is helpful.

Hi Ben,

 Thanks for the note, there is an OS X fix I've posted below (04 Dec 2012), but there is something else, please send me the fix. I planned to update the files here when time permitted.


Ben (view profile)

Very good though some modifications are needed in idtf2u3d.m for Mac OS X. If you like, I could send my modified and tested version to you.

Hi Devin,

 Including the colorbar is not an implemented feature. The axes are included by plotting them in fig2u3d.m with the function plot_axes.

A suggestion would be to plot the colorbar within the axes (not as it is created by default, i.e., as a separate graphics object). An example which can be adapted according to your needs can be found here:

It looks like it needs some updating, but besides that it has the main idea of a colorbar comprised of patches. Then you can also select its preferred position and orientation.

Thanks for the idea, I will keep it mind for incorporating it in the next release.


Hello Ioannis,

This is an excellent and very helpful set of tools. I would like to include my colorbar in the 3D PDFs created with Latex, but have failed in my (limited) attempts. Any suggestions or is this already an option I'm missing? I tried the including the axes in the U3D files but it doesn't seem to pick up the colorbar.


Hi dan,

 The issue is probably that the missing function is not in your path. You can add all the directories of the package to your path by using the :pathtool" command. Please try to see if its working with other plots (which have surfaces).

 Apart from this, this software does not yet support scattergroups. I tried the scatter3 help example and although I got no errors, the geometry exported to the u3d file was essentially empty.

 The reason is that some checks are performed. If you successfully run the script for a scatter3 plot, it will report that it did not find any surfaces, lines, patches, quivergroups or contourgroups.
 It turns out that scatter3 produces hggroups and the quivergroup and contourgroup export functions look for hggroups. However, they then filter them to see if they are quivers or contours. Otherwise nothing is exported.

 In the future there are plans to extend the supported plot types. For the moment all these tests aim to avoid cryptic errors caused by unsupported (or untested) plots. Probably the existing functionality does support scatter3 (i.e., they are only points, so the interface to the output functions will be relatively simple, compared to e.g. quiver output, which has to care about many details). But the wrapper for scatter3 is not yet part of the code.


dan (view profile)

Hi Ioannis,
the pdf output of your manual looks really nice.
Unfortunately, it the script always gives me the following error message:
"Undefined function 'u3d_pre_surface' for
input arguments of type 'double'."
I am using scatter3 to generate the matlab figure. Does the script support this?

Thank you for your nice work!

Please note that if one is willing to employ another 4 to 5 programs, one of which is a proprietary plug-in costing $99, all of which should be manually handled using the mouse and keyboard, with the obvious issue of having to deal with all the possible incompatibilities and other bugs that may arise as these update and change, then the purpose of writing a compact and clean code for doing the same in code or with one short command at the MATLAB command prompt, with fully open source code (MATLAB excluded) which is free and transparent, is totally defeated.

I have just (11 Dec 2012) posted an alternative way to create interactive PDFs without LaTeX:

Hi Mario Garcia and Sheng Yue,

 If you are using OSX 10.8+ there may be issues with the environment variables.
Please try this fix in idtf2u3d.m, hope this helps:

%% prepare command
mfiledir = fileparts(mfilename('fullpath') );
curpath = pwd;

% Intel Mac
if ismac
    idtf_executable_path = [mfiledir, '/bin/maci/'];
    IDTFcmd = './IDTFConverter';
    %temp = [getenv('DYLD_LIBRARY_PATH'), ':"', mfiledir, '/bin/maci/"'];
    %setenv('DYLD_LIBRARY_PATH', temp)
    %IDTFcmd = ['"', mfiledir, '/bin/maci/', IDTFcmd, '"'];

% Linux
if isunix && ~ismac
    idtf_executable_path = [mfiledir, '/bin/glx/'];
    IDTFcmd = './';
    %temp = [getenv('LD_LIBRARY_PATH'), ':"', mfiledir, '/bin/glx/"'];
    %setenv('LD_LIBRARY_PATH', temp)
    %IDTFcmd = ['"', mfiledir, '/bin/glx/', IDTFcmd, '.sh"'];

% windows
if ispc
    win_mfiledir = strrep(mfiledir, '\', '\\');
    IDTFcmd = ['"', win_mfiledir, '\\bin\\w32\\IDTFConverter.exe"'];

%% idtf -> u3d conversion
s = [IDTFcmd, ' -input "%s" -output "%s"'];
idtf2u3dcmd = sprintf(s, idtffile, u3dfile);
[status, result] = system(idtf2u3dcmd);
cd(curpath) % go back

if status ~= 0
          'IDTFConverter executable returned with error.')

Hi Sheng Yue,

idtf2u3d does not work correctly on my computer, can you help me?

Error using idtf2u3d (line 97)
IDTFConverter.exe returned with error.

Hi Delit,

 3D PDF files can have text in 3D.
But this depends on which intermediate file is used to import the 3D information to the PDF. In principle it is possible to insert text in the U3D file, but it is much more difficult than in a PRC file. For the moment this code uses U3D files, because it is based on previous work by others, which developed the required intermediate tools. It is possible to create an exporter to PRC, but one would have to look at the code already used for this purpose in Asymptote for example, and convert it to MATLAB, which I would like to try, but is not planned for the near future.


Delit (view profile)

Is it possible to insert scatter and text in the 3D pdf interactive?

Sheng Yue

need to change idtf2u3d.m to make it work on my computer.
Still a nice work!



Sven Koerner

Sven Koerner (view profile)



link directly to github using matlabcentral itself


development on github, bugfixes (including Mac paths)

MATLAB Release
MATLAB 7.14 (R2012a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video