//// This code is part of Document Solutions for PDF .NET demos.// Copyright (c) MESCIUS inc. All rights reserved.//usingSystem.IO;usingSystem.Drawing;usingGrapeCity.Documents.Pdf;usingGrapeCity.Documents.Pdf.Annotations;usingDsPdfWeb.Demos.Common; namespaceDsPdfWeb.Demos.Basics{// This demo shows how to embed an interactive 3D model in a PDF using Annotation3D.publicclassAnnotation3D {publicintCreatePDF(Stream stream) {var doc = newGcPdfDocument();var page = doc.NewPage(); var rc = Util.AddNote("The rectangle below is a Model3DAnnotation containing a 3D model. " +"It activates automatically when this page becomes visible, but can only be viewed interactively " +"in a PDF reader with native 3D support, such as Adobe Acrobat/Reader.", page); // Load the 3D model (U3D format):var modelPath = Path.Combine("Resources", "3DModels", "plane64x64_base.u3d");usingvar modelStream = File.OpenRead(modelPath); // Add a 3D annotation showing the model, activated when the page becomes visible:var m3d = newModel3DAnnotation {Stream = newModel3DStream(modelStream, Model3DStreamFormat.U3D),ActivationCondition = Model3DActivationCondition.PageBecomesVisible,DeactivationCondition = Model3DDeactivationCondition.PageBecomesInvisible,Page = page,Rect = newRectangleF(rc.X, rc.Bottom + 18, 72 * 5, 72 * 4) }; doc.Save(stream);return doc.Pages.Count; } }}