Print PDF file in vb.net By giving printer name

R

ripal.soni

To Print file on your selected printer instead of default printer you
can write the following code
also you can find the complete solution in
http://ripalsoni.wordpress.com/2007/04/25/print-pdf-file-in-vbnet-by-giving-printer-name/

Dim pathToExecutable As String = "AcroRd32.exe"

Dim sReport = "C:Test.PDF" 'Complete name/path of PDF file

Dim SPrinter = "HP Officejet 5600 seriese" 'Name Of printer

Dim starter As New ProcessStartInfo(pathToExecutable, "/t " + sReport
+ " " + sPrinter + "")

Dim Process As New Process()

Process.StartInfo = starter Process.Start()

the above code will print your pdf file on the printer you want ,you
can also print word document by the same way just change your
executable file path from Acrobat32.exe to word exe

Thanks

Ripal Soni
 
S

Scott M.

You've started a new thread in this group, so we don't know what previous
code you've tried or what kind of applicaiton you are working with.
 
B

Bill Nguyen

Herfried;

This works for simple format documents.
I tried to use PrintDialog to allow more options as follow but nothing
printed when user clicked on "PRINT"

Printdialog1.PrinterSettings.PrintFileName = "C:\Test.PDF"
PrintDialog1.ShowDialog()

What did I do wrong?

Thanks

Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top