473,573 Members | 4,138 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 7589
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********@yah oo.co.ukwrote in message
news:f3******** *************** ***********@n22 g2000prh.google groups.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.laceupsolut ions.com
Mobile & warehouse Solutions."Arti e" <artiele...@yah oo.co.ukwrote in message

news:f3******** *************** ***********@n22 g2000prh.google groups.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
5916
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 pages, each of which has a link to a "print view" page. That "print view" page has a "print" button which calls a javascript function "printThis": ...
3
2492
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 only make the web service print to the default printer installed on the web server, and need a way to allow each pocket pc device to print to a...
2
3192
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
5381
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, the value of the "DefaultPageSettings.Landscape" is still false !!?? Code Exemple : PrintDialog PDialog = new PrintDialog();...
1
2610
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 close the PageSetupDialog or PrintDialog. This doesn't happen if the Windows Form is displayed using the Show method. Does anyone have a solution? ...
4
4935
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 option") end if But I would like to open the print dialog and automatically perform the "Print" button to save the user one more step.
10
15303
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 lunching the printdialog (i.e. the user can't choose the print parameters). Thanks a lot.
3
1841
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 wrong? Thanks in advance for your help. Public Sub Print() Try Dim dlgPrint As New PrintDialog()
0
2356
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 btnprint,btnclose
0
7707
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8037
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8086
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5605
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3737
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3743
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2227
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1325
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1048
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.