473,769 Members | 7,558 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1961
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_RO OT 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.co m

"Rainbow" <ra*****@frog.c om> 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_R OOT 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.co m

"Rainbow" <ra*****@frog.c om> 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
13829
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 a spool at once or something? Ideally, I would like the code such that multiple users can print via my application at the same time. Any help would be appreciated. Thanks
18
12441
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> <td>Hello, this is a long piece of text that should be printed in its entirety</td> </tr> </table>
9
12973
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 use some of this code: PrinterSettings printerSettings = new PrinterSettings(); printerSettings.MaximumPage = m_numberOfPages; printerSettings.MinimumPage = 1; printerSettings.PrintRange = PrintRange.SomePages; printerSettings.FromPage = 1;...
5
2825
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
130405
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 document and closes it with the following code: <body onload="window.print(); window.close();"> This works correctly (or at least the way I expect it to work under MS Internet Explorer, but it cuases Netscape to "crash"
0
833
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 the documents to print in the correct order. any assistance appreciated Bob
1
1560
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 from tray 1, Doc B from tray 2). The problem I have is that this is a multi user system and so if two users were printing at the same time, the documents could get mixed up.
2
8230
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 the end of each day I need to print all the Word documents in a specific order to mail out. Is it possible to automate this procedure in Access 97 so that the documents can all be printed at the touch of a button? This would save me hours of work,...
1
2096
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 hyperlink address in a text box next to it. These values are stored in a table named tblHyperlinks with the document type as a lookup/number (field name strDocName) and the hyperlink itself (field name hypLink). Once all of the applicable documents'...
10
8840
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
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10214
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...
0
10048
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9996
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
9865
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
6674
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5304
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...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3563
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.