Table of Contents

Class Pdf3DAnnotation

Namespace
Syncfusion.Pdf.Interactive
Assembly
Syncfusion.Pdf.Portable.dll

Represents the 3D annotation for a PDF document.

public class Pdf3DAnnotation : PdfFileAnnotation, INotifyPropertyChanged
Inheritance
Pdf3DAnnotation
Implements
Inherited Members

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create a new pdf3d annotation.
Pdf3DAnnotation pdf3dAnnotation = new Pdf3DAnnotation(new RectangleF(10, 50, 300, 150), @"Input.u3d");
//Create pdfFont, pdfFont style and brush.
Font font = new Font("Calibri", 11, FontStyle.Regular);
PdfFont pdfFont = new PdfTrueTypeFont(font, false);
PdfBrush brush = new PdfSolidBrush(Color.DarkBlue);
//Create 3D activation.
Pdf3DActivation activation = new Pdf3DActivation();
activation.ActivationMode = Pdf3DActivationMode.PageVisible;
activation.ShowToolbar = true;
pdf3dAnnotation.Activation = activation;
Pdf3DView defaultView = new Pdf3DView();
defaultView.ExternalName = "Near View";
defaultView.CameraToWorldMatrix = new float[] { -0.382684f, 0.92388f, -0.0000000766026f, 0.18024f, 0.0746579f, 0.980785f, 0.906127f, 0.37533f, -0.19509f, -100, -112.432f, 45.6829f };
defaultView.CenterOfOrbit = 131.695f;
//Set the 3D background.
Pdf3DBackground background=new Pdf3DBackground();
background.Color=new PdfColor(Color.Blue);
defaultView.Background = background;
//Set the projection.
Pdf3DProjection projection = new Pdf3DProjection(Pdf3DProjectionType.Orthographic);
defaultView.Projection = projection;
//Set the render mode.
Pdf3DRendermode renderMode = new Pdf3DRendermode(Pdf3DRenderStyle.Solid);
defaultView.RenderMode = renderMode;
//Set the lighting scheme.
Pdf3DLighting lighting = new Pdf3DLighting(Pdf3DLightingStyle.Night);
defaultView.LightingScheme = lighting;
//Add the view.
pdf3dAnnotation.Views.Add(defaultView);
pdf3dAnnotation.Appearance.Normal.Graphics.DrawString("Click to activate", pdfFont, brush, new PointF(40, 40));
//Add this annotation to a new page.
pdf3dAnnotation.Appearance.Normal.Draw(page, new PointF(pdf3dAnnotation.Location.X, pdf3dAnnotation.Location.Y));
//Adds annotation to page.
page.Annotations.Add(pdf3dAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page .
Dim page As PdfPage = document.Pages.Add()
'Create a new pdf3d annotation.
Dim pdf3dAnnotation As New Pdf3DAnnotation(New RectangleF(10, 50, 300, 150), "Input.u3d")
'Create pdfFont, pdfFont style and brush.
Dim font As New Font("Calibri", 11, FontStyle.Regular)
Dim pdfFont As PdfFont = New PdfTrueTypeFont(font, False)
Dim brush As PdfBrush = New PdfSolidBrush(Color.DarkBlue)
Dim activation As New Pdf3DActivation()
activation.ActivationMode = Pdf3DActivationMode.PageVisible
activation.ShowToolbar = True
pdf3dAnnotation.Activation = activation
Dim defaultView As New Pdf3DView()
defaultView.ExternalName = "Near View"
defaultView.CameraToWorldMatrix = New Single() { -0.382684f, 0.92388f, -0.0000000766026f, 0.18024f, 0.0746579f, 0.980785f, 0.906127f, 0.37533f, -0.19509f, -100, -112.432f, 45.6829f }
defaultView.CenterOfOrbit = 131.695f
'Set the 3D background.
Dim background As New Pdf3DBackground()
background.Color = New PdfColor(Color.Blue)
defaultView.Background = background
'Set the projection.
Dim projection As New Pdf3DProjection(Pdf3DProjectionType.Orthographic)
defaultView.Projection = projection
'Set the render mode.
Dim renderMode As New Pdf3DRendermode(Pdf3DRenderStyle.Solid)
defaultView.RenderMode = renderMode
'Set the lighting scheme.
Dim lighting As New Pdf3DLighting(Pdf3DLightingStyle.Night)
defaultView.LightingScheme = lighting
'Add the view.
pdf3dAnnotation.Views.Add(defaultView)
pdf3dAnnotation.Appearance.Normal.Graphics.DrawString("Click to activate", pdfFont, brush, New PointF(40, 40))
'Add this annotation to a new page.
pdf3dAnnotation.Appearance.Normal.Draw(page, New PointF(pdf3dAnnotation.Location.X, pdf3dAnnotation.Location.Y))
'Save the document to disk.
document.Save("Output.pdf")
'close the document.
document.Close(True)

Remarks

This Pdf3DAnnotation class is used to represents the 3D annotation for a PDF document. Please refer the UG docuemntation link for more details.

Constructors

Pdf3DAnnotation(RectangleF)

Initializes a new instance of the Pdf3DAnnotation class with specified bounds.

public Pdf3DAnnotation(RectangleF rectangle)

Parameters

rectangle RectangleF

The bounds of the annotation.

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create a new pdf3d annotation.
Pdf3DAnnotation pdf3dAnnotation = new Pdf3DAnnotation(new RectangleF(10, 50, 300, 150));
//Adds the annotation.
page.Annotations.Add(pdf3dAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page .
Dim page As PdfPage = document.Pages.Add()
'Create a new pdf3d annotation.
Dim pdf3dAnnotation As New Pdf3DAnnotation(New RectangleF(10, 50, 300, 150))
'Adds the annotation.
page.Annotations.Add(pdf3dAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document.
document.Close(True).
See Also

Pdf3DAnnotation(RectangleF, Stream)

public Pdf3DAnnotation(RectangleF rectangle, Stream data)

Parameters

rectangle RectangleF
data Stream
See Also

Properties

Activation

Gets or sets the activation options for the annotation.

public Pdf3DActivation Activation { get; set; }

Property Value

Pdf3DActivation

Examples

Defines the times at which the annotation should be activated and deactivated and the state of the 3D artwork instance at those times.

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create a new pdf3d annotation.
Pdf3DAnnotation pdf3dAnnotation = new Pdf3DAnnotation(new RectangleF(10, 50, 300, 150), @"Input.u3d");
//Creates a new pdf3d activation.
Pdf3DActivation activation = new Pdf3DActivation();
activation.ActivationMode = Pdf3DActivationMode.ExplicitActivation;
activation.ShowToolbar = false;
pdf3dAnnotation.Activation = activation;
//Adds the annotation.
page.Annotations.Add(pdf3dAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page .
Dim page As PdfPage = document.Pages.Add()
'Create a new pdf3d annotation.
Dim pdf3dAnnotation As New Pdf3DAnnotation(New RectangleF(10, 50, 300, 150), "Input.u3d")
'Creatas a new pdf3d actviation.
Dim activation As New Pdf3DActivation()
activation.ActivationMode = Pdf3DActivationMode.ExplicitActivation
activation.ShowToolbar = False
pdf3dAnnotation.Activation = activation
'Adds the annotation.
page.Annotations.Add(pdf3dAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document.
document.Close(True)
See Also

Animation

Gets or sets the Animation.

public Pdf3DAnimation Animation { get; set; }

Property Value

Pdf3DAnimation

The animation of the annotation.

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create a new pdf3d annotation.
Pdf3DAnnotation pdf3dAnnotation = new Pdf3DAnnotation(new RectangleF(10, 50, 300, 150), @"Input.u3d");
Pdf3DAnimation animation = new Pdf3DAnimation(PDF3DAnimationType.Linear);
animation.PlayCount = 10;
animation.TimeMultiplier = 3;
pdf3dAnnotation.Animation = animation;   
page.Annotations.Add(pdf3dAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page .
Dim page As PdfPage = document.Pages.Add()
'Create a new pdf3d annotation.
Dim pdf3dAnnotation As New Pdf3DAnnotation(New RectangleF(10, 50, 300, 150), "Input.u3d")
Dim animation As Pdf3DAnimation = New Pdf3DAnimation(PDF3DAnimationType.Linear)
animation.PlayCount = 10
animation.TimeMultiplier = 3
pdf3dAnnotation.Animation = animation
page.Annotations.Add(pdf3dAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document.
document.Close(True)
See Also

DefaultView

Gets or sets the default view.

public int DefaultView { get; set; }

Property Value

int

The default view of the annotation.

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create a new pdf3d annotation.
Pdf3DAnnotation pdf3dAnnotation = new Pdf3DAnnotation(new RectangleF(10, 50, 300, 150), @"Input.u3d");
pdf3dAnnotation.DefaultView = 0;
page.Annotations.Add(pdf3dAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page .
Dim page As PdfPage = document.Pages.Add()
'Create a new pdf3d annotation.
Dim pdf3dAnnotation As New Pdf3DAnnotation(New RectangleF(10, 50, 300, 150), "Input.u3d")
pdf3dAnnotation.DefaultView = 0
page.Annotations.Add(pdf3dAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document.
document.Close(True)
See Also

FileName

public override string FileName { get; set; }

Property Value

string

Filename with Full path

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create a new pdf3d annotation.
Pdf3DAnnotation pdf3dAnnotation = new Pdf3DAnnotation(new RectangleF(10, 50, 300, 150), @"Input.u3d");
//Gets the filename.
string fileName = pdf3dAnnotation.FileName;
//Adds the annotation.
page.Annotations.Add(pdf3dAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page .
Dim page As PdfPage = document.Pages.Add()
'Create a new pdf3d annotation.
Dim pdf3dAnnotation As New Pdf3DAnnotation(New RectangleF(10, 50, 300, 150), "Input.u3d")
'Gets the filename.
Dim fileName As String = pdf3dAnnotation.FileName
'Adds the annotation.
page.Annotations.Add(pdf3dAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document.
document.Close(True).
See Also

OnInstantiate

Gets or sets the code to execute when the 3D artwork is instantiated. JavaScript code to be executed when the 3D artwork is instantiated.

public string OnInstantiate { get; set; }

Property Value

string

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create a new pdf3d annotation.
Pdf3DAnnotation pdf3dAnnotation = new Pdf3DAnnotation(new RectangleF(10, 50, 300, 150), @"Input.u3d");
pdf3dAnnotation.OnInstantiate = "host.getURL(\"http://www.syncfusion.com\")";
//Create a pdf 3d view.
Pdf3DView defaultView = new Pdf3DView();
defaultView.CameraToWorldMatrix = new float[] { -0.382684f, 0.92388f, -0.0000000766026f, 0.18024f, 0.0746579f, 0.980785f, 0.906127f, 0.37533f, -0.19509f, -100, -112.432f, 45.6829f };
defaultView.CenterOfOrbit = 131.695f;
pdf3dAnnotation.Views.Add(defaultView);
//Adds the annotation.
page.Annotations.Add(pdf3dAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page .
Dim page As PdfPage = document.Pages.Add()
'Create a new pdf3d annotation.
Dim pdf3dAnnotation As New Pdf3DAnnotation(New RectangleF(10, 50, 300, 150), "Input.u3d")
pdf3dAnnotation.OnInstantiate = "host.getURL(\"http://www.syncfusion.com\")"
'Create a pdf 3d view.
Dim defaultView As New Pdf3DView()
defaultView.CameraToWorldMatrix = New Single() { -0.382684f, 0.92388f, -0.0000000766026f, 0.18024f, 0.0746579f, 0.980785f, 0.906127f, 0.37533f, -0.19509f, -100, -112.432f, 45.6829f }
defaultView.CenterOfOrbit = 131.695f
pdf3dAnnotation.Views.Add(defaultView)
'Adds the annotation.
page.Annotations.Add(pdf3dAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True).
See Also

Type

Gets or sets the type of 3DAnnoation.

public Pdf3DAnnotationType Type { get; set; }

Property Value

Pdf3DAnnotationType

The type of the 3DAnnotation.

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create a new pdf3d annotation.
Pdf3DAnnotation pdf3dAnnotation = new Pdf3DAnnotation(new RectangleF(10, 50, 300, 150), @"Input.u3d");
pdf3dAnnotation.Type = Pdf3DAnnotationType.PRC;
page.Annotations.Add(pdf3dAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page .
Dim page As PdfPage = document.Pages.Add()
'Create a new pdf3d annotation.
Dim pdf3dAnnotation As New Pdf3DAnnotation(New RectangleF(10, 50, 300, 150), "Input.u3d")
pdf3dAnnotation.Type =  Pdf3DAnnotationType.PRC
page.Annotations.Add(pdf3dAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document.
document.Close(True)
See Also

Views

Gets the list of available views for the current 3D artwork. Read-Only.

public Pdf3DViewCollection Views { get; }

Property Value

Pdf3DViewCollection

The Pdf3DViewCollection specifies the collection of PDF 3D views.

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create a new pdf3d annotation.
Pdf3DAnnotation pdf3dAnnotation = new Pdf3DAnnotation(new RectangleF(10, 50, 300, 150), @"Input.u3d");
Pdf3DView defaultView = new Pdf3DView();
defaultView.ExternalName = "Near View";
defaultView.CameraToWorldMatrix = new float[] { -0.382684f, 0.92388f, -0.0000000766026f, 0.18024f, 0.0746579f, 0.980785f, 0.906127f, 0.37533f, -0.19509f, -100, -112.432f, 45.6829f };
defaultView.CenterOfOrbit = 131.695f;
//Add views.
pdf3dAnnotation.Views.Add(defaultView);
//Get the views.
Pdf3DViewCollection viewCollection = pdf3dAnnotation.Views;
//Add the annotation.
page.Annotations.Add(pdf3dAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page .
Dim page As PdfPage = document.Pages.Add()
'Create a new pdf3d annotation.
Dim pdf3dAnnotation As New Pdf3DAnnotation(New RectangleF(10, 50, 300, 150), "Input.u3d")
Dim defaultView As New Pdf3DView()
defaultView.ExternalName = "Near View"
defaultView.CameraToWorldMatrix = New Single() { -0.382684f, 0.92388f, -0.0000000766026f, 0.18024f, 0.0746579f, 0.980785f, 0.906127f, 0.37533f, -0.19509f, -100, -112.432f, 45.6829f }
defaultView.CenterOfOrbit = 131.695f
'Add views.
pdf3dAnnotation.Views.Add(defaultView)
'Get the views.
Dim viewCollection As Pdf3DViewCollection = pdf3dAnnotation.Views
'Add the annotation.
page.Annotations.Add(pdf3dAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document.
document.Close(True)
See Also

Methods

Initialize()

Initializes instance.

protected override void Initialize()
See Also

Save()

Saves instance.

protected override void Save()
See Also

See Also