468,306 Members | 1,243 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,306 developers. It's quick & easy.

Use PrintDialog to print out formatted HTML

Hi,

I've searched the web but can't find a solution to an apparently
really simple problem.

My app contains an HTML string and I need to be able to invoke the
Print Dialog to print the HTML correctly formatted (i.e. not as raw
HTML) to a printer that the User chooses.

So, I need something like:

string _html = "<htmlsome html stuff </html>";

PrintDialog printDialog = new PrintDialog( );
if ( PrintDialog =OK )
{
printer.Print( _html );
}

I want this to invoked the common Windows PrintDialog, and once the
user selects their options and clicks OK, the formatted HTML is
printed.

Any help much appreciated

Cheers

Artie
Jan 22 '08 #1
2 7228
Hi ,

Your problem is that you need the HTML parsed, an option could be use a
WebBrowser control and set Visible to false, then use the Print() method.

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"Artie" <ar********@yahoo.co.ukwrote in message
news:f3**********************************@n22g2000 prh.googlegroups.com...
Hi,

I've searched the web but can't find a solution to an apparently
really simple problem.

My app contains an HTML string and I need to be able to invoke the
Print Dialog to print the HTML correctly formatted (i.e. not as raw
HTML) to a printer that the User chooses.

So, I need something like:

string _html = "<htmlsome html stuff </html>";

PrintDialog printDialog = new PrintDialog( );
if ( PrintDialog =OK )
{
printer.Print( _html );
}

I want this to invoked the common Windows PrintDialog, and once the
user selects their options and clicks OK, the formatted HTML is
printed.

Any help much appreciated

Cheers

Artie

Jan 22 '08 #2
On 22 Jan, 21:34, "Ignacio Machin \( .NET/ C# MVP \)" <machin TA
laceupsolutions.comwrote:
Hi ,

Your problem is that you need the HTML parsed, an option could be use a
WebBrowser control and set Visible to false, then use the Print() method.

--
Ignacio Machinhttp://www.laceupsolutions.com
Mobile & warehouse Solutions."Artie" <artiele...@yahoo.co.ukwrote in message

news:f3**********************************@n22g2000 prh.googlegroups.com...
Hi,
I've searched the web but can't find a solution to an apparently
really simple problem.
My app contains an HTML string and I need to be able to invoke the
Print Dialog to print the HTML correctly formatted (i.e. not as raw
HTML) to a printer that the User chooses.
So, I need something like:
string _html = "<htmlsome html stuff </html>";
PrintDialog printDialog = new PrintDialog( );
if ( PrintDialog =OK )
{
* printer.Print( _html );
}
I want this to invoked the common Windows PrintDialog, and once the
user selects their options and clicks OK, the formatted HTML is
printed.
Any help much appreciated
Cheers
Artie- Hide quoted text -

- Show quoted text -
Thanks very much for your reply Ignacio.

I should maybe have given a bit more information in my original post.
I actually DO already have a WebBrowser control visible on my form, so
I'll look into the Print() command.

I also have a similar problem with saving the formatted HTML from this
control, which I've posted in the topic "Invoke 'Save As' Dialog to
save WebBrowser control contents".

If you could give me some pointers on this one too, I'll be extremely
grateful.

Cheers

Artie

Jan 22 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by aimee | last post: by
3 posts views Thread by John O'Neill | last post: by
4 posts views Thread by Steph. | last post: by
4 posts views Thread by mafandon | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.