I created a simple program that contains Labels and TextBoxes. I added a Button to export the entire interface with Labels and Textboxes to PDF but I get this error message:
Unable to cast object of type 'System.Windows.Forms.Panel' to type 'iTextSharp.text.IElement'.,
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim pdfDoc As New Document()
Dim pdfWrite As PdfWriter = PdfWriter.GetInstance(pdfDoc, New FileStream("C:\Users\Win 10\Desktop\simple.pdf", FileMode.Create))
pdfDoc.open()
pdfDoc.Add(Panel1)
pdfDoc.Add(Panel2)
pdfDoc.Add(TextBox1)
pdfDoc.Add(TextBox2)
pdfDoc.Close()
End Sub