Save a 3D Scene in the PDF
Contents
[
Hide
]
The
Scene
class of the Aspose.3D API represents a 3D scene. Developers can build a 3D scene by adding Camera, Light, polygons and various other entities. They can also now save a 3D scene in the PDF file format.
Aspose.3D for Python via .NET directly writes the information about the API and Version Number in output documents. For example, upon rendering a Drawing to PDF, Aspose.3D for Python via .NET populates Application
field with value ‘Aspose.3D’ and PDF Producer
field with value, e.g ‘Aspose.3D 17.9’.
Please note that you cannot instruct Aspose.Diagram for Python via .NET API to change or remove this information from output Documents.
Create a 3D PDF with a Cylinder, and Rendered in Shaded Illustration Mode with CAD Optimized Lighting
The Save method of the Scene
class allows to save a 3D scene in the PDF format. Developers may load any 3D supported file or build a new 3D scene, they can save a 3D scene in the PDF format as shown in this code example:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from aspose.threed import Scene | |
from aspose.threed.entities import Cylinder | |
from aspose.threed.shading import PhongMaterial | |
from aspose.threed.formats import PdfSaveOptions, PdfLightingScheme, PdfRenderMode | |
# Create a new scene | |
scene = Scene() | |
# Create a cylinder child node | |
cylinder = scene.root_node.create_child_node("cylinder", Cylinder()) | |
cylinder.material = PhongMaterial() | |
# Set rendering mode and lighting scheme | |
opt = PdfSaveOptions() | |
opt.lighting_scheme = PdfLightingScheme.CAD | |
opt.render_mode = PdfRenderMode.SHADED_ILLUSTRATION | |
# Save in the PDF format | |
scene.save("output_out.pdf", opt) |