I am using the FreeTextBox.dll to get user input, and storing that information in HTML format in the database. A samle of the user’s input is the below:
133 Peachtree St NE
Atlanta, GA 30303
404-652-7777Cindy Cooley
www.somecompany.com
Product Stewardship Mgr9/9/2011
Deidre's Company
123 Test St
Atlanta, GA 30303
Test test.
I want the HTMLWorker to perserve the white spaces the users enters, but it strips it out. Is there a way to perserve the user’s white space? Below is an example of how I am creating my PDF document.
Public Shared Sub CreatePreviewPDF(ByVal vsHTML As String, ByVal vsFileName As String)
Dim output As New MemoryStream()
Dim oDocument As New Document(PageSize.LETTER)
Dim writer As PdfWriter = PdfWriter.GetInstance(oDocument, output)
Dim oFont As New Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL, BaseColor.BLACK)
Using output
Using writer
Using oDocument
oDocument.Open()
Using sr As New StringReader(vsHTML)
Using worker As New html.simpleparser.HTMLWorker(oDocument)
worker.StartDocument()
worker.SetInsidePRE(True)
worker.Parse(sr)
worker.EndDocument()
worker.Close()
oDocument.Close()
End Using
End Using
HttpContext.Current.Response.ContentType = "application/pdf"
HttpContext.Current.Response.AddHeader("Content-Disposition", String.Format("attachment;filename={0}.pdf", vsFileName))
HttpContext.Current.Response.BinaryWrite(output.ToArray())
HttpContext.Current.Response.End()
End Using
End Using
output.Close()
End Using
End Sub
Thanks for the help everyone. I was able to find a small work around by doing the following:
The actual code does not display properly but, the first replace is replacing white spaces with
,Chr(9)with 5 , andChr(160)with .