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

Free Support Forum - aspose.com

AddText Layer - Some textlayers need to be updated

I have the problem that when I open the psd file in photoshop it tells me that “some textlayers need to be updated” . What I am doing is taking the measurements of another layer “#lsak_007#cl” and
having that layer as a reference, is to add a centered text layer
Code:

            string sourceFile = "C:\\TestPSDPrueba2.psd";

            string outputFile = "C:\\3_Output_Test_PSD_2daPruebas_Punto_3.psd";

            var left = 0;

            var right = 0;

            var top = 0;

            var bottom = 0;

            var witdh = 0;

            var height = 0;

            Size size = new Size();

            PsdImage img = (PsdImage)Image.Load(sourceFile);

            foreach (var layer in img.Layers)

            {

                if (layer.DisplayName == "#lsak_007#cl")

                {


                    size = layer.Size;

                    left = layer.Left;

                    right = layer.Right;

                    top = layer.Top;

                    bottom = layer.Bottom;

                    witdh = layer.Width;

                    height = layer.Height;

                }

            }

            var medio = (height / 2);

            // var resta = medio - (medio / 2);

            Point location = new Point(left, top);

            // Add a text layer

          TextLayer textLayer = img.AddTextLayer("test", new Rectangle(left, right, size.Width, size.Height));

            IText textData = textLayer.TextData;

            ITextStyle defaultStyle = textData.ProducePortion().Style;

            ITextParagraph defaultParagraph = textData.ProducePortion().Paragraph;

            // defaultStyle.FillColor = Color.DimGray;

            // defaultStyle.FontSize = 51;

            // set text

            ITextPortion[] newPortions = textData.ProducePortions(new string[]

            {

                    "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Qui dicta minus molestiae vel beatae natus eveniet ratione temporibus.","Aalias officiis assumenda officia quibusdam delenit. Beatae natus eveniet ratione temporibus aperiam harum alias officiis assumenda officia quibusdam delenit beatae natus eveniet ratione temporibus aperiam harum alias officiis assumenda officia quibusdam delenit officia quibusdam delenit officia quibusdam delenit officia quibusdam delenit"

            },

            defaultStyle,

            defaultParagraph);

            newPortions[0].Style.FauxBold = true;

            newPortions[0].Style.FillColor = Color.Red;

            newPortions[0].Style.FontName = FontSettings.GetAdobeFontName("Segoe UI Semibold");

            newPortions[1].Style.FillColor = Color.Blue;

            newPortions[1].Style.FontName = FontSettings.GetAdobeFontName("Segoe UI Semibold");

            //             //add portion

            // textLayer.TextData.RemovePortion(0);

            textLayer.TextData.AddPortion(newPortions[0]);

            textLayer.TextData.UpdateLayerData();

            textLayer.TextData.AddPortion(newPortions[1]);

            textLayer.TextData.UpdateLayerData();

            img.Save(outputFile);

@cortega1234 Rendering of Aspose.PSD is slightly different from rendering of PS. So, I think this message will be in 99% text updating processes. Photoshop always rerender any data that it can on the opening. I created the issue: PSDNET-1374: Error on opening of PSD file. Photoshop says: some textlayers need to be updated. But I can not guarantee that it will be fixed.

Could you please attach the input TestPSDPrueba2.psd file to help us to reproduce your error.

TestPSDPrueba2.zip (449.4 KB)
Thanks for you reply. I attach the file estPSDPrueba2.psd.
So in any text update, would that photoshop message always appear?

@cortega1234 The message will appear not always but quite often, it depends on many different styles and formatting settings.

According to the code with which I have shown, what style or formatting setting would be causing this message?

@cortega1234 Not sure exactly, because currently, our support of styling and formatting text features is not full. So in supported cases, you may be right and Photoshop always will want to update the text by itself.

With a plain text without styles or format options, but with a long text the same thing also happens:
Code:
var layer1 = img.AddTextLayer(“Long Text Added: Lorem ipsum dolor sit amet, consectetur adipisicing elit. Qui dicta minus”, new Rectangle(0, 200, 420, 250));

I hope the issue generated (PSDNET-1374: Error on opening of PSD file) can be resolved quickly. Do you have an estimate of when it can be resolved?

@cortega1234 Any text has default style and format settings so they apply even if you did not change them.
This issue processing was planned for Feb 2023.

The resolution is still planning for Feb 2023? I still have the same problem

@cortega1234 We plan investigation on February, but as I wrote before, there is no guarantee that we will be able to fix it.