STL to PDF PNG Image

STL files are used to show the geometry of 3D surfaces. However, only a few CAD-related applications support viewing or working with STL files. Therefore, you may need to convert STL files to a PDF or a PNG image. It will let you overview the file in many operating systems and environments because PDF or image file formats are widely supported. Let us walk through the following sections to find more details:

STL to PNG Image or PDF Conversion – Java API Installation

STL files are also known as stereolithographic files as they are used to store 3D geometrical information. You can convert the STL file with Aspose.CAD for Java API. You can easily utilize the STL conversion feature without needing any other 3rd party application. Simply configure your Java environment by downloading the JAR file from the Downloads section, or with the following specifications in your Maven-based applications:

Repository:

<repositories>
    <repository>
        <id>AsposeJavaAPI</id>
        <name>Aspose Java API</name>
        <url>http://repository.aspose.com/repo/</url>
    </repository>
</repositories>

Dependency:

 <dependencies>
    <dependency>
        <groupId>com.aspose</groupId>
        <artifactId>aspose-cad</artifactId>
        <version>20.12</version>        
   </dependency>
</dependencies>

Convert STL to PDF Programmatically using Java

You can follow the following steps for converting STL files to PDF programmatically using Java:

  1. Specify the path for the input STL file.
  2. Load input STL file with CadImage class object.
  3. Initialize PdfOptions class instance.
  4. Convert STL to PDF.

The code below shows how to convert STL to PDF programmatically with Java:

Convert STL to PNG Image Programmatically with Java

Please use the following steps for converting STL file to PNG image in your Java applications:

  1. Load input STL image.
  2. Initialize PngOptions class instance.
  3. Convert STL to PNG image.

The following code demonstrates how to convert STL to PNG image programmatically using Java:

Conclusion

In conclusion, you have learned the conversion of STL files to different file formats including PDF documents and PNG images programmatically using Java. This article is a step-by-step guide that discusses API configuration as well as its use in your applications. You can explore several other features by taking a look at the API Documentation. Furthermore, in case of any concerns, please feel free to reach us anytime at the Free Support Forum. We would love to hear back from you!

See Also