• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2830
  • Last Modified:

Printing HTML documents in C#

Hi,

We have a module in a C# Windows application that prints Images and Plain Text  to the default printer using the PrintDocument class.

We need to extend the functionality to allow printing of HTML files also but are facing a problem. If the HTML file is read as a plain text file, it is sent to the printer as the actual HTML markup with all HTML tags and script on the printed document instead of the rendered view that we get on the browser.

Am looking for any pointers to solve this problem….

0
ashish_me2
Asked:
ashish_me2
1 Solution
 
armoghanCommented:
see the following example for printing. This is a clone for IE in VB.NET
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=1953&lngWId=10
0
 
_kiwi_Commented:
Hi,

You may want to have a look at IE automation.

By That I mean, in your C# Windows Application, you can use the real IE to display pages and so forth.

What you have to do is to open the IE automation, make it load your html page, and then ask it to print.

All this can be done via C# in a transparent way for the user, thus you don't have to redevelop a full web browser just to print a page.

Just look at IE Automation C# in your favorite Search Engine, you will find lots of usefull bits.

Cheers,
Julien
0
 
nhewitt21Commented:
There is already a similar question to this with an accepted answer:
http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_21056137.html
0
 
ashish_me2Author Commented:
Thanx all of you for the valuable inputs.

-Ashish.
=====
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now