How can I change the properties of Point Text or Paragraph Text in a TextLayer through the psd java library?
@sewang please check this API TextLayer.TextBoundBox | Aspose.PSD for .NET API Reference
Here is a Java Example:
try (PsdImage psdImage = (PsdImage) Image.load(sourceFile)) {
TextLayer noBoundsTextLayer = (TextLayer) psdImage.getLayers()[1];
TextLayer boundsTextLayer = (TextLayer) psdImage.getLayers()[2];
boundsTextLayer.setTextBoundBox(RectangleF.getEmpty());
noBoundsTextLayer.setTextBoundBox(new RectangleF(0, 0, 200, 100));
TextLayer newTextLayerNoTextBox = psdImage.addTextLayer(
"New text - no text box",
new Rectangle(10, 300, 0, 0)
);
TextLayer newTextLayerWithTextBox = psdImage.addTextLayer(
"New text - with text box",
new Rectangle(10, 400, 400, 100)
);
boundsTextLayer.getTextData().updateLayerData();
noBoundsTextLayer.getTextData().updateLayerData();
psdImage.save(outputFile);
} catch (Exception e) {
e.printStackTrace();
}
Also, please check IText API. It can be useful for Text Editing.
Do setLeft, setRight, setTop, setBottom, and setTextBoundBox work differently for TextLayer? When I used setXXX, the BoundBox was not created properly.
Could you please provide input file, code snippet to reprduce issue and the expected result? We need to investigate this