Solved

Printing PDF Programatically knowing when acrobat is finished

Posted on 2011-03-10
5
462 Views
Last Modified: 2012-05-11
I am using the following code which I got on EE.   I have aloop reading through a textbox that has the full path and name of the file ie:

E:\991222\PT00002.pdf
E:\991222\PT00003.pdf
E:\991222\PT00004.pdf

I read each file and first print out a banner sheet with the information on the file.  I then need to print the file and I am using the following code:
 
  Dim p As New System.Diagnostics.ProcessStartInfo()
        p.Verb = "print"
        p.WindowStyle = ProcessWindowStyle.Normal
        p.FileName = filestring
        p.UseShellExecute = True
        System.Diagnostics.Process.Start(p)

Whats happening is because the banner sheets are quick and the acrobat files take a while it is not going in order.  I need to somehow monitor the acrobat file and then send the next file after it is complete.  

Your help is appreciated.
0
Comment
Question by:rphilipson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 13

Expert Comment

by:gamarrojgq
ID: 35103203
Hi,

You can do it like this

0
 
LVL 13

Accepted Solution

by:
gamarrojgq earned 500 total points
ID: 35103212
Sorry, here it is the code
Dim p As New System.Diagnostics.ProcessStartInfo()
	Dim objProcess As System.Diagnostics.Process
        Try

            p.Verb = "print"
            p.WindowStyle = ProcessWindowStyle.Normal
            p.FileName = filestring
	    p.UseShellExecute = True

            objProcess = New System.Diagnostics.Process()
            objProcess.StartInfo = p
            objProcess.Start()

            'Wait until the process passes back an exit code 
            objProcess.WaitForExit()

            'Free resources associated with this process
            objProcess.Close()
        Catch
            MessageBox.Show("Could not start process ", "Error")
        End Try

Open in new window

0
 

Author Comment

by:rphilipson
ID: 35112483
In my print queue it is not in the order I sent it to print.  I think there must be a delay on the waitforexit.  Is there a way to easily check the queue and see if the file PT00002.pdf is in the queue before continuing.  Thanks
0
 
LVL 13

Expert Comment

by:gamarrojgq
ID: 35112530
Well if you want to check the printer queue, here is a link where explain the topic

http://www.codeproject.com/KB/printing/printwatchvbnet.aspx
0
 

Author Closing Comment

by:rphilipson
ID: 35782538
havent tried it yet
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question