Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Created January 18, 2021 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-com-gists/d97bd34e06bb77f2b2a1e7d773b41039 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/d97bd34e06bb77f2b2a1e7d773b41039 to your computer and use it in GitHub Desktop.
Convert PLT to PDF, JPEG, or PNG File Programmatically in C#
// The path to the documents directory.
string sourceFilePath = MyDir + "50states.plt";
// Load input PLT file
using (Image cadImage = Image.Load(sourceFilePath))
{
// Initilize JpegOptions class instance
ImageOptionsBase imageOptions = new JpegOptions();
// Specify CadRasterizationOptions properties
CadRasterizationOptions options = new CadRasterizationOptions
{
PageHeight = 500,
PageWidth = 1000,
};
imageOptions.VectorRasterizationOptions = options;
// Convert PLT to JPEG image format
cadImage.Save(MyDir+ "50states.jpg", imageOptions);
}
string sourceFilePath = MyDir + "50states.plt";
// Load input PLT file
using (Image cadImage = Image.Load(sourceFilePath))
{
// Set different properties for CadRasterizationOptions
CadRasterizationOptions options = new CadRasterizationOptions
{
PageHeight = 1600,
PageWidth = 1600,
DrawType= CadDrawTypeMode.UseObjectColor,
BackgroundColor=Color.White
};
// Specify PdfOptions for rendering
PdfOptions pdfOptions = new PdfOptions();
pdfOptions.VectorRasterizationOptions = options;
// Convert PLT to PDF file and save output document
cadImage.Save(MyDir+ "50states.pdf", pdfOptions);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment