This is an archived forum post. The information may be outdated. Contact us if you have any questions.

Save pdf file

IsdGlobal wrote on 2011-05-11:
Hello

I'm evaluating your product, but I have some problems while i am testing it.

I'm working with ASP.NET 2.0, VB.NET.

I have a page that is dynamically created, so every time you run it, it can be different.

What I need is that the page render event saves a pdf of the generated page.


In order to test your product, I am running this code.

Dim client As New pdfcrowd.Client("xxx", "xxx")

Dim html As String = _
"<html>" & _
"<body>" & _
"<div>" & _
"<table border=""1"" bordercolor=""fuchsia"" style=""position:absolute; top:100; left:100"" >" & _
"<tr>" & _
"<td colspan=""2"">Test text</td>" & _
"</tr>" & _
"</table>" & _
"</div>" & _
"</body>" & _
"</html>"

client.convertHtml(html, New FileStream("c:\html.pdf", FileMode.CreateNew))

But when I open the generated pdf file, I get the following error:

"Failed to open the document. The file is damaged beyond repair."

I'm running this code in the page render event.


I hope you can help with this issue


Thanks
support wrote on 2011-05-11:
Hello,

please send the generated PDF to info@pdfcrowd.com and we will look into it.
support wrote on 2011-05-11:
Please, try this code:

Dim fs As New FileStream("c:\html.pdf", FileMode.CreateNew)
client.convertHtml(html, fs) 
fs.Close()


Did it help?
IsdGlobal wrote on 2011-05-11:
It works perfectly!!

Thank you