.net library to change text on particular layer in PSD file

Hi! Need your .net library to change text on particular layer in PSD file. Just to keep text style parameters remained the same (color, size etc), as well as text location on image. Is that possible?

Also is there a demo? Or can I buy license for 1 month for testing and how much does it cost?

I already found code that works.

public static void ReplaceTextInLayer(string psdFilePath, string outputJpegFilePath, string layerName, string newText)
{
    // Instantiate the License class
    Aspose.PSD.License license = new Aspose.PSD.License();

    // Pass the name of the embedded license file
    license.SetLicense("Aspose.PSD.NET.lic");

    // Load an existing PSD file
    using (PsdImage psdImage = (PsdImage)Image.Load(psdFilePath))
    {
        foreach (var layer in psdImage.Layers)
        {
            // Check if layer is a text layer and has the specified name
            if (layer is TextLayer && layer.Name == layerName)
            {
                TextLayer textLayer = (TextLayer)layer;
                // Replace the text in the text layer
                textLayer.UpdateText(newText);
                break; // Remove the break if you expect multiple layers with the same name and want to update all
            }
        }

        // Create an instance of JpegOptions and set its various properties
        Aspose.PSD.ImageOptions.JpegOptions options = new Aspose.PSD.ImageOptions.JpegOptions();

        // You can set the quality of the output JPEG here, 100 being the highest
        options.Quality = 100;

        // Save the flattened image as a JPEG file
        psdImage.Save(outputJpegFilePath, options);
    }
}

However strange thing happens. See my pdf:
image.jpg (62,7 KB)

after executing this method to edit “read more” text, after saving to jpeg I see it moved somehow the text on text layer above. Why could that happen?

image.jpg (51,5 KB)

@lofti you can order temporary license for this Temporary License - Purchase - aspose.com.

I can move this topic to the “Sales” category. Sales team can help with the best choice. Also, if you only need minimum Aspose.PSD Functionality you can check Aspose.PSD Plugins Process PSD, PSB, AI files with API. Graphics Editor can be suitable for your case PSD Graphics Editor via .NET

For your task can be used simple call of TextLayer.UpdateText()

Examples for your case and for more complex cases can be found here Working With Text Layers|Documentation

Please also check GitHub - aspose-psd/Aspose.PSD-for-.NET: Aspose.PSD for .NET examples, plugins and showcases - here can be found a lot of examples that can be easily executed.

I already arranged that with sales team. Thank you!

as you can see in the code above, I actually use it. however what can be the reason of the higher text shifting?

@lofti please check if the font from your file is installed. Also, There are can be minor differences in position of Text because of Aspose.PSD Text Engine differences. And there are additional special cases. Text in PSD Layer can be aligned by left, center, top etc. If you change text, Aspose.PSD will try to save the position of Left-Top Corner of Text Layer