1

I want to give users an option to download the web page of my website they are currently viewing. I have searched and found 3rd party windows software which convert the pages, but I am looking for an app that I can have on my website.

I am using C# on a ASP.NET platform.

0

I want to give users an option to download the web page of my website they are currently viewing.

It sounds like you're trying to convert your HTML output into PDF output, is this correct?

One of the best tools I've encountered for this is wkhtmltopdf. It's built on top of the Webkit rendering engine, the same engine that powers Safari, Chrome and the built-in browsers on Android devices and the iPhone.

Usage is pretty darn simple -- just a simple shell command pointing it at the HTML file in question and giving it the desired output filename. There are more options if you need them. I'm not sure how you'd go about actually making shell calls in the land of ASP.NET though.

While versions for Windows are available, I've only ever used it in a Linux environment, so YMMV. You will obviously need the ability to install programs on your server, which implies Administrator access.

0

I believe what you want to do is change the content disposition response header in the output you send back to the user. Have a look at the HttpResponse.TransmitFile method. Here is an additional article that may help too (can probably find several others that are similar).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.