Free Support Forum -

Create PDF from Generated .ASPX Page

I'm new to the Aspose.Pdf product and am trying to create a PDF on the fly from a .aspx page that I am generating.

The .aspx page includes 2 datagrids (based on datasets stored in session variables), 2 Pie Charts (based on Aspose.Chart that are generated based on the datagrids) and some basic web controls (labels and textboxes). The Pie Chart images are not stored on the file system, they are in memory.

Since the data can be changed in the datagrids, I would like to have a "Save PDF" button on the page that the user could click to create a PDF out of the page that had been rendered.

Can someone provide me with some insight on which direction to go with this?



Dear Josh,

Thank you for considering Aspose.

Aspx2PDF is not supported in the current version but we have decided to support it in the future version. We will notify you when the exact plan has been made.

Hi Josh

there is no reason why you couldn't have code associate with the button click event to generate a pdf as desired. Let me know if you want further direction on how to do this.

Best regards

Ralph Price

Dear Ralph,

Thank you for considering Aspose.

I know this feature is useful and we want to support it. The problem is how to get the contents in the aspx page and convert it to PDF. We are now study this issue and we will notify you when we have exact plan. Please tell me if you have any good idea.

You coud use some codes in the "Save PDF" button as follows:

pdf = new Aspose.Pdf.Pdf();
string surl=this.Request.Url.ToString();
WebClient webClient = new WebClient();
byte[] myDataBuffer = webClient.DownloadData(surl);
MemoryStream postStream=new MemoryStream (myDataBuffer);

It would save the current web page to C:\\test.pdf.

Good Luck!