Image3d

The Image3d class is for placing 3D images on a document's page. Accepted formats are U3D and PRC. Properties include properties for displaying the model and modifying the PDF reader's toolbar functionality.

Only .u3d and .prc model types are supported.

There are three overloaded constructors, refer to the API documentation for the documentation on each constructor. Properties include properties to add a poster image, modify the model's dimensions, and manipulate model playback window appearance. Refer to the API documentation for a complete list of class properties.

Image3dViewList

The Image3dViewList class is a collection of views for a 3D model via the Image3d class's Views property. Properties include the following available views: Back, Bottom, Default, Front, Isometric, Left, Right, and Top. Refer to the API documentation for a complete list of properties.

View3DProperties

Each view in the views collection (Back, Bottom, Default, Front, Isometric, Left, Right, and Top) has a corresponding V3DProperties class where you set the particular view's properties. Properties include CenterOfOrbit, BackgroundColor, LightingScheme, TransformationMatrix, and many more properties for customizing a view. Refer to the API documentation for a complete list of properties.

Example

The following example illustrates adding a 3D object to a PDF document. It also creates two views in addition to modifying the default view.

Discussing how to use transformation arrays and orbit centrality is beyond this document's scope.

The example adds a 3D cube and then customizes the default view and adds a front and back view.

Document document = new();
document.Pages.Add(new Page(PageSize.Letter));
Image3D image3D = new Image3D("3d-cube.u3d", 0, 0, 500, 500);

float[] array = new float[] { -0.382683f, 0.92388f, -0.0000000616624f, 0.18024f, 0.0746579f, 0.980785f, 0.906127f, 0.37533f, -0.19509f, -8.84868f, -4.0174f, 1.99746f };
image3D.Views.Default.TransformationMatrix = array;
image3D.Views.Default.CenterOfOrbit = 9.76537f;
image3D.Views.Default.OrthographicScaling = .95f;
image3D.Views.Default.BackgroundColor = RgbColor.Orange;
image3D.Views.Default.LightingScheme = Lighting3DScheme.Night;

image3D.Views.Front.BackgroundColor = RgbColor.LightSeaGreen;
image3D.Views.Front.LightingScheme = Lighting3DScheme.White;
image3D.Views.Front.TransformationMatrix = array;
image3D.Views.Front.OrthographicScaling = .75f;

float[] back = new float[] { 1f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 1f, 0f, 0f, 0f };

image3D.Views.Back.BackgroundColor = RgbColor.Yellow;
image3D.Views.Back.TransformationMatrix = back;
ImageData imgData = ImageData.GetImage("cube.png");
image3D.PosterImage = imgData;
document.Pages[0].Elements.Add(image3D);
document.Draw(outputPath);
Dim doc As New Document()
doc.Pages.Add(New Page(PageSize.Letter))

Dim image3D As New Image3D("3d-cube.u3d", 0, 0, 500, 500)

Dim array As Single() = New Single() {-0.382683F, 0.92388F, -0.0000000616624F, 0.18024F, 0.0746579F, 0.980785F, 0.906127F, 0.37533F, -0.19509F, -8.84868F, -4.0174F, 1.99746F}
image3D.Views.Default.TransformationMatrix = array
image3D.Views.Default.CenterOfOrbit = 9.76537F
image3D.Views.Default.OrthographicScaling = 0.95F
image3D.Views.Default.BackgroundColor = RgbColor.Orange
image3D.Views.Default.LightingScheme = Lighting3DScheme.Night

image3D.Views.Front.BackgroundColor = RgbColor.LightSeaGreen
image3D.Views.Front.LightingScheme = Lighting3DScheme.White
image3D.Views.Front.TransformationMatrix = array
image3D.Views.Front.OrthographicScaling = 0.75F

Dim back As Single() = New Single() {1.0F, 0F, 0F, 0F, 1.0F, 0F, 0F, 0F, 1.0F, 0F, 0F, 0F}
image3D.Views.Back.BackgroundColor = RgbColor.Yellow
image3D.Views.Back.TransformationMatrix = back

Dim imgData As ImageData = ImageData.GetImage("cube.png")
image3D.PosterImage = imgData

doc.Pages(0).Elements.Add(image3D)
doc.Draw(outputPath)

3D Example Figure 1. PDF document with an embedded 3D object.

In this topic