How to use Multi-threading process for printing

I am not very familiar with multi-threading. I need help with multi-threading the ProcessStartInfo for printing to allow my .pdf files that I send to the printer to print in order. I feel that if I use multi-treading that it would allow me to print larger pdf files in the particular order that I need.

Currently was the print jobs get to the printer they tend to print off by size. I have some pretty large pdf file...

I also need to print on one side of paper. The printer is defaulted to double-sided.  I want to print one-sided only for these documents...
For x As Integer = 0 To enclosureList.Count - 1
                Dim psInfo As New ProcessStartInfo

                With psInfo
                    .UseShellExecute = True
                    .Verb = "print"
                    .FileName = enclosureList(x)
                    .WindowStyle = ProcessWindowStyle.Hidden
                    Process.Start(psInfo)
                End With
 Next 

Open in new window

Natavia FinnieSenior Analyst Technical Focus ApplicationsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

louisfrCommented:
In your code, you send all the print commands at once.
You could make a new thread which sends one command each time, waiting for the job to complete before starting another.
Maybe something like this:
        Dim t As New Threading.Thread(Sub()
                                          For x As Integer = 0 To enclosureList.Count - 1
                                              Dim psInfo As New ProcessStartInfo

                                              With psInfo
                                                  .UseShellExecute = True
                                                  .Verb = "print"
                                                  .FileName = enclosureList(x)
                                                  .WindowStyle = ProcessWindowStyle.Hidden
                                                  Dim p = Process.Start(psInfo)
                                                  p.WaitForExit()
                                              End With
                                          Next
                                      End Sub)
        t.Start()

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Natavia FinnieSenior Analyst Technical Focus ApplicationsAuthor Commented:
@louisfr
your code worked as for as building with no errors but the order that it prints is way off. each enclosureList may have anywhere from 2 to 8 pages of enclosures including the attached word file that is a cover sheet that I insert at enclosureList(0) and then the following enclosures should follow.  It is now printing (0) in-between the next enclosureList.

I placed your code at the very end of my print sub...

Should I be calling this sub differently?
louisfrCommented:
I hadn't understood you had that code called on several lists.
It's the whole code which you must put inside the Thread, not just the printing of one list.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.