views:

42

answers:

0

Hi,

I want to convert one of my asp.net reports to pdf as it is. However, I thought iTextSharp would be the ideal solution but it is not converting the report properly. My conversion code is as follows

Public Function DotNetConvert()


    Dim strFileName As String = HttpContext.Current.Server.MapPath("map1.pdf")
    '    strFileName    "C:\\Inetpub\\wwwroot\\Test\\map1.pdf" 
    ' step 1: creation of a document-object
    Dim document As New Document()
    ' step 2:
    ' we create a writer that listens to the document
    PdfWriter.GetInstance(document, New FileStream(strFileName, FileMode.Create))
    Dim se As New StringReader(strHTML)
    Dim obj As New iTextSharp.text.html.simpleparser.HTMLWorker(document)
    document.Open()
    obj.Parse(se)
    ' getting error "Illegal characters in path"
    document.Close()
    Response.ClearContent()
    Response.ClearHeaders()
    Response.AddHeader("Content-Disposition", "inline;filename=" + strFileName)
    Response.ContentType = "application/pdf"
    Response.WriteFile(strFileName)
    Response.Flush()
    Response.Clear()


End Function

And the report I want to be converted looks something like this alt text

HElp!!!