Welcome! Log In Create A New Profile

Advanced

Save pdf file

Posted by IsdGlobal 
Save pdf file
May 11, 2011 10:10AM
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



Edited 1 time(s). Last edit at 05/11/2011 10:14AM by support.
Re: Save pdf file
May 11, 2011 10:20AM
Hello,

please send the generated PDF to info@pdfcrowd.com and we will look into it.
Re: Save pdf file
May 11, 2011 10:36AM
Please, try this code:

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

Did it help?
Re: Save pdf file
May 11, 2011 11:26AM
It works perfectly!!

Thank you
Sorry, only registered users may post in this forum.

Click here to login