Link to home
Start Free TrialLog in
Avatar of EVilla1979
EVilla1979Flag for United States of America

asked on

Printing more than one PDF

Issue:
Printing PDFs (more than one) from VB Desktop App.

Background:
I have a Windows App in VB .NET 2005, with the imported Adobe SDK, the dlls are:
AxInterop.AcroPDFLib.dll and Interop.AcroPDFLib.dll, this allows me to add a component to my form, an AxAcroPDFLib.AxAcroPDF which I have named AxAcroPDF1
I have the following code (Code 1 below)  to print a PDF file which WORKS perfectly, but as you can see is just one PDF.

The problem:
The code 2 and Code 3, I though they will work to print more than one PDF, but actually they don't, Code 2 prints only one of them, the last in the list, and Code 3 doesn't print any.
Adobe Reader remains open after the printing is done, which is not really important but I will appreciate if somebody knows how to shut it down automatically.

Additional Notes:
I tried to use another way to print, like the System.Drawing namespace, and the trick creating a new process and do a Process.Start, but this won't work on my case because they are changing my page size not sure why.

'Code 1
AxAcroPDF1.LoadFile("C:\PDF\MyPDF.pdf")
AxAcroPDF1.printAll()
 
'Code 2
For Each file As String In FileList
    AxAcroPDF1.LoadFile(file)
    AxAcroPDF1.printAll()
Next
            
'Code 3
For Each file As String In FileList
    AxAcroPDF1.LoadFile(file)
Next
AxAcroPDF1.printAll()

Open in new window

Avatar of srikanthreddyn143
srikanthreddyn143

Is that FileList an array of strings? Debug it and check for each iteration the file path
Avatar of EVilla1979

ASKER

Yes it is.
Debugging step by step, the first load doesn't do anything, just the last one.
ASKER CERTIFIED SOLUTION
Avatar of EVilla1979
EVilla1979
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial