I am attempting to append text (htmlfragment) to the bottom of a page in a PDF file, however after adding the HTMLFragement, calls to save throw an exception. The code is:
Aspose.Pdf.Document pdfDoc = new Aspose.Pdf.Document(WorkingFile + ".pdf");
pdfDoc.Pages[1].Paragraphs.Add(new Aspose.Pdf.HtmlFragment("<p>anything</p>"));
pdfDoc.Save(WorkingFile + ".notes.pdf", Aspose.Pdf.SaveFormat.Pdf);
Working File 00003015.PPT.pdf (575.2 KB)
Is attached to the ticket.
Exception Details:
‘pdfDoc.Save(WorkingFile + “.notes.pdf”, Aspose.Pdf.SaveFormat.Pdf)’ threw an exception of type ‘System.NullReferenceException’
Data: {System.Collections.ListDictionaryInternal}
HResult: -2147467261
HelpLink: null
InnerException: null
Message: “Object reference not set to an instance of an object.”
Source: “Aspose.Pdf”
StackTrace: " at Aspose.Pdf.FormattedFragment.\u0002(Page \u0002, Page \u0003)\r\n at \u0005 .\b \u0002(SizeF \u0002)\r\n at \u0006 .\b \u0002(SizeF \u0002)\r\n at \u0005 .\u0005 \u0002(\u0002 \u0002)\r\n at \b .\u0005 \u0002(\u0005 [] \u0002, \b \u0003)\r\n at \u000f .\u000e \u0002(\b \u0002, \b \u0003)\r\n at Aspose.Pdf.FormattedFragment.\u0002(Double& \u0002, Double& \u0003, Boolean \u0005, Double \b, Double \u0006, List`1 \u000e, Page \u000f, MarginInfo \u0002 , Table \u0003 )\r\n at \u000e .\u0005()\r\n at Aspose.Pdf.Page.\u0003(Page \u0002)\r\n at Aspose.Pdf.Document.ProcessParagraphs()\r\n at Aspose.Pdf.Document.Save(Stream output)\r\n at Aspose.Pdf.Document.Save(Stream outputStream, SaveOptions options)\r\n at Aspose.Pdf.Document.Save(String outputFileName, SaveFormat format)"
TargetSite: {Void (Aspose.Pdf.Page, Aspose.Pdf.Page)}