Index was outside the bounds of the array error during contents resize

Attached is a file with a single page, that when resized causes an “Index was outside the bounds of the array.” error.

The stack is
at Aspose.Pdf.Color.ToRgb()
at Aspose.Pdf.Annotations.Annotation.#=zurUkQ00UTxIo()
at Aspose.Pdf.Annotations.FreeTextAnnotation.#=zyBb$2P4=(#=zdxRj31oo2pge #=zS2D$dsAQzkoLsa$CdQ==, Annotation #=zUsKPmR4=)
at Aspose.Pdf.Annotations.FreeTextAnnotation.#=zXIcVooW4t93P(#=zdxRj31oo2pge #=zsvaRCXU=, Annotation #=zUsKPmR4=)
at Aspose.Pdf.Annotations.Annotation.#=zuV3cqvg=(Annotation #=zUsKPmR4=)
at Aspose.Pdf.Annotations.Annotation.#=zmbgUSwtmmjAk0GWGP9x7maM=()
at Aspose.Pdf.Annotations.Annotation.ChangeAfterResize(Matrix transform)
at Aspose.Pdf.Facades.PdfFileEditor.ResizeContents(Document source, Int32[] pages, ContentsResizeParameters parameters)
at AsposeTestHyperlinkAndAccessibility.Form1.ScenarioZooming2() in C:\Sandpit\AsposeTestHyperlinkAndAccessibility\AsposeTestHyperlinkAndAccessibility\Form1.vb:line 130

The original document was 10 pages and the other 9 pages caused no issue. Those pages have not been included.

The code to repro this is
Dim loStream As New MemoryStream
Dim buffer As Byte() = File.ReadAllBytes(“C:\Root Files\QldClient\Plans - Page 1.pdf”)
loStream.Write(buffer, 0, buffer.Length)
Dim loFromPDF As New Document(loStream)
Dim fileEditor As New PdfFileEditor()
Dim parameters As New PdfFileEditor.ContentsResizeParameters(
PdfFileEditor.ContentsResizeValue.Units(100), 'left margin
PdfFileEditor.ContentsResizeValue.Percents(100), 'No width scaling
Nothing, 'Right margin will be auto calc’ed
Nothing, 'Top margin will be auto calc’ed
PdfFileEditor.ContentsResizeValue.Percents(100), 'No height scaling
PdfFileEditor.ContentsResizeValue.Units(100) 'bottom margin
)
fileEditor.ResizeContents(loFromPDF, New Integer() {1}, parameters)
loFromPDF.Dispose()

Tested with v23.11.
Plans - Page 1.pdf (265.0 KB)

@twf

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-56754

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.