ASPX page to PDF

Hi ,

I am using .NET 1.1 with aspose 2.1.13. I want to convert my current aspx page to pdf document.But only text and hyperlinks are visible in the created pdf and there is no checkbox, textbox or any dropdown control.Could you please tell me how can I get these controls into my pdf document.

I am used following code:

Dim pdf As New Aspose.Pdf.Pdf

Dim surl As String = Request.Url.ToString()

pdf.BindHTMLFromUrl(surl, "GET")

pdf.Save("aspose.pdf", Aspose.Pdf.SaveType.OpenInBrowser, HttpContext.Current.Response)

and also:

Dim webClient As System.Net.WebClient = New System.Net.WebClient

Dim myDataBuffer As Byte() = webClient.DownloadData(surl)

Dim postStream As MemoryStream = New MemoryStream(myDataBuffer)

Dim download As String = Encoding.ASCII.GetString(myDataBuffer)

pdf.BindHTML(postStream)

pdf.Save("c:\\ICMS.pdf")

Nothing workedout.

Thanks and Regards,

Vicky

Hi,

Thank you for considering Aspose.

We have made some improvements in the latest version. Please download 3.5.6.0 and test it again.

Thanks.

Hi ,

Thanks for your response.

I downloaded the mentioned version of aspose(3.5.6.0) , but stll its not displaying any control except the lables and hyperlinks.

My aspx page contains textboxes, checkboxes, radio buttons and dropdown list.

Appreciate your help.

Vicky

Hi,

Please check the following code. If it is still won’t work then please share your Aspx page on the forum or send us using the steps mentioned here: https://forum.aspose.com/t/how-to-share-a-document-in-a-forum-post/225947

And let us investigate this issue.

pdf = New Aspose.Pdf.Pdf
Dim surl As String = Request.Url.ToString()
Dim webClient As WebClient = New WebClient

byte[] myDataBuffer = webClient.DownloadData(surl)
MemoryStream(postStream = New MemoryStream(myDataBuffer))

pdf.BindHTML(postStream)
pdf.Save(“c:\test.pdf”)

Thanks.

Hi,

I used the this code already, but it gives me the same problem.Here is my code that I used.

Imports System

Imports System.IO

Imports System.Xml

Imports System.Xml.XPath

Imports System.Net.WebClient

Imports System.Web

Imports System.Web.Mail

Imports System.Configuration

Imports System.Text

Imports System.Runtime.Remoting.Messaging

Imports System.Web.HttpContext

Imports Aspose

Public Class WebForm1

Inherits System.Web.UI.Page

Protected WithEvents lnl As System.Web.UI.WebControls.Label

Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox

Protected WithEvents CheckBox1 As System.Web.UI.WebControls.CheckBox

Protected WithEvents ListBox1 As System.Web.UI.WebControls.ListBox

Protected WithEvents RadioButton1 As System.Web.UI.WebControls.RadioButton

Protected WithEvents RadioButton2 As System.Web.UI.WebControls.RadioButton

Protected WithEvents Table1 As System.Web.UI.WebControls.Table

Protected WithEvents Button1 As System.Web.UI.WebControls.Button

Public Sub SaveAsPDF()

'Dim licenseFile As String = ConfigurationSettings.AppSettings("AsposeLicenseFile")

'If (Not licenseFile Is Nothing) AndAlso (Not String.Empty.Equals(licenseFile)) Then

' Dim asposeWordLicense As New Aspose.Word.License

' asposeWordLicense.SetLicense("C:\\Inetpub\wwwroot\WebApplication2\Aspose.Custom.lic")

' Dim asposePdfLicense As New Aspose.Pdf.License

' asposePdfLicense.SetLicense("C:\\Inetpub\wwwroot\WebApplication2\Aspose.Custom.lic")

'End If

Dim pdf As New Aspose.Pdf.Pdf

Dim surl As String = Request.Url.ToString()

'================================================================================

' with Aspose 2.3 and 3.6.5

'pdf.BindHTMLFromUrl(surl, "GET")

'pdf.Save("aspose.pdf", Aspose.Pdf.SaveType.OpenInBrowser, HttpContext.Current.Response)

'==============================================================================

Dim webClient As System.Net.WebClient = New System.Net.WebClient

Dim myDataBuffer As Byte() = webClient.DownloadData(surl)

Dim postStream As MemoryStream = New MemoryStream(myDataBuffer)

Dim download As String = Encoding.ASCII.GetString(myDataBuffer)

pdf.BindHTML(postStream)

pdf.Save("c:\\ICMS.pdf")

'=======================================================================

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

SaveAsPDF()

End Sub

Private Sub InitializeComponent()

End Sub

End Class

Hi,

I am sorry to tell that these controls are not supported yet. Although table and list are rendered in the Pdf. You can check the supported HTML tags at:

Sorry for inconvenience.

Thanks.

As per the requirement of our application (which enables the external users to submit the data entry forms online), it is required to capture the image of the submitted form. This functionality of capturing image is required to serve certain legal formalities of our customer. We have been able to successfully convert the submitted form in .MHT (embedded html) format using rendering option of windows .NET but the problem in the said format is that it supported only by IDM viewer and not other viewers.

PDF is the only viable option for this feature of capturing image since PDF format is supported on all browsers and viewers. We are already using Aspose ver 2.3 as a reporting tool in our application for producing the report results into different formats including PDF. But, while trying to convert the captured .MHT image into PDF format, images in the form are not getting converted including radio buttons, textboxes, dropdowns and checkboxes.

We have tried with all the solutions as suggested by you including usage of Aspose ver 3.6.5 but still we are facing the same problem. You are requested to please suggest some workable solution for the reported problem. Please consider this as urgent and reply back at the earliest.

Hi,

I am sorry to say that it is not supported and we can't support it in short time. I have no other workaround for it. Sorry for inconvenience.

Thanks.