Quantcast
Channel: Adobe Community: Message List - Acrobat SDK
Viewing all articles
Browse latest Browse all 10848

Change Printer in Acrobat from VBA

$
0
0

I am trying to set the printer selected in Excel to be the printer selected in Acrobat at runtime using VBA and Acrobat objects. I am unsuccessful at changing the printer name. I tried but was unable to use this.Print(adobePrintSettings)… any thoughts?

 

 

        Set gAVDoc = CreateObject("AcroExch.AVDoc")

        gAVDoc.Open sNewFile, "TW Print Utility - Temp PDF for Printing" ' open the temp PDF

        Set gApp = CreateObject("AcroExch.App")

        Set gPdDoc = gAVDoc.GetPDDoc ' set the PDF object equal the opened Adobe object

      

*** CHANGE ADOBE PRINTER  *******************

        Set adobeJSO = gPdDoc.GetJSObject ' javascript object printer settings

        Set adobePrintSettings = adobeJSO.getPrintParams

        printerAdobe = Left(printerUser, InStr(printerUser, " on ") - 1) ' truncate the network name from the printer string for Adobe

        adobePrintSettings.Interactive = 1 ' 1 = adobePrintSettings.Constants.interactionLevel.automatic

        adobePrintSettings.PrinterName = printerAdobe < NOT SETTING PRINTER NAME FOR gAVDoc

      

        gAVDoc.PrintPagesSilent 0, gPdDoc.GetNumPages - 1, 2, 1, 1 'PostScript Level 2 operators, binary data included, page is shrunk

        gAVDoc.Close 1 ' close PDF without save

        gApp.Exit

 

 

I'm sure it's just as simple as the way I am setting the .PrinterName proerty, but it won't work when the gAVDoc actually prints!

Many thanks,

Gary


Viewing all articles
Browse latest Browse all 10848

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>