Class Pdf3DAnnotation
Represents the 3D annotation for a PDF document.
Implements
Inherited Members
Namespace: Syncfusion.Pdf.Interactive
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class Pdf3DAnnotation : PdfFileAnnotation, IPdfWrapper, INotifyPropertyChanged
Remarks
This Pdf3DAnnotation class is used to represents the 3D annotation for a PDF document. Please refer the UG docuemntation link
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)
Constructors
Pdf3DAnnotation(RectangleF)
Initializes a new instance of the Pdf3DAnnotation class with specified bounds.
Declaration
public Pdf3DAnnotation(RectangleF rectangle)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF | rectangle | 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, String)
Declaration
public Pdf3DAnnotation(RectangleF rectangle, string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF | rectangle | The bounds of the annotation. |
System.String | fileName | The name of the sound file. |
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");
//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")
'Adds the annotation on a page.
page.Annotations.Add(pdf3dAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document.
document.Close(True).
See Also
Properties
Activation
Gets or sets the activation options for the annotation.
Declaration
public Pdf3DActivation Activation { get; set; }
Property Value
Type | Description |
---|---|
Pdf3DActivation |
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");
//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.
Declaration
public Pdf3DAnimation Animation { get; set; }
Property Value
Type | Description |
---|---|
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.
Declaration
public int DefaultView { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | 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
Declaration
public override string FileName { get; set; }
Property Value
Type | Description |
---|---|
System.String | Filename with Full path |
Overrides
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.
Declaration
public string OnInstantiate { get; set; }
Property Value
Type | Description |
---|---|
System.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.
Declaration
public Pdf3DAnnotationType Type { get; set; }
Property Value
Type | Description |
---|---|
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.
Declaration
public Pdf3DViewCollection Views { get; }
Property Value
Type | Description |
---|---|
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.
Declaration
protected override void Initialize()
Overrides
Save()
Saves instance.
Declaration
protected override void Save()