Aspose.PSD - text wrapped on shape not being maintained

ConsoleApp1.zip (237.3 KB)

Attached is example code of trying to fill in some text layers for a PSD. One of the layers - DisplayName - is wrapped on a circle. The code properly replaces the text for the layer, but it is no longer wrapped as expected. The source code includes the PSD that is being used that works in photoshop. Here is example of the expected output:

IN.png (26.1 KB)

@omnant

Cause

The issue you’re experiencing with the text not being wrapped correctly on a circular shape in your PSD file is likely due to the way the text layer is being updated. When you replace the text in a text layer, the wrapping settings may not be preserved, leading to the text not following the intended path.

Solution

To maintain the text wrapping on a shape, ensure that you are using the correct methods to update the text layer. Specifically, utilize the TextLayer class and its associated properties to manage text portions effectively. This allows you to specify the wrapping and formatting options that align with your original design.

Code

Here’s an example of how to update a text layer while preserving the wrapping:

from aspose.psd import Color
from aspose.psd.fileformats.psd import PsdImage
from aspose.psd.fileformats.psd.layers import TextLayer
from aspose.pycore import cast

def update_text_layer(source_file, output_file, new_text):
    with PsdImage.load(source_file) as img:
        text_layer = cast(TextLayer, img.layers[0])  # Adjust index as needed
        text_layer.update_text(new_text, Color.red)  # Update text and color
        text_layer.text_data.update_layer_data()  # Ensure to update layer data
        img.save(output_file)

# Usage
update_text_layer("path/to/your/source.psd", "path/to/your/output.psd", "New Wrapped Text")

Make sure to replace "path/to/your/source.psd" and "path/to/your/output.psd" with the actual file paths.

Next Steps

  1. Test the provided code with your PSD file to see if the text wraps correctly on the shape.
  2. If the issue persists, check the properties of the text layer to ensure that the wrapping settings are correctly configured.
  3. Review the documentation on text layer manipulation for more advanced options if needed.

Please let me know if this resolves your issue or if you need further assistance!

I am writing this in .NET, here is the code that I am doing to update the text that is not maintaining the wrapping.

using Aspose.PSD;
using Aspose.PSD.FileFormats.Png;
using Aspose.PSD.FileFormats.Psd;
using Aspose.PSD.FileFormats.Psd.Layers;
using Aspose.PSD.ImageOptions;

Aspose.PSD.License license = new Aspose.PSD.License();
license.SetLicense("Aspose.PSD.lic");

using (PsdImage psdImage = (PsdImage)Image.Load("IN.psd"))
{
    foreach (Layer layer in psdImage.Layers)
    {
        if (layer is TextLayer textLayer)
        {
            if (textLayer.DisplayName == "DisplayName")
            {
                textLayer.UpdateText("CHAD DUNHAM");
                textLayer.TextData.UpdateLayerData();
            }

            //
            if (textLayer.DisplayName == "LicenseNumber")
            {
                textLayer.UpdateText("00000");
                textLayer.TextData.UpdateLayerData();
            }
        }
    }
    // Export as PNG
    PngOptions pngOptions = new PngOptions()
    {
        ColorType = PngColorType.TruecolorWithAlpha,
        BitDepth = 8, // 8-bit per channel
        Progressive = false
    };

    psdImage.Save("IN.png", pngOptions);
}

@omnant
At this moment, Aspose.PSD doesn’t support rendering text over the circle. I’ve increased priority of this task because of big amount of requests this month.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PSDNET-2256

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Thanks for the additional information. Is there there a timeline on this feature? Unfortunately a lot of our PSDs have this need…

@omnant I’ve increased priority for this task. It will be implemented in 2025/Q3

Just checking to see if there was an update on timing on this feature?

@omnant this issue will not be fixed in Aspose.PSD 25.9, but in the 25.10 it’s still possible.

Do you have an anticipated date for that release?

@omnant this task is planned, but it’s not in progress at the moment, so I can’t give the any accurate ETA. Release 25.10 will be made in the end of September.

I wanted to check in and see if this feature is still expected later this month.

@omnant the task is planned for the near future, but work on it has not yet begun. I’ll text you via forum when this task will be in progress.