Hi! We’ve been testing Aspose.PSD 24.7.0 and 24.8.0 both produce a new error for a particular document. It works on 24.6.0 fyi
The code is the following:
var psdImage = (PsdImage)Image.Load(psdFilePath);
foreach (var layer in psdImage.Layers)
{
if (layer is TextLayer textLayer)
{
Stopwatch w = Stopwatch.StartNew();
var newPortion = textLayer.TextData.ProducePortions(
new[] { "adding text" },
null,
null
).First();
textLayer.TextData.AddPortion(newPortion);
textLayer.TextData.UpdateLayerData();
w.Stop();
Console.WriteLine($"Portion added, time: {w}");
}
}
Error at some point in the iteration of layers:
System.ArgumentOutOfRangeException
HResult=0x80131502
Message=Index was out of range. Must be non-negative and less than the size of the collection. (Parameter ‘index’)
Source=System.Private.CoreLib
StackTrace:
at System.ThrowHelper.ThrowArgumentOutOfRange_IndexMustBeLessException() in /_/src/libraries/System.Private.CoreLib/src/System/ThrowHelper.cs:line 118
at .(String , Int32 )
at .[TResult](String , Int32 )
at .( )
at …ctor(TextLayer )
at Aspose.PSD.FileFormats.Psd.Layers.TextLayer.get_TextData()
at Program.TestPSD(Int32 index) in C:\code\Slides\Slides\Program.cs:line 69
at Program.Main() in C:\code\Slides\Slides\Program.cs:line 28
image.png (28.3 KB)
file causing the issue:
__Brochure_Template_PSD_2.7z (1.2 MB)