I am trying to convert an excel file that has a drop down of multiple options per cell to a pdf. In general the generation is ok however an extra page appears at the end of the pdf document that contains all the options in each of these cells. How do I prevent this? See attachments to see what I mean
As a immediate fix I tried to remove the last page of the document but am confronted with the below error. What am I doing wrong here?
Code:
Dim pgcount = MyPdfDocument.Pages.Count
Dim pg As Spire.Pdf.PdfPageBase = MyPdfDocument.Pages.Item(pgcount - 1)
'' These two lines appear to work correctly but the below one throws the error
MyPdfDocument.Pages.Remove(pg)
Error:
===EXCEPTION===Export excel to pdf format error. System.NullReferenceException: Object reference not set to an instance of an object.
at Spire.Pdf.Widget.PdfPageCollection.Remove(PdfPageBase page)