473,473 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

print files in VB.net

I am working on a VB.net project that needs to provide a feature that user
can print a file to a printer from a directory. The file can be any type,
like PDF, TIF, etc., not just text file. Could anybody help me with this?
Thanks in advance.

Li
Jul 21 '05 #1
4 8446
Hi Li,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to write an app that can print
all kind of datat types. If there is any misunderstanding, please feel free
to let me know.

As far as I can see, this is a very big project. First, you have to make
sure that your application can open all these types of files. For text
files, you need to know the format, and for image files, you have to have
all the decoders for them. Then you can show them in you app and convert
the document to the printer. HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #2
The users don't want to open the files. They get these files as attachments.
They just want to send these files to the printer. What I want to know is if
VB.net has some functionalities to do these. Or at least for PDF and TIF.
Then I can check if a file is a PDF or a TIF and call related class to send
it out to printer.

Thanks.

Li

"Kevin Yu [MSFT]" wrote:
Hi Li,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to write an app that can print
all kind of datat types. If there is any misunderstanding, please feel free
to let me know.

As far as I can see, this is a very big project. First, you have to make
sure that your application can open all these types of files. For text
files, you need to know the format, and for image files, you have to have
all the decoders for them. Then you can show them in you app and convert
the document to the printer. HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #3
Hi Li,

Printing the files involve opening them. If we need to print a file, the
printer itself doesn't know how to print that. We need the computer to open
it first and convert the file format to printer's interface.

However, VB.NET don't have functionalities to open PDF or TIF files. I
think you have to check for the third party components. HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #4
Hi Li,

If you need to open PDF files and print them on the printer, you can try to
use Acrobat Reader automation. However the machine that runs the app has to
have Acrobat Reader installed. The following code might help.

Dim acrApp As Object
Dim avDoc As Object
Dim pdDoc As Object
Dim nbrPages As Int16

acrApp = CreateObject("AcroExch.App")
avDoc = CreateObject("AcroExch.AVDoc")
avDoc.Open("c:\t.pdf", "")
pdDoc = avDoc.GetPDDoc()
nbrPages = pdDoc.GetNumPages()

'avDoc.PrintPages 0, 1, 2, False, True
avDoc.PrintPages(0, nbrPages - 1, 2, False, True)
pdDoc = Nothing
avDoc = Nothing

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #5

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

Similar topics

5
by: MouseHart | last post by:
I've written a simple program in VB 6.0 to list all my MP3 files. To show them on the screen I used an MSFlexGrid named TextGrid (which is not associated with any table or text file) in the...
5
by: vegetax | last post by:
How can i use cgi'like print statement in a multitreaded web framework? each thread has its own Servlet instance with request/response objects, sys.stdout = self.response(which is a file like...
4
by: Julie Siebel | last post by:
Apologies...I'm sure this has been asked before, but I can't seem to come up with the correct Google search terms. While my problem is with stylesheets, the errors are being caused by my...
16
by: Neo Geshel | last post by:
I'm helping on a web site, and it's got our knickers in a knot. We're using the same basic CSS files (with mods) and same headers as from our other sites, but the "print preview" won't work...
1
by: hamil | last post by:
I am trying to print a graphic file (tif) and also use the PrintPreview control, the PageSetup control, and the Print dialog control. The code attached is a concatination of two examples taken out...
9
by: Scott M | last post by:
I'm printing a directory of about 500 multi-page tifs to a high speed printer and the spooler process is killing me!!! here is a little code..... Public Function PrintImage(ByVal...
2
by: alivip | last post by:
when I wont to inser (anyting I print) to the textbox it will not inser it just print then hanging # a look at the Tkinter Text widget # use ctrl+c to copy, ctrl+x to cut selected text, #...
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
16
by: raylopez99 | last post by:
I am running out of printing paper trying to debug this...it has to be trivial, but I cannot figure it out--can you? Why am I not printing text, but just the initial string "howdy"? On the...
9
by: happyse27 | last post by:
Hi All, In perl script(item b below) where we check if html registration form are filled in properly without blank with the necessary fields, how to prompt users that the field are incomplete...
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
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,...
0
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...
0
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
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.