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;
}
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.
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.