I've been trying for the past 3 days to get itextsharp to convert a simple html table to pdf. I found a solution that used htmlworker but i'm needing some control over the css. I then tried to implement the xmlworker object and It's almost as if I'm not importing something i'm suppose to because whenever I get to this line:
worker.ParseXHtml(writer, document, New StringReader(htmlReport))
I receive an the following errors: "Value of type 'iTextSharp.text.Document' cannot be converted to 'System.IO.Stream'."
"Value of type 'System.IO.StringReader' cannot be converted to 'System.Text.Encoding'."
I've tried several different examples and I always wind up with these errors...the code that I have up to this point that is not functional is below. Any info as to why these errors keep coming up for me would be greatly appreciated :)
Dim htmlReport As String = output.ToString
'Convert to pdf
Dim document As New Document(iTextSharp.text.PageSize.A4.Rotate(), 1, 1, 0, 0)
Dim writer As PdfWriter = PdfWriter.GetInstance(Document, New FileStream(Request.PhysicalApplicationPath + "\Export\test.pdf", FileMode.Create))
document.Open()
Dim worker As XMLWorkerHelper = XMLWorkerHelper.GetInstance
worker.ParseXHtml(writer, document, New StringReader(htmlReport))