Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Printing PDF Programatically knowing when acrobat is finished

Posted on 2011-03-10
5
Medium Priority
?
466 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 2000 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

721 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