Solved

Printing PDF Programatically knowing when acrobat is finished

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

751 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