Skip to main content
Participant
January 18, 2017
Question

Printing to a SPECIFIC printer

  • January 18, 2017
  • 0 replies
  • 919 views

Hi, I have looked around but cannot find any solution to my problem.

Background

I have developed a basic VB.NET FORM application for printing production tickets to various printers, using the Adobe Reader ActiveX control in a 32bit environment.

Our company has a 5 different printers that my application must print to. The ONLY print command that I can use with the embedded ActiveX control is AxAcroPDF1.printAllFit(iPageFrom, iPageTo,True).

This will send the PDF to the default printer and this work fine and no problems.

Issue

I need to print the PDF to a different printer from time to time. So what I do is I change the default printer and then re-issue the print command AxAcroPDF1.printAllFit(iPageFrom, iPageTo,True) to send the PDF to the new printer.

I do this in one routine, so first I use issue ;

  • Shell(String.Format("rundll32 printui.dll,PrintUIEntry /y /n ""{0}""", PrinterName))   -> this changes the default printer perfectly in the background,

However, when I issue the AxAcroPDF1.printAllFit(iPageFrom, iPageTo,True) command again, it STILL prints to previous printer even if the default printer has been changed. [as I can see the change in my printers and devices section in control panel]

It appears that once the control has been embedded/loaded into the form it almost locks the last printed printer setting and will ONLY work if I close and reopen the form.

I tried to programmatically unload the control , refresh the control ..but nothing works.

Any help will be GREATLY appreciated.

Thanks in advance, Philip.

    This topic has been closed for replies.