471,596 Members | 875 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

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

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
3 2485
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
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
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.

Similar topics

1 post views Thread by Michael | last post: by
6 posts views Thread by Peter Frost | last post: by
1 post views Thread by Andrew Arace | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Anwar ali | last post: by

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.