Free Support Forum - aspose.com

Underline and strikethrough lost after focusing on the text in file saved with Aspose.PSD (C# .NET)

Hi!

We are processing the source.psd file from the attached archive using the following code:

AsposeLicenser.LoadLicense();
var sourceFile = @"d:\work\psd\source.psd";
var targetFile = @"d:\work\psd\target.psd";
using (var image = (PsdImage) Image.Load(sourceFile))
{
    var layers = image.Layers;
    var textLayer = (TextLayer) layers.Single(layer => layer is TextLayer);

    textLayer.TextData.Items[0].Style.Underline = true;
    textLayer.TextData.Items[1].Style.Strikethrough = true;

    textLayer.TextData.UpdateLayerData();

    image.Save(targetFile, new PsdOptions(image));
}

When the target.psd is opened, the desired formatting appears:
image.png (3.1 KB)

But when the text is focused in Photoshop using the Horizontal Type Tool, the underline and strikethourh formattings disappear and the target file looks like the source (this is not the case for other kinds of formatting):
image.png (2.9 KB)

Is this a bug, or are we doing something wrong?

files.zip (64.1 KB)

Thanks for any help!
Arnold

@arnoldbeilandevozon,

I have tested the sample files provided by you and have created a ticket with ID PSDNET-664 in our issue tracking system for further investigation and resolution. We will share the feedback with you as soon as the issue will be fixed.

Hi. Are there any updates on these?

@arnoldbeilandevozon

The concerned issue has been marked as resolved in upcoming Aspose.PSD for .NET 20.8. The following sample code will be used.

 string sourceFile = "source.psd";
            string outputFile = "output.psd";

            using (var image = (PsdImage)Image.Load(sourceFile))
            {
                var layers = image.Layers;
                var textLayer = (TextLayer)layers[1];

                textLayer.TextData.Items[0].Style.Underline = true;
                textLayer.TextData.Items[1].Style.Strikethrough = true;

                textLayer.TextData.UpdateLayerData();

                image.Save(outputFile, new PsdOptions(image));
            }

PSDNET664_1.zip (65.0 KB)

Hi!

Please note that because of Regression: Aspose.PSD 20.7.0 breaks font sizes for older files we will not be able to use newer versions until it’s fixed (we have tests failing because of the font sizes).

Regards,
Arnold

@arnoldbeilandevozon

We are sorry for your inconvenience. I have added a regression based ticket to address the issue shared in concerned thread. We request for your patience and will share the good news with you as soon as the issue will be fixed.

The issues you have found earlier (filed as PSDNET-664) have been fixed in this update.