Lars Breiter

Hello NG,

First, I work with VS2003 (Framework 1.1)
Got a bit of a problem. I want to print a file on the default printer. This is how I got so far:

' Get the default Printer
Dim oPS As New System.Drawing.Printing.PrinterSettings
Dim GetDefaultPrinter As String
GetDefaultPrinter = oPS.PrinterName
Dim pd As New System.Drawing.Printing.PrintDocument
pd.PrinterSettings.PrinterName = GetDefaultPrinter
pd.DocumentName = [Here document, but HOW ]
pd.Print()

Please can anyone help a bit.

Thanks, Lars


Re: Visual Basic Language Printing a File

Dick Donny

PrintDocument will use the default printer unless you tell it otherwise so there is no need to do anything on that.

What type of file are you working with What does it contain How is it structured

Richard





Re: Visual Basic Language Printing a File

Lars Breiter

Actually, there are two different kind of files (*.txt and *.pdf). These files are extracted from
a SQL Database (these Files are stored there in an Image Field) and coverted back to a PDF or Text File.

I got it working with System.Diagnostics.Process like

Dim p As New System.Diagnostics.Process
p.StartInfo.FileName = file.FullName
p.StartInfo.Verb = "print"
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
p.Start()

So, any other idea






Re: Visual Basic Language Printing a File

Dick Donny

As it is unlikely you would manually handle the printing of a pdf then I would suggest that you are doing the right thing (albeit you may find third party controls that can print these things from within your app and you are relying on an application that can handle the print being installed)

Richard