Important alert: (current site time 7/15/2013 8:02:58 AM EDT)
 

VB icon

Printing PDF in .Net

Email
Submitted on: 9/22/2005 6:05:52 PM
By: Chad 
Level: Beginner
User Rating: By 4 Users
Compatibility: VB.NET
Views: 32013
(About the author)
 
     Enable you to print a pdf using the shell command
 
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
//**************************************
// for :Printing PDF in .Net
//**************************************
Thanks to Tony for this code!
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
//**************************************
// Name: Printing PDF in .Net
// Description:Enable you to print a pdf using the shell command
// By: Chad
//
//This code is copyrighted and has// limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=4046&lngWId=10//for details.//**************************************

Dim psiPrint As New System.Diagnostics.ProcessStartInfo()
psiPrint.Verb = "print"
psiPrint.WindowStyle = ProcessWindowStyle.Hidden
psiPrint.FileName = "C:\MyFile.pdf"
psiPrint.UseShellExecute = True
System.Diagnostics.Process.Start(psiPrint)


Other 1 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
5/10/2006 4:18:55 PMSylvia

Great Job Tony, I was looking for this for about a week.

Again, Thank you.
(If this comment was disrespectful, please report it.)

 
11/24/2006 8:54:06 AMGareth Chamberlain

Have you tried using this method with a lot of pdf files? I have to use a MyProcess.WaitForExit(3000) to ensure that all the files are sent to the printer! I am using a network printer and files are only 100kb but forcing this break is really annoying. There must be some way to check if the file has been sent to the printer.

Checking if the process has exited does not work because there is a remaining adobe process still running (which I shut down but finding process with name 'AcroRd32' and killing it).

Any ideas would be most welcome.
(If this comment was disrespectful, please report it.)

 
4/9/2009 9:44:22 AMkabamba

it is not responding. any possible reason?
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.