Free Support Forum - aspose.com

Aspx to pdf just flat out does not work

I have scanned your message boards and your documentation and found that this is the recommended solution (VB)

Pdf = New Aspose.Pdf.Pdf
Dim surl As String = Request.Url.ToString()
Dim webClient As System.Net.WebClient = New System.Net.WebClient()
webClient.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim myDataBuffer() As Byte = webClient.DownloadData(MyURL.AbsoluteUri)
Dim postStream As MemoryStream = New MemoryStream(myDataBuffer)
pdf.BindHTML(postStream)
'Set Font Map for better performance
pdf.IsTruetypeFontMapCached = True
pdf.TruetypeFontMapPath = System.IO.Path.GetTempPath()
pdf.Save(“c:\test.pdf”)


the above includes credentials which is needed as this is a .net 2.0 password-protected site. The problem is that the above produces a 500 server error. Please respond. I urgently need this to work as advertised.

Hi,

Please use the BindHTMLFromUrl (http://www.aspose.com/documentation/file-format-components/aspose.pdf-for-.net-and-java/aspose.pdf.pdf.bindhtmlfromurl_overloads.html) method with the Credentials (http://www.aspose.com/documentation/file-format-components/aspose.pdf-for-.net-and-java/aspose.pdf.pdf.credentials.html) field.

Thanks.