Solved

Printing more than one PDF

Posted on 2009-05-07
3
711 Views
Last Modified: 2012-05-06
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

0
Comment
Question by:EVilla1979
[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
  • 2
3 Comments
 
LVL 11

Expert Comment

by:srikanthreddyn143
ID: 24330996
Is that FileList an array of strings? Debug it and check for each iteration the file path
0
 

Author Comment

by:EVilla1979
ID: 24331010
Yes it is.
Debugging step by step, the first load doesn't do anything, just the last one.
0
 

Accepted Solution

by:
EVilla1979 earned 0 total points
ID: 24335328
I found a turn around.
I changed the default printer to be another one and the page size in the printer properties, so maybe the problem of the size changing was part of that.
However I am still open to give away the 200 points if somebody tells me how to close the Acrobat once it has finished the printing.
Thanks.
For Each file As String In FileList
   Dim p As New Process
   p.StartInfo.FileName = s
   p.StartInfo.Verb = "Print"
   p.Start()
   p.Close()
   p = Nothing
Next

Open in new window

0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

734 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