Ramanand Bhat
Ramanand Bhat

Reputation: 183

Getting Print media CSS style applyed web page in WebBrowser control in C#

We would like to print the Web page loaded onto WebBrowser control in C# .net application.We have custom printer driver to print the bitmap images, now our task is to get the printer friendly version of web pages by applying print media CSS style to webBrowser control.

Do you know the method /code to get the Printer friendly version of any html web page in C# .net application.

Thanks, Ramanand Bhat.

Upvotes: 0

Views: 1739

Answers (1)

tahdhaze09
tahdhaze09

Reputation: 2213

When you style your print stylesheet, call it in the <head> like this:

<link rel="stylesheet" type="text/css" media="print" href="print.css" />

When the user requests a print, the print.css is called. No C# necessary. When you form your print stylesheet, think "print"; take out coloring, reformat any positioning that will bring anything "off the page", etc. Here's one resource I use for print stylesheets:

http://www.webcredible.co.uk/user-friendly-resources/css/print-stylesheet.shtml

Upvotes: 2

Related Questions