473,804 Members | 4,217 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 7601
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
5932
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": function printThis() { alert('printThis')
3
2504
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 different printer attached to the web server running the web service. As far as I can tell, the only way...
2
3208
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
5390
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(); PDialog.PrinterSettings = new System.Drawing.Printing.PrinterSettings();...
1
2619
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? I've made my own Print Setup Dialog Box (frmPrint). I've added the PrintDocument, PageSetupDialog...
4
4947
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
15337
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
1852
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
2385
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
9585
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10586
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10323
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10082
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5525
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4301
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
2
3823
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2997
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.