Aspose.Pdf.Document.Outlines.Add throws exception

Hi,

We are currently using Aspose.PDF version 10.7.

We have a method which looks like the one pasted below. When this method is executed with a specific input an exception is thrown. Specifically it is the line “inputPdf.Outlines.Add(outlineCollection);” which throws the exception.

My question is now if you have seen this before or know how this can throw an exception?

Method:

private MemoryStream CreateBookmarksOnPDF(Stream pdf, string bookmarkTitle)
{
var outputStream = new MemoryStream();
var inputPdf = new Aspose.Pdf.Document(pdf);
var outlineCollection = new OutlineItemCollection(inputPdf.Outlines);
outlineCollection.Action = new GoToAction(inputPdf.Pages[1]);
outlineCollection.Title = bookmarkTitle;
inputPdf.Outlines.Add(outlineCollection);
inputPdf.Save(outputStream);
return outputStream;
}

Thank you :smiley:

/Frederik

@fdk

Thank you for contacting support.

Please note that you are using an outdated version of the API so please upgrade to Aspose.PDF for .NET 18.8 because it includes more features and bug fixes. Also, support is provided based on latest available version. In case the issue persists, please share source PDF file with us so that we may investigate further to help you out.

@Farhan.Raza

Thanks for the quick reply.

Unfortunately it is not possible to upgrade to use the newest version of the API at the moment.

Can you test if the issue exists using version 18.8? The file is attached.

Again, thank you for the help!

/Frederik

FileCausingException.pdf (36.6 KB)

@fdk

Thank you for sharing requested data.

This appears to be a file specific issue which is persisting with latest version of the API. A ticket with ID PDFNET-45274 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

The issues you have found earlier (filed as PDFNET-45274) have been fixed in Aspose.PDF for .NET 21.5.