Importieren Sie 3D Szenen und Inhalte aus einem PDF in C#
Contents
[
Hide
]
Die
Scene
-Klasse der Aspose.3D API repräsentiert eine 3D-Szene. Entwickler können 3D Szenen und Inhalte aus einer PDF-Datei extrahieren.
Offene Szene aus einem Passwort geschützt PDF
Die Open
-Methode der Scene
-Klasse erlaubt es, die 3D-Szene aus einer Eingabe-PDF-Datei zu laden. Entwickler können auch ein Passwort für die geschützten PDFs mit der PdfLoadOptions
-Klasse anwenden, wie in diesem C#-Code beispiel gezeigt:
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
// For complete examples and data files, please go to https://github.com/aspose-3d/Aspose.3D-for-.NET | |
// Create a new scene | |
Scene scene = new Scene(); | |
// Use loading options and apply password | |
PdfLoadOptions opt = new PdfLoadOptions() { Password = Encoding.UTF8.GetBytes("password") }; | |
// Open scene | |
scene.Open("House_Design.pdf", opt); |
Extrahieren Sie alle Roh-3D-Inhalte aus einem PDF
Die Extract-Methode der PdfFormat
-Klasse ermöglicht es, 3D-Inhalte aus einer PDF-Datei zu extrahieren. Entwickler können die Inhalte durchgehen und sie in den separaten Dateien speichern, wie in diesem Beispiel für C#-Code gezeigt:
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
// For complete examples and data files, please go to https://github.com/aspose-3d/Aspose.3D-for-.NET | |
// The path to the documents directory. | |
byte[] password = null; | |
// Extract 3D contents | |
List<byte[]> contents = FileFormat.PDF.Extract("House_Design.pdf", password); | |
int i = 1; | |
// Iterate through the contents and in separate 3D files | |
foreach (byte[] content in contents) | |
{ | |
string fileName = "3d-" + (i++); | |
File.WriteAllBytes(fileName, content); | |
} |
Extrahieren Sie alle 3D-Szenen und speichern Sie sie in unterstützten 3D-Formaten
Die ExtractScene
-Methode der PdfFormat
-Klasse ermöglicht es, 3D-Szenen aus einer PDF-Datei zu extrahieren. Entwickler können die Szenen durchgehen und sie in den unterstützten 3D-Dateiformaten speichern, wie in diesem C#-Code beispiel gezeigt:
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
// For complete examples and data files, please go to https://github.com/aspose-3d/Aspose.3D-for-.NET | |
byte[] password = null; | |
List<Scene> scenes = FileFormat.PDF.ExtractScene("House_Design.pdf", password); | |
int i = 1; | |
// Iterate through the scenes and save in 3D files | |
foreach (Scene scene in scenes) | |
{ | |
string fileName = "3d-" + (i++) + ".fbx"; | |
scene.Save(RunExamples.GetOutputFilePath(fileName), FileFormat.FBX7400ASCII); | |
} |
Alle unterstützten 3D-Dateiformate sind auf der Produkt übersicht-Seite aufgeführt.