473,387 Members | 1,420 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,387 software developers and data experts.

Print Documents

I know that print funciton will be available in the
application for each type of file.

My question is, can I print a file(any type, e.g. word,
bmp, html, etc) in program?

No printer dialog should be prompted.

Can this be done?
Nov 15 '05 #1
2 1942
Rainbow,

It is possible, but you have to make sure that you know the item on the
list that should be used to print it. For example, for an HTML file, there
is a "print" menu item. You know that this menu item corresponds to print.

Now, once you have that, you can look up the extension .htm in
HKEY_CLASSES_ROOT and you will see that it is of type "htmfile". Looking up
"htmfile", you will find a key which has a subkey "shell". That is where
the commands are stored for the file type. Once you have that, you can see
the "print" key with the "command" key under it. The default value for this
key is the command that is executed to print.

It is not guaranteed that a dialog will not be displayed for this type,
because it is up to the program.

Now, you can do this programatically, but the key is knowing what menu
items correspond to printing.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Rainbow" <ra*****@frog.com> wrote in message
news:0d****************************@phx.gbl...
I know that print funciton will be available in the
application for each type of file.

My question is, can I print a file(any type, e.g. word,
bmp, html, etc) in program?

No printer dialog should be prompted.

Can this be done?

Nov 15 '05 #2
Thanks Nicholas.

As you mentioned, the print dialog box prompt up. I need
to print to a default printer with default print setting
sliently. So I want to see if there is any print API can
do.

Rainbow
-----Original Message-----
Rainbow,

It is possible, but you have to make sure that you know the item on thelist that should be used to print it. For example, for an HTML file, thereis a "print" menu item. You know that this menu item corresponds to print.
Now, once you have that, you can look up the extension .htm inHKEY_CLASSES_ROOT and you will see that it is of type "htmfile". Looking up"htmfile", you will find a key which has a subkey "shell". That is wherethe commands are stored for the file type. Once you have that, you can seethe "print" key with the "command" key under it. The default value for thiskey is the command that is executed to print.

It is not guaranteed that a dialog will not be displayed for this type,because it is up to the program.

Now, you can do this programatically, but the key is knowing what menuitems correspond to printing.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Rainbow" <ra*****@frog.com> wrote in message
news:0d****************************@phx.gbl...
I know that print funciton will be available in the
application for each type of file.

My question is, can I print a file(any type, e.g. word,
bmp, html, etc) in program?

No printer dialog should be prompted.

Can this be done?

.

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: SpamProof | last post by:
I'd like to be able to print multiple documents are once using vb.net. What is the best way to do this with out having to print each document one at a time via a loop . Can't I send them all to...
18
by: Phil Powell | last post by:
I am trying to print out an HTML document that has MARGINWIDTH set to 1, however, upon printing, HTML table cell contents are cut off, for exmample: <table border="0" width="780"> <tr>...
9
by: trint | last post by:
Instead of just sending one document at a time, I need to send multiple documents as a print job because our laserprinter will only stack and staple one printjob it receives at a time. I need to...
5
by: Sameer Parekh | last post by:
Hello everyone, We are automating a paper based process and hence need to print certain pdf documents through our VB .Net Application. Any ideas how that can be done? Thanks
22
by: stephen | last post by:
I have created an order form that users javascript to create a new html document when the customers clicks the "print page" button. Once the new document has been created it then prints the...
0
by: Bob | last post by:
I need to print a list of .PDF documents in the order that they are submitted. Previously the print queue has taken the documents in an arbitrary order. Does anyone have .NET code that will force...
1
by: matpublic | last post by:
Hi, I'm using reporting services (localreport) to generate multiple PDF reports. These individual reports (documents) need to be printed together using different trays on the printer (Doc A...
2
by: westmids | last post by:
I'm not sure that what I want to do is possible with Access 97, but I hope to be proved wrong: Within Access 97 I have a table with a hyperlink field enabling me to open MS Word 97 documents. At...
1
rsmccli
by: rsmccli | last post by:
Hello. Long time reader, first time poster... Anyway, here is my problem. We are using Access 2002 I have a subform on our FE where you pick a document name from a combobox, then input a...
10
by: S_K | last post by:
Hi, I have a directory full of a number of .PDF files that I need to print. Is there any simple way to do this? Using PdfReader purhaps? Thanks in advance. Steve
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.