Manipulating FODG files
Contents
[
Hide
]
Load of FODG file
Aspose.Imaging supports load of FODG file format.
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
String baseFolder = "D:\\"; | |
String inputFile = baseFolder + "sample.fodg"; | |
String outputFile = inputFile + ".png"; | |
try (Image image = Image.load(inputFile)) | |
{ | |
PngOptions options = new PngOptions(); | |
OdgRasterizationOptions vectorOptions = new OdgRasterizationOptions(); | |
vectorOptions.setPageSize(Size.to_SizeF(image.Size)); | |
options.setVectorRasterizationOptions(vectorOptions); | |
image.save(outputFile, options); | |
} |
Improve default font option usage on Linux
As Aspose.Imaging supports default font setting, it needs to be enhanced to work on Linux too. The example below shows how to use default font option on Linux.
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
//Please create folder - "fonts" in project, and add in this folder required fonts. | |
//And execute this code: | |
String currentFolder = "."; // here you can set full path to your fonts folder. | |
FontSettings.setFontsFolder(currentFolder + "fonts"); | |
FontSettings.setGetSystemAlternativeFont(false); | |
exportToPng("missing-font2.odg", "Arial", "arial.png"); | |
exportToPng("missing-font2.odg", "Courier New", "courier.png"); | |
private static void exportToPng(String filePath, String defaultFontName, String outfileName) | |
{ | |
FontSettings.setDefaultFontName(defaultFontName); | |
try (com.aspose.imaging.Image document = com.aspose.imaging.Load(filePath)) | |
{ | |
PngOptions saveOptions = new PngOptions(); | |
OdgRasterizationOptions vectorOptions = new OdgRasterizationOptions(); | |
vectorOptions.setPageWidth(1000); | |
vectorOptions.setPageHeight(1000); | |
saveOptions.setVectorRasterizationOptions(vectorOptions); | |
document.save(outfileName, saveOptions); | |
} | |
} |