运用Essential Reporting在PDF文档中添加3D文件
2012-11-05 15:37
134 查看
原文来自:http://www.evget.com/zh-CN/Info/catalog/17325.html
Essential Studio Reporting Edition中的Essential PDF是一个能从您的数据中产生Adobe PDF文件 的.NET库。它具有一个成熟的对象模型,允许用任何.NET语言来轻松地创建PDF文件。它不依赖于任何外部条件。在Pdf 3D Annotation类的支持下,Essential PDF支持嵌入三维对象集合(如CAD软件的对象)在PDF文件中。
下面的代码示例演示了如何嵌入一个U3D文件。
[C#]
// Pdf 3D Annotation
Pdf3DAnnotation annot = new Pdf3DAnnotation(new RectangleF(10, 70, 150, 150), @"..\..\Data\AQuick Example.u3d");
// Create font, font style and brush.
Font f = new Font("Calibri", 11, FontStyle.Regular);
PdfFont font = new PdfTrueTypeFont(f, false);
PdfBrush brush = new PdfSolidBrush(Color.DarkBlue);
PdfBrush bgbrush = new PdfSolidBrush(Color.WhiteSmoke);
PdfColor color = new PdfColor(Color.Thistle);
page.Graphics.DrawRectangle(bgbrush, new RectangleF(10, 270, 150, 150));
// Pdf 3D Appearance
annot.Appearance = new PdfAppearance(annot);
annot.Appearance.Normal.Graphics.DrawString("Click to activate", font, brush, new PointF(40, 40));
annot.Appearance.Normal.Draw(page, new PointF(annot.Location.X, annot.Location.Y));
Pdf3DProjection projection = new Pdf3DProjection();
projection.ProjectionType = Pdf3DProjectionType.Perspective;
projection.FieldOfView = 10;
projection.ClipStyle = Pdf3DProjectionClipStyle.ExplicitNearFar;
projection.NearClipDistance = 10;
Pdf3DActivation activation = new Pdf3DActivation();
activation.ActivationMode = Pdf3DActivationMode.ExplicitActivation;
activation.ShowToolbar = false;
annot.Activation = activation;
Pdf3DBackground background = new Pdf3DBackground();
background.Color = color;
Pdf3DRendermode rendermode = new Pdf3DRendermode();
rendermode.Style = Pdf3DRenderStyle.Solid;
Pdf3DLighting lighting = new Pdf3DLighting();
lighting.Style = Pdf3DLightingStyle.Headlamp;
// Create the default view.
Pdf3DProjection projection1 = new Pdf3DProjection(Pdf3DProjectionType.Perspective);
projection1.FieldOfView = 50;
projection1.ClipStyle = Pdf3DProjectionClipStyle.ExplicitNearFar;
projection1.NearClipDistance = 10;
Pdf3DView defaultView = CreateView("Default View", new float[] { -0.382684f, 0.92388f, -0.0000000766026f, 0.18024f, 0.0746579f, 0.980785f, 0.906127f, 0.37533f, -0.19509f, -122.669f, -112.432f, 45.6829f }, 131.695f, background, projection, rendermode, lighting);
annot.Views.Add(defaultView);
// Add the pdf Annotation.
page.Annotations.Add(annot);
[VB.NET]
' Pdf 3D Annotation
Dim annot As Syncfusion.Pdf.Interactive.Pdf3DAnnotation = New Syncfusion.Pdf.Interactive.Pdf3DAnnotation(New RectangleF(10, 70, 150, 150), "..\..\Data\AQuick Example.u3d")
' Create font, font style and brush.
Dim f As Font = New Font("Calibri", 11, FontStyle.Regular)
Dim font As Syncfusion.Pdf.Graphics.PdfFont = New Syncfusion.Pdf.Graphics.PdfTrueTypeFont(f, False)
Dim brush As Syncfusion.Pdf.Graphics.PdfBrush = New Syncfusion.Pdf.Graphics.PdfSolidBrush(color.DarkBlue)
Dim bgbrush As Syncfusion.Pdf.Graphics.PdfBrush = New Syncfusion.Pdf.Graphics.PdfSolidBrush(color.WhiteSmoke)
Dim color As Syncfusion.Pdf.Graphics.PdfColor = New Syncfusion.Pdf.Graphics.PdfColor(color.Thistle)
page.Graphics.DrawRectangle(bgbrush, New RectangleF(10, 270, 150, 150))
' Pdf 3D Appearance
annot.Appearance = New PdfAppearance(annot)
annot.Appearance.Normal.Graphics.DrawString("Click to activate", font, brush, New PointF(40, 40))
annot.Appearance.Normal.Draw(page, New PointF(annot.Location.X, annot.Location.Y))
Dim projection As Syncfusion.Pdf.Interactive.Pdf3DProjection = New Syncfusion.Pdf.Interactive.Pdf3DProjection()
projection.ProjectionType = Pdf3DProjectionType.Perspective
projection.FieldOfView = 10
projection.ClipStyle = Pdf3DProjectionClipStyle.ExplicitNearFar
projection.NearClipDistance = 10
Dim activation As Syncfusion.Pdf.Interactive.Pdf3DActivation = New Syncfusion.Pdf.Interactive.Pdf3DActivation()
activation.ActivationMode = Pdf3DActivationMode.ExplicitActivation
activation.ShowToolbar = False
annot.Activation = activation
Dim background As Syncfusion.Pdf.Interactive.Pdf3DBackground = New Syncfusion.Pdf.Interactive.Pdf3DBackground()
background.Color = color
Dim rendermode As Syncfusion.Pdf.Interactive.Pdf3DRendermode = New Syncfusion.Pdf.Interactive.Pdf3DRendermode()
rendermode.Style = Pdf3DRenderStyle.Solid
Dim lighting As Syncfusion.Pdf.Interactive.Pdf3DLighting = New Syncfusion.Pdf.Interactive.Pdf3DLighting()
lighting.Style = Pdf3DLightingStyle.Headlamp
' Create the default view.
Dim projection1 As Syncfusion.Pdf.Interactive.Pdf3DProjection = New Syncfusion.Pdf.Interactive.Pdf3DProjection(Pdf3DProjectionType.Perspective)
projection1.FieldOfView = 50
projection1.ClipStyle = Pdf3DProjectionClipStyle.ExplicitNearFar
projection1.NearClipDistance = 10
Dim defaultView As Syncfusion.Pdf.Interactive.Pdf3DView = CreateView("Default View", New Single() {-0.382684F, 0.92388F, -0.0000000766026F, 0.18024F, 0.0746579F, 0.980785F, 0.906127F, 0.37533F, -0.19509F, -122.669F, -112.432F, 45.6829F}, 131.695F, background,
projection, rendermode, lighting)
annot.Views.Add(defaultView)
' Add the pdf Annotation.
page.Annotations.Add(annot)
Essential Studio Reporting Edition中的Essential PDF是一个能从您的数据中产生Adobe PDF文件 的.NET库。它具有一个成熟的对象模型,允许用任何.NET语言来轻松地创建PDF文件。它不依赖于任何外部条件。在Pdf 3D Annotation类的支持下,Essential PDF支持嵌入三维对象集合(如CAD软件的对象)在PDF文件中。
下面的代码示例演示了如何嵌入一个U3D文件。
[C#]
// Pdf 3D Annotation
Pdf3DAnnotation annot = new Pdf3DAnnotation(new RectangleF(10, 70, 150, 150), @"..\..\Data\AQuick Example.u3d");
// Create font, font style and brush.
Font f = new Font("Calibri", 11, FontStyle.Regular);
PdfFont font = new PdfTrueTypeFont(f, false);
PdfBrush brush = new PdfSolidBrush(Color.DarkBlue);
PdfBrush bgbrush = new PdfSolidBrush(Color.WhiteSmoke);
PdfColor color = new PdfColor(Color.Thistle);
page.Graphics.DrawRectangle(bgbrush, new RectangleF(10, 270, 150, 150));
// Pdf 3D Appearance
annot.Appearance = new PdfAppearance(annot);
annot.Appearance.Normal.Graphics.DrawString("Click to activate", font, brush, new PointF(40, 40));
annot.Appearance.Normal.Draw(page, new PointF(annot.Location.X, annot.Location.Y));
Pdf3DProjection projection = new Pdf3DProjection();
projection.ProjectionType = Pdf3DProjectionType.Perspective;
projection.FieldOfView = 10;
projection.ClipStyle = Pdf3DProjectionClipStyle.ExplicitNearFar;
projection.NearClipDistance = 10;
Pdf3DActivation activation = new Pdf3DActivation();
activation.ActivationMode = Pdf3DActivationMode.ExplicitActivation;
activation.ShowToolbar = false;
annot.Activation = activation;
Pdf3DBackground background = new Pdf3DBackground();
background.Color = color;
Pdf3DRendermode rendermode = new Pdf3DRendermode();
rendermode.Style = Pdf3DRenderStyle.Solid;
Pdf3DLighting lighting = new Pdf3DLighting();
lighting.Style = Pdf3DLightingStyle.Headlamp;
// Create the default view.
Pdf3DProjection projection1 = new Pdf3DProjection(Pdf3DProjectionType.Perspective);
projection1.FieldOfView = 50;
projection1.ClipStyle = Pdf3DProjectionClipStyle.ExplicitNearFar;
projection1.NearClipDistance = 10;
Pdf3DView defaultView = CreateView("Default View", new float[] { -0.382684f, 0.92388f, -0.0000000766026f, 0.18024f, 0.0746579f, 0.980785f, 0.906127f, 0.37533f, -0.19509f, -122.669f, -112.432f, 45.6829f }, 131.695f, background, projection, rendermode, lighting);
annot.Views.Add(defaultView);
// Add the pdf Annotation.
page.Annotations.Add(annot);
[VB.NET]
' Pdf 3D Annotation
Dim annot As Syncfusion.Pdf.Interactive.Pdf3DAnnotation = New Syncfusion.Pdf.Interactive.Pdf3DAnnotation(New RectangleF(10, 70, 150, 150), "..\..\Data\AQuick Example.u3d")
' Create font, font style and brush.
Dim f As Font = New Font("Calibri", 11, FontStyle.Regular)
Dim font As Syncfusion.Pdf.Graphics.PdfFont = New Syncfusion.Pdf.Graphics.PdfTrueTypeFont(f, False)
Dim brush As Syncfusion.Pdf.Graphics.PdfBrush = New Syncfusion.Pdf.Graphics.PdfSolidBrush(color.DarkBlue)
Dim bgbrush As Syncfusion.Pdf.Graphics.PdfBrush = New Syncfusion.Pdf.Graphics.PdfSolidBrush(color.WhiteSmoke)
Dim color As Syncfusion.Pdf.Graphics.PdfColor = New Syncfusion.Pdf.Graphics.PdfColor(color.Thistle)
page.Graphics.DrawRectangle(bgbrush, New RectangleF(10, 270, 150, 150))
' Pdf 3D Appearance
annot.Appearance = New PdfAppearance(annot)
annot.Appearance.Normal.Graphics.DrawString("Click to activate", font, brush, New PointF(40, 40))
annot.Appearance.Normal.Draw(page, New PointF(annot.Location.X, annot.Location.Y))
Dim projection As Syncfusion.Pdf.Interactive.Pdf3DProjection = New Syncfusion.Pdf.Interactive.Pdf3DProjection()
projection.ProjectionType = Pdf3DProjectionType.Perspective
projection.FieldOfView = 10
projection.ClipStyle = Pdf3DProjectionClipStyle.ExplicitNearFar
projection.NearClipDistance = 10
Dim activation As Syncfusion.Pdf.Interactive.Pdf3DActivation = New Syncfusion.Pdf.Interactive.Pdf3DActivation()
activation.ActivationMode = Pdf3DActivationMode.ExplicitActivation
activation.ShowToolbar = False
annot.Activation = activation
Dim background As Syncfusion.Pdf.Interactive.Pdf3DBackground = New Syncfusion.Pdf.Interactive.Pdf3DBackground()
background.Color = color
Dim rendermode As Syncfusion.Pdf.Interactive.Pdf3DRendermode = New Syncfusion.Pdf.Interactive.Pdf3DRendermode()
rendermode.Style = Pdf3DRenderStyle.Solid
Dim lighting As Syncfusion.Pdf.Interactive.Pdf3DLighting = New Syncfusion.Pdf.Interactive.Pdf3DLighting()
lighting.Style = Pdf3DLightingStyle.Headlamp
' Create the default view.
Dim projection1 As Syncfusion.Pdf.Interactive.Pdf3DProjection = New Syncfusion.Pdf.Interactive.Pdf3DProjection(Pdf3DProjectionType.Perspective)
projection1.FieldOfView = 50
projection1.ClipStyle = Pdf3DProjectionClipStyle.ExplicitNearFar
projection1.NearClipDistance = 10
Dim defaultView As Syncfusion.Pdf.Interactive.Pdf3DView = CreateView("Default View", New Single() {-0.382684F, 0.92388F, -0.0000000766026F, 0.18024F, 0.0746579F, 0.980785F, 0.906127F, 0.37533F, -0.19509F, -122.669F, -112.432F, 45.6829F}, 131.695F, background,
projection, rendermode, lighting)
annot.Views.Add(defaultView)
' Add the pdf Annotation.
page.Annotations.Add(annot)
相关文章推荐
- [置顶] java处理office文档与pdf文件(二)
- 怎么运用PDF Transformer+实现文本到PDF的添加
- 使用Aspose.Pdf在现有的PDF文件中添加注释
- 利用C#如何给PDF文档添加文本与图片页眉
- 如何给现有的PDF文件添加页码
- 怎么给现有的pdf文件添加页码
- PDF文件添加页眉页脚需要如何去操作
- 如何把本地 PDF 文件添加到 iOS 的 iBooks
- 查看pdf文件的目录和添加标签的方法
- 年前最后一篇----关于DOC,PDF,PPT怎么逃过网络各类文库相同文件的审核 重金悬赏高效处理大量文档的方法
- VS2012 obj文件(3D模型)导入 进行渲染 添加光照和文理
- C# 给PDF文档添加超链接
- jQuery上传文件到服务器,实现量上传及压缩包导入,支持Office文档、PDF、图像、音视频和图纸等各类型文件。上传完成后系统自动为图片、音、视频类文件增加摘要及缩略图
- Linux 中将多个Word文档转换成PDF格式的方法及多个PDF文件的合并
- 使用免费组件给PDF文档添加文本和图片页眉
- 手机接收到的Excel文件如何转换成PDF文档
- 有什么方法在PDF文件中添加注释
- C#实现PDF文件添加图片背景
- 使用C#给PDF文档添加注释的实现代码
- 怎样转换文档格式-将PPT快速转换成为PDF格式文件