I have list of pdf documents.
var documentList = new List<PdfDocument>();
I am trying to create merged pdf file reading memory stream and converting to pdf documents.
I have list of documents that has been added to documentList of PdfDocument type.
then error happening when i am trying to append page to list to pass back to handler.
following exception occurs
System.NullReferenceException: Object reference not set to an instance of an object.
at Spire.Pdf.Bookmarks.PdfBookmarkWidget.ᜀ()
at Spire.Pdf.PdfDocumentBase.()
at Spire.Pdf.PdfDocumentBase.ImportPageRange(PdfDocumentBase
ldDoc, Int32 startIndex, Int32 endIndex)
at Spire.Pdf.PdfDocumentBase.ᜁ(PdfDocumentBase A_0)
Following is code
IEnumerable<docs> = <list of documents >;
if(docs.Any())
{
foreach (var doc in docs)
{
documentList.Add(new PdfDocument(doc));
}
}
Var first = true;
foreach (var item in documentList)
{
if (!first && item != null)
documentList.First().AppendPage(item); // throwing error on this line
first = false;
}