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.

Thank you for letting me know, will the problem be solved during the following month by February 2023? and will be a new update in the next version?

@cortega1234 issue is in work, and will be in 23.2 release.

Is the problem resolved in the latest version? I don’t find PSDNET-1403 in release notes of 23.2

@cortega1234 this bug is already fixed, but unfortunately the fix will be released in 23.3.

The issues you have found earlier (filed as PSDNET-1403) have been fixed in this update. This message was posted using Bugs notification tool by yaroslav.lisovskyi

I can confirm that issue PSDNET-1403 has been fixed, thank you.

1 Like