Dear All
I am creating PDF from html in following way. pdf is getting created but there is lot of gap between text which are "td's" in my html..please see following code
In hdpdf.Value i am getting my all html text
Dim pgSize As New iTextSharp.text.Rectangle(700, 700)
Dim doc As New iTextSharp.text.Document(pgSize, 0, 0, 0, 0)
' Dim document As Document = New iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 10.0F, 10.0F, 100.0F, 0.0F)
' Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0f);
' Dim Document As PdfDocument = New PdfDocument(pdf.DocumentFont.Letter_8_5x11)
Dim UrlDirectory As [String] = Request.Url.GetLeftPart(UriPartial.Path)
UrlDirectory = UrlDirectory.Substring(0, UrlDirectory.LastIndexOf("/") + 1)
Response.Write(UrlDirectory)
PdfWriter.GetInstance(doc, New FileStream(Server.MapPath(".") + "rohan.pdf", FileMode.Create))
doc.Open()
' Dim textFont As Font = FontFactory.GetFont("Helvetica", 1, 1, font.NORMAL, BaseColor.BLACK)
Dim htmlText As [String] = hdpdf.Value
Dim htmlarraylist As List(Of IElement) = iTextSharp.text.html.simpleparser.HTMLWorker.ParseToList(New StringReader(htmlText), Nothing)
Dim font As iTextSharp.text.Font = FontFactory.GetFont("Times-Roman", 10)
For k As Integer = 0 To htmlarraylist.Count - 1
Dim x As IElement = DirectCast(htmlarraylist(k), IElement)
Response.Write(x.Type.ToString() + "#<br>")
Next
Dim mypara = New Paragraph()
mypara.InsertRange(0, htmlarraylist)
mypara.Font = font
doc.Add(mypara)
doc.Close()