HTML String to Stream to PDF


#1

I am trying to read a string of html out of a database, convert that to a io.stream, and then pass that stream to the bindHTML method. How can I do this? I tried using the following code with no luck. Any suggestions?
Thanks,

Dim ms as string = “…”

Dim s As System.IO.Stream

Dim b() As Byte

Dim utf As New System.Text.UTF7Encoding

b = utf.GetBytes(ms)

s.Write(b, 0, b.Length)

pdf.BindHTML(s)


#2

…one more question. Can you pass a MemoryStream to BindHTML?


#3

MemoryStream is supported. I test with the following code and it works:

Dim p As Pdf = New Pdf()

Dim s As String = “Hello world”
Dim b() As Byte = System.Text.Encoding.UTF8.GetBytes(s)
Dim ms As System.IO.MemoryStream = New System.IO.MemoryStream(b)

p.BindHTML(ms)

p.Save(“d:/test/test.pdf”)
ms.Close()