Mohammed Ali
Mohammed Ali

Reputation: 211

How to print the GridView and Microsoft Charting Control directly or as a PDF?

I am a new ASP.NET developer and I tried to print the dashboard page that I have in my project as any page or as a PDF. I searched a lot in the Internet and I could not be able to find something useful for this task. So how I can print this page which contains some GridViews and Microsoft charts?

Upvotes: 0

Views: 303

Answers (1)

David
David

Reputation: 73564

If you're talking about printing from the browser, (file - print - select a PDF writer instead of a printer) we use CutePdf (http://cutepdf.com/) - it's free and it works great. And once it's installed you can use it to print anything to PDF, not just web pages. But if that's what you want, it's also off-topic for this site.

If you want it to happen on the server-side, then you're getting into more advanced stuff. You'll need to look into the System.Drawing.Printing namespace.

However, there are issues with printing from the server. Suppose the printer is out of paper, or jams? Does your website hang up? You'll need to ensure that doesn't cause issues. ASP.NET isn't really the right tool for that job. You'd be better off writing a Console App or a Windows Service. Not to mention that printing from .NET is somewhat daunting at first.

Upvotes: 1

Related Questions