By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,670 Members | 1,512 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,670 IT Pros & Developers. It's quick & easy.

How to access Explorer...Print function from code?

P: n/a
I have a button on my form to "Print". I would like to create an
HTML file, of the output, and call the Explorer...Print function when
this "Print" button is clicked. How can I do this - the
Explorer...Print part? I can create the HTML file, just need help with
calling the Explorer...Print function - supplying the path to the file
so that only the Print Dialog pops up once they click on "Print"

Thanks!
Jul 14 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Printing in windows forms is not normally performed like that. Printing is
normally done with a PrintDocument class which has an event which you handle
to do the printing which is done by GDI type drawing.
The easiest/cheapest/dirtiest way of doing what you want would be with a
Browser control. You could load the HTML into the browser control and call
the print function on that. That would then work just like internet explorer.

--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"Andrew Meador" wrote:
I have a button on my form to "Print". I would like to create an
HTML file, of the output, and call the Explorer...Print function when
this "Print" button is clicked. How can I do this - the
Explorer...Print part? I can create the HTML file, just need help with
calling the Explorer...Print function - supplying the path to the file
so that only the Print Dialog pops up once they click on "Print"

Thanks!
Jul 14 '08 #2

P: n/a
Hello,

look at this: http://www.codeproject.com/KB/printing/printhml.aspx

Hope it helps.

Leo

"Andrew Meador" <an****@meadorcrafts.comwrote in message
news:04**********************************@t54g2000 hsg.googlegroups.com...
I have a button on my form to "Print". I would like to create an
HTML file, of the output, and call the Explorer...Print function when
this "Print" button is clicked. How can I do this - the
Explorer...Print part? I can create the HTML file, just need help with
calling the Explorer...Print function - supplying the path to the file
so that only the Print Dialog pops up once they click on "Print"

Thanks!
Jul 14 '08 #3

P: n/a
On Jul 14, 11:58*am, "Leo Seccia" <lsec...@msn.comwrote:
Hello,

look at this:http://www.codeproject.com/KB/printing/printhml.aspx

Hope it helps.

Leo

"Andrew Meador" <and...@meadorcrafts.comwrote in message

news:04**********************************@t54g2000 hsg.googlegroups.com...
* I have a button on my form to "Print". I would like to create an
HTML file, of the output, and call the Explorer...Print function when
this "Print" button is clicked. How can I do this - the
Explorer...Print part? I can create the HTML file, just need help with
calling the Explorer...Print function - supplying the path to the file
so that only the Print Dialog pops up once they click on "Print"
Thanks!- Hide quoted text -

- Show quoted text -
Thanks Leo - this was what I was looking for. Got it done and it
works perfectly. I HATE windows printing. I have been looking at
ASP.NET programming a bit lately and didn't see why I shouldn't just
have my app create an HTML file/report and use this method to print
the html file. I seems to me that this is a lot easier than dealing
with the whole GDI/drawing approach. I get tables, borders, fonts,
etc... without having to deal with the font size calculations, line
spacing/tracking, etc...

If there is any other way that you guys recommend, I'm all ears,
but until then - I like this method! :)

Andrew
Jul 15 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.