• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Is there a way for MS Word VBA to change the printer in Acrobat?

Explorer ,
Sep 02, 2024 Sep 02, 2024

Copy link to clipboard

Copied

Hi,

I have a batch of pdf files which I want to print on 2 identical printers simultaneously in the correct order. Currently, I am using a Word vba macro to do this on a Windows 11 system. The macro opens each document in Adobe Acrobat and prints using OLE Automation and using Adobe Acrobat 10.0 Type Library. Here is my current workflow:

 

  1. Set Windows default printer to Printer1
  2. Open document in Acrobat
  3. Print document on Printer1
  4. Close document
  5. Close Adobe Acrobat
  6. Set Windows default printer to Printer2
  7. Open document in Acrobat
  8. Print document on Printer2
  9. Close document
  10. Close Adobe Acrobat

 

Then repeat these steps for the next document. And so on.

 

While this all works fine, it seems inefficient and slow, needing to open the same document twice to print to the two separate printers. On opening the document, Acrobat prints to the default Windows printer, hence the need to close it, change the default printer, then reopen it.

 

Surely, there must be a better way to do this. It should be possible to achieve this:

 

  1. Open document in Acrobat
  2. Print document to Printer1
  3. Print document to Printer2
  4. Close document
  5. Close Adobe Acrobat

 

My macro uses PrintPagesSilent to print the documents.

 

My question is:

 

Is there a command to select the printer in Acrobat before executing the .PrintPagesSilent command or a command that prints to a specific printer?

 

I can't seem to find one.

 

Based on some research, I have explored using a javascript object in VBA. Here's an extract:

 

If AcroAVDoc.Open(DocName, "") Then

Set acroPDDoc = AcroAVDoc.GetPDDoc

Set jso = acroPDDoc.GetJSObject
Set pp = jso.getPrintParams
pp.PrinterName = "Myprinter"
pp.interactive = pp.Constants.interactionLevel.automatic
jso.Print (pp)

AcroApp.CloseAllDocs

AcroApp.Exit

End If

 

However, this gets stuck on the last line: 'jso.Print (pp)'

 

I would be grateful for any assistance to streamline my workflow.

 

Many thanks!

TOPICS
Acrobat SDK and JavaScript

Views

439

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 04, 2024 Sep 04, 2024

Copy link to clipboard

Copied

LATEST

I have solved my issue. Please ignore this request. If possible, perhaps someone can delete this question. Thanks!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines