You can read all details at: Convert PLT to PDF or Image Programmatically using Java
Last active
January 26, 2021 20:41
-
-
Save aspose-com-gists/f736d846f1913858d87f95f92e453181 to your computer and use it in GitHub Desktop.
Convert PLT to PDF or PNG JPG Image Programmatically using 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
// Load input PLT file | |
Image image = Image.load(PLTPathToFile); | |
// Setting Image Options with ImageOptionsBase | |
ImageOptionsBase imageOptions = new JpegOptions(); | |
// Initialize CadRasterizationOptions object | |
CadRasterizationOptions cadRasterizationOptions = new CadRasterizationOptions(); | |
cadRasterizationOptions.setDrawType(CadDrawTypeMode.UseObjectColor); | |
cadRasterizationOptions.setPageHeight(1600); | |
cadRasterizationOptions.setPageWidth(1600); | |
cadRasterizationOptions.setBackgroundColor(Color.getGray()); | |
imageOptions.setVectorRasterizationOptions(cadRasterizationOptions); | |
// Save PLT to output Image PNG, JPG, etc | |
image.save(dataDir + "50states.jpg", imageOptions); |
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
// Load input PLT file | |
Image image = Image.load(PLTPathToFile); | |
// Setting PdfOptions object | |
PdfOptions pdfOptions = new PdfOptions(); | |
// Specify CadRasterizationOptions instance | |
CadRasterizationOptions cadRasterizationOptions = new CadRasterizationOptions(); | |
cadRasterizationOptions.setDrawType(CadDrawTypeMode.UseObjectColor); | |
cadRasterizationOptions.setPageHeight(1600); | |
cadRasterizationOptions.setPageWidth(1600); | |
cadRasterizationOptions.setBackgroundColor(Color.getGray()); | |
pdfOptions.setVectorRasterizationOptions(cadRasterizationOptions); | |
// Saving PLT to output PDF | |
image.save(dataDir + "50states.pdf", pdfOptions); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment