473,320 Members | 1,732 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 7562
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: aimee | last post by:
Hi. Is there a way to capture the events fired in a PrintDialog? I would like to capture when the user presses "Print" so I can do some cleanup. The asp.net (IE6) application I'm working on has 6...
3
by: John O'Neill | last post by:
Hi In C# I would like to be able to set the printer device for printing a document without using the PrintDialog. I am writing a pocket pc application which uses a web service to print. I can...
2
by: David | last post by:
Does anybody know how to check the AllowSelection radio button in the PrintDialog Dialog? I want to set this to checked if the user has selected a subset of text.
4
by: Steph. | last post by:
Hi, Is there a BUG in the printdialog ? When I create a PrintDialog ans set the "DefaultPageSettings.Landscape" property to "false" and then display the dialog, select "Landscape" and click OK,...
1
by: Blaine | last post by:
When I show my Windows Form as a dialog box (ShowDialog(Me)) and click on a button that calls the ShowDialog of either the PageSetupDialog or PrintDialog conrtol, my Windows Form closes After I...
4
by: mafandon | last post by:
Is it possible to send a performclick to a button on a printdialog? I know you can do an if statement similar to: if windows.forms.dialogresult.cancel then msgbox("User cancelled print...
10
by: choupi | last post by:
Hello, Is there a way to call a printDialog from a printPreviewDialog (from print icon for example)? Indeed, the print icon in the printpreviewdialog prints directly the document without...
3
Spitaki
by: Spitaki | last post by:
Hi, When I call the sub Print the PrintDialog opens twice. What do I have to change so this won't happen again? When I call the sub PrintPreview it works just fine. Has anyone an idea what I do...
0
by: thirunavukarasukm | last post by:
Hai.... To print Html page using PrintDialog and Print Document i am created one windows appication.. the windows application have many pages in my booking page i have two buttons one...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.