We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

New line is lost in Textlayer

The error occurs when adding 2 portions, a title with a line break and the rest of the text. When this happens in Photoshop, when updating the textlayers, the line break is lost
beforeUpdate.jpg (113.2 KB)
afterUpdate.jpg (105.5 KB)
PSDTest3.zip (441.1 KB)
Code:

       string sourceFile = Directory.GetCurrentDirectory() + "/files-input/PSDTest3.psd";    
       string outputFile = Directory.GetCurrentDirectory() + "/files-output/Test_Output"; 
       PsdImage image = (PsdImage)Aspose.PSD.Image.Load(sourceFile);
       var layer2 = image.AddTextLayer("New layer", new Aspose.PSD.Rectangle(117, 150, 350, 200));
       var textDataTL = layer2.TextData;
        ITextStyle defaultStyleTL = textDataTL.ProducePortion().Style;

        ITextParagraph defaultParagraphTL = textDataTL.ProducePortion().Paragraph;

        ITextPortion[] newPortionsTL = textDataTL.ProducePortions(

        new string[] { "Tile\r", "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Qui dicta minus molestiae vel beatae natus" },

        defaultStyleTL,

        defaultParagraphTL);

        // Updating of default styles

        newPortionsTL[0].Style.FontSize = 14;

        newPortionsTL[1].Style.Leading = 20;

        newPortionsTL[1].Style.FontSize = 10;

        // Removing old text

        textDataTL.RemovePortion(0);

        // Addint new text portions

        foreach (var newPortion in newPortionsTL)

        {

            textDataTL.AddPortion(newPortion);

        }

        // Applying text update

        textDataTL.UpdateLayerData();
        image.Save(outputFile);

@cortega1234 I checked the issue, and can confirm it. I created and issue PSDNET-1403: Style of Paragraph is missed after the saving of file and updating of file by PS. This task will be investigated and fixed with high priority. When it will be fixed you’ll be notified with email from forum.

Any news about the issue? How can I create a new line without PS modifying it?

This task will be started this week.

Thanks for answering me, but we still have the same problem, any news?

@cortega1234
The task is in progress. It will be in 23.2.