'''' This code is part of Document Solutions for PDF .NET demos.'' Copyright (c) MESCIUS inc. All rights reserved.''ImportsSystem.IOImportsSystem.DrawingImportsGrapeCity.Documents.PdfImportsGrapeCity.Documents.Pdf.Annotations '' This demo shows how to embed an interactive 3D model in a PDF using Annotation3D.PublicClassAnnotation3DPublicFunctionCreatePDF(ByVal stream AsStream) AsIntegerDim doc = NewGcPdfDocument()Dim page = doc.NewPage() Dim 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):Dim modelPath = Path.Combine("Resources", "3DModels", "plane64x64_base.u3d")Using modelStream = File.OpenRead(modelPath)' Add a 3D annotation showing the model, activated when the page becomes visible:Dim m3d = NewModel3DAnnotationWith { .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)EndUsing Return doc.Pages.CountEndFunctionEndClass