Free Support Forum - aspose.com

How to write \ character to PSD file using Aspose.Imaging for .NET

Hi,
it seems that when you try to update text layer content with \ (backslash) character, resulting file cannot be opened in Photoshop.
Is this a known issue - is there any escape you need to use when writing this character?
Regards

@rlaskowski.sdl,

I have observed the issue shared by you and request you to please share the used sample code along with source and generated PSD files for reference. We will investigate the issue further on our end to help you out.

So using:
private static void UpdateText(string filePath, string newText)
{
using (var image = Image.Load(filePath))
{
if (!(image is PsdImage)) return;

            var psdImage = (PsdImage)image;
            var layers = psdImage.Layers;

            for (var index = layers.Length - 1; index >= 0; index--)
            {
                var layer = layers[index];

                if (!(layer is TextLayer)) continue;

                var textLayer = (TextLayer)layer;
                textLayer.UpdateText("\\()");
            }

            var imageOptions = new PsdOptions(psdImage);

            var fileName = Path.GetFileName(filePath);
            var outputFilePath = Path.GetDirectoryName(filePath) + "\\target_" + fileName;
            psdImage.Save(outputFilePath, imageOptions);
        }
    }

You will get file which cannot be opened in Photoshop - problematic are \ and ()
AsposeBugs.zip (28.5 KB)

@rlaskowski.sdl,

I have observed the inforamtion shared by you and an issue with ID IMAGINGNET-3023 has been logged in our issue tracking system to further investigate and resolve the issue. For the time being, I also suugest you to please try adding the backslash using Unicode in your application.

e.g “Hello \u000b World”

HI,
using unicode escape doesn’t solve anything.
Do you have any estimate for fixing this issue? It basically means we cannot use the library in production at all.
Regards

@rlaskowski.sdl,

I have observed your comments. I like to inform that we will investigate issue in detail and share details regarding ETA with you soon. I request for your patience.

Additional testing revealed some more issues with other characters - still trying to get more details but it seems also different types of brakets ([]{}) can cause the same issue.
Also, some Korean and Chinese characters seem to have same impact.

@rlaskowski.sdl,

Thank you for sharing the detailed information with us. We will share the good news with you as soon as the issue will be fixed.

HI,
we identified some of the problematic Asian characters - for sure not full list but at least some - should i post them here or you want new issue to be created?

@rlaskowski.sdl,

I request you to please log a separate issue in new thread with all necessary details. We will investigate that on our end to help you further.

Hi,
do you have any update on the problem with \ characters? I see that you released new version which should solve asian characters, but not sure about this particular issue?
Regards

@rlaskowski.sdl,

I have verified from our issue tracking system and like to share that issue is tentatively will be resolved in upcoming Aspose.Imaging 18.9. We will share the information with you as soon as the issue will be fixed.

Hi,
it actually looks like this issue is solved, but File cannot be opened when certain Asian characters are added to text layers which you pointed out as fixed is not,
Can you please check it again?

@rlaskowski.sdl,

Thank you for sharing your feedback. For issue related to second thread that you have specified, I am going to respond to it in concerned thread.