Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active August 2, 2021 19:59
Show Gist options
  • Save aspose-com-gists/13267b3c65f32abbd9709e85efc0f31a to your computer and use it in GitHub Desktop.
Save aspose-com-gists/13267b3c65f32abbd9709e85efc0f31a to your computer and use it in GitHub Desktop.
Convert STL to PDF PNG Image Programmatically with C#
// Specify path for input STL file
string sourceFilePath = dataDir + "galeon.stl";
// Load input STL image
using (var cadImage = (CadImage)Image.Load(sourceFilePath))
{
// Initialize PdfOptions class instance
PdfOptions pdfOptions = new PdfOptions();
string outPath = sourceFilePath + "test.pdf";
// Convert STL to PDF
cadImage.Save(outPath, pdfOptions);
}
// Specify path for input STL file
string sourceFilePath = dataDir + "galeon.stl";
// Load input STL image
using (var cadImage = (CadImage)Image.Load(sourceFilePath))
{
// Initialize PngOptions class instance
PngOptions pngOptions = new PngOptions();
string outPath = sourceFilePath + "test.png";
// Convert STL to PNG
cadImage.Save(outPath, pngOptions);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment