Use essential reporting to add 3D files to a PDF file

Source: Internet
Author: User

From: http://www.evget.com/zh-CN/Info/catalog/17325.html

Essential PDF in essential studio reporting edition is a. Net Library that can generate Adobe PDF files from your data. It has a mature object model that allows you to easily create PDF files in any. NET language. It does not depend on any external conditions. With the support of the PDF 3D annotation class, the essential PDF supports embedding 3D object sets (such as CAD software objects) in PDF files.

The following code example demonstrates how to embed a U3D file.

[C #]

// PDF 3D Annotation
Required 3dannotation annot = new required 3dannotation (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 trusted truetypefont (F, false );
Refreshing brush = new refreshing solidbrush (color. darkblue );
Required brush bgbrush = new required solidbrush (color. whitesmoke );
Gradient color = new gradient color (color. thistle );

Page. Graphics. drawrectangle (bgbrush, new rectanglef (10,270,150,150 ));

// PDF 3D appearance
Annot. Appearance = new paiappearance (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 ));

Required 3dprojection projection = new required 3dprojection ();
Projection. projectiontype = effec3dprojectiontype. perspective;

Projection. fieldofview = 10;
Projection. clipstyle = effec3dprojectionclipstyle. explicitnearfar;
Projection. nearclipdistance = 10;

Required 3dactivation activation = new required 3dactivation ();
Activation. activationmode = effec3dactivationmode. explicitactivation;
Activation. showtoolbar = false;
Annot. Activation = activation;

Required 3dbackground background = new required 3dbackground ();
Background. Color = color;

Required 3drendermode rendermode = new required 3drendermode ();
Rendermode. Style = %3drenderstyle. Solid;

Required 3dlighting lighting = new required 3dlighting ();
Lighting. Style = effec3dlightingstyle. headlamp;

// Create the default view.
When 3dprojection projection1 = new when 3dprojection (when 3dprojectiontype. Perspective );
Projection1.fieldofview = 50;
Projection1.clipstyle = effec3dprojectionclipstyle. explicitnearfar;
Projection1.nearclipdistance = 10;

Export 3dview defaultview = createview ("default view", new float [] {-0.382684f, clerk,-weight, 0.18024f, clerk, 0.980785f, 0.906366f, 0.37533f,-0.19509f,-weight, -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. required 3dannotation = new syncfusion. PDF. interactive. 20173dannotation (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. Unzip truetypefont (F, false)
Dim brush as syncfusion. pdf. Graphics. Merge brush = new syncfusion. pdf. Graphics. Merge solidbrush (color. darkblue)
Dim bgbrush as syncfusion. pdf. Graphics. Merge brush = new syncfusion. pdf. Graphics. Merge solidbrush (color. whitesmoke)
Dim color as syncfusion. pdf. Graphics. Merge color = new syncfusion. pdf. Graphics. Merge color (color. thistle)

Page. Graphics. drawrectangle (bgbrush, new rectanglef (10,270,150,150 ))

'Pdf 3D appearance
Annot. Appearance = new paiappearance (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. share3dprojection = new syncfusion. pdf. Interactive. share3dprojection ()
Projection. projectiontype = effec3dprojectiontype. Perspective

Projection. fieldofview = 10
Projection. clipstyle = effec3dprojectionclipstyle. explicitnearfar
Projection. nearclipdistance = 10

Dim activation as syncfusion. pdf. Interactive. share3dactivation = new syncfusion. pdf. Interactive. share3dactivation ()
Activation. activationmode = effec3dactivationmode. explicitactivation
Activation. showtoolbar = false
Annot. Activation = Activation

Dim background as syncfusion. pdf. Interactive. Fig = new syncfusion. pdf. Interactive. Fig 3dbackground ()
Background. Color = color

Dim rendermode as syncfusion. pdf. Interactive. ipv3drendermode = new syncfusion. pdf. Interactive. ipv3drendermode ()
Rendermode. Style = %3drenderstyle. Solid

Dim lighting as syncfusion. pdf. Interactive. share3dlighting = new syncfusion. pdf. Interactive. share3dlighting ()
Lighting. Style = effec3dlightingstyle. Headlamp

'Create the default view.
Dim projection1 as syncfusion. pdf. Interactive. effec3dprojection = new syncfusion. pdf. Interactive. effec3dprojection (effec3dprojectiontype. Perspective)
Projection1.fieldofview = 50
Projection1.clipstyle = effec3dprojectionclipstyle. explicitnearfar
Projection1.nearclipdistance = 10

Dim defaultview as syncfusion. PDF. interactive. export 3dview = createview ("default view", new single () {-0.382684f, clerk,-Clerk, 0.18024f, clerk, 0.980785f, 0.906366f, 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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.