Solved

Printing PDF Programatically knowing when acrobat is finished

Posted on 2011-03-10
5
418 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
  • 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now