Browse our Products
Aspose.PSD for Java 21.7 - Release Notes
This page contains release notes for Aspose.PSD for Java 21.7
Key | Summary | Category |
---|---|---|
PSDJAVA-362 | Support of the font editing using TextPortions | Feature |
PSDJAVA-363 | Aspose.PSD 21.6: ImageSaveException on an attempt to convert PSD to PNG | Bug |
Public API Changes
Added APIs:
- M:com.aspose.psd.fileformats.psd.layers.text.ITextStyle.getFontName
- M:com.aspose.psd.fileformats.psd.layers.text.ITextStyle.setFontName(java.lang.String)
- M:com.aspose.psd.FontSettings.getAdobeFontName(java.lang.String)
Removed APIs:
- None
Usage examples:
PSDJAVA-362. Support of the font editing using TextPortions
String outputFilePng = "result_fontEditTest.png";
String outputFilePsd = "fontEditTest.psd";
PsdImage image = new PsdImage(500, 500);
try {
FillLayer backgroundFillLayer = FillLayer.createInstance(FillType.Color);
((IColorFillSettings) backgroundFillLayer.getFillSettings()).setColor(Color.getWhite());
image.addLayer(backgroundFillLayer);
TextLayer textLayer = image.addTextLayer("Text 1", new Rectangle(10, 35, image.getWidth(), 35));
ITextPortion firstPortion = textLayer.getTextData().getItems()[0];
firstPortion.getStyle().setFontName(FontSettings.getAdobeFontName("Comic Sans MS"));
ITextPortion secondPortion = textLayer.getTextData().producePortion();
secondPortion.setText("Text 2");
secondPortion.getParagraph().apply(firstPortion.getParagraph());
secondPortion.getStyle().apply(firstPortion.getStyle());
secondPortion.getStyle().setFontName(FontSettings.getAdobeFontName("Arial"));
textLayer.getTextData().addPortion(secondPortion);
textLayer.getTextData().updateLayerData();
image.save(outputFilePng, new PngOptions());
image.save(outputFilePsd);
} finally {
image.dispose();
}
PsdImage imageOutput = (PsdImage) Image.load(outputFilePsd);
try {
TextLayer textLayer = (TextLayer) imageOutput.getLayers()[2];
String adobeFontName1 = FontSettings.getAdobeFontName("Comic Sans MS");
String adobeFontName2 = FontSettings.getAdobeFontName("Arial");
AssertAreEqual(adobeFontName1, textLayer.getTextData().getItems()[0].getStyle().getFontName());
AssertAreEqual(adobeFontName2, textLayer.getTextData().getItems()[1].getStyle().getFontName());
} finally {
imageOutput.dispose();
}
PSDJAVA-363. Aspose.PSD 21.6: ImageSaveException on an attempt to convert PSD to PNG
String srcFile = "input.psd";
String output = "output.png";
Image image = Image.load(srcFile);
try {
image.save(output, new PngOptions());
} finally {
image.dispose();
}