Related blog post: How to View STL Files in Java
Last active
January 7, 2022 13:21
-
-
Save GroupDocsGists/f82b9836c8c4781963cb6565badc911d to your computer and use it in GitHub Desktop.
View STL File as HTML, PDF, JPG or PNG in Java
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
// Render STL files to HTML with embedded resources using Java | |
try (Viewer viewer = new Viewer("path/input.stl")) { | |
HtmlViewOptions options = HtmlViewOptions.forEmbeddedResources("path/stl-output.html"); | |
viewer.view(options); | |
} |
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
// Render STL files to JPG in Java | |
try (Viewer viewer = new Viewer("path/input.stl")) { | |
JpgViewOptions options = new JpgViewOptions("path/stl-output.jpg"); | |
viewer.view(options); | |
} |
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
// Render STL files to PDF in Java | |
try (Viewer viewer = new Viewer("path/input.stl")) { | |
PdfViewOptions options = new PdfViewOptions("path/stl-output.pdf"); | |
viewer.view(options); | |
} |
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
// Render STL files to PNG in Java | |
try (Viewer viewer = new Viewer("path/input.stl")) { | |
PngViewOptions options = new PngViewOptions("path/stl-output.png"); | |
viewer.view(options); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment