Free Support Forum - aspose.com

Converting .aspx page to PDF

Hi There,

I have a .NET web application where I want to convert a web page (.aspx) into a PDF document. I am wondering if the page exists in the same project as the code which does the PDF conversion, can I point to the page with a relative link instead of a fully qualified URI? If so, can I add query-string variables to the relative link?

I have found some documentation on how to convert an HTML page to PDF but not an aspx page. Is there some examples of how to convert aspx pages to PDF and if it similar to converting HTML pages, can I use a relative link to point to the aspx page?

Thanks,
Tom

Hi Tom,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

You can use the same HTML to PDF conversion process to pass your .aspx page. However, in this case, as the webpage will be hosted on the web server, so to read the contents of the page (using HttpWebRequest object) and the path should be the server path where the page will run to return the response e.g. “http://localhost/default.aspx”.

Now, regarding the query string, you can add the query string variables with your URL and it will work fine.

Please see the following documentation link regarding the details with sample code for conversion from HTML to PDF when the page is hosted on some web server.

How to Convert HTML to PDF using InLineHTML approach

Please feel free to contact support in case you need any further assistance.

Thank You & Best Regards,

and what when the urls is like


"http://www.aspose.com/community/forums/addpost.aspx?PostID=413768"

how to work in this type of link???

Hi Chngfrenzoid,


Thanks for contacting support and sorry for the delayed response.

Currently Aspose.Pdf for .NET supports the conversion of simple HTML/CSS into PDF format and I am afraid the convesion from complex aspx/dynamic website is currently not supported. I am not entirely certain that either it will surely work or not but you may be first you can read the contents from dynamic website, save them to a file and then convert it to PDF format using Aspose.Pdf for .NET. We are sorry for this inconvenience.