1. andy rubey
  2. PowerBuilder
  3. Thursday, 13 June 2024 13:21 PM UTC

DataWindow.Print.PrinterName is not setting the printer, always defaults to default.

I cannot get the simplest sample to work.

 // Setting Printer Name in PowerBuilder
string ls_printername
ls_printername = "\\\\ServerName\\PrinterName"
dw_1.Object.DataWindow.Print.PrinterName = ls_printername


// Verify if the printer name was set correctly
string ls_setprintername
ls_setprintername = dw_1.Object.DataWindow.Print.PrinterName
MessageBox("Printer Name Set To", ls_setprintername)

 

Accepted Answer
David Peace (Powersoft) Accepted Answer Pending Moderation
  1. Thursday, 13 June 2024 13:47 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi Andy

It's not something that we have used but I think that you might be using the wrong property of the DW. I found this in the help:

Syntax

PowerBuilder dot notation:

dw_control.Object.DataWindow.Printer = "printername"

Describe and Modify argument:

"DataWindow.Printer" { = printername }"

This is using .Printer rather than .Print.Printername

Comment
  1. Andreas Mykonios
  2. Thursday, 13 June 2024 13:58 PM UTC
I think both should work. But there is a minor difference. If printer set to DataWindow.Printer isn't found, the datawindow will not be printed, If the printer specified in DataWindow.Print.PrinterName isn't found and CanUseDefaultPrinter is checked, then the datawindow will be printed to the default printer. Also, the printer name property in the designer updates DataWindow.Print.PrinterName.

Andreas.
  1. Helpful 2
  1. Andreas Mykonios
  2. Thursday, 13 June 2024 14:01 PM UTC
Also, when using DataWindow.Printer to print to a network driver you should specify the path to the printer.

Andreas.
  1. Helpful 2
  1. Armeen Mazda @Appeon
  2. Thursday, 13 June 2024 17:37 PM UTC
Thanks for your help Andreas to point out the differences!
  1. Helpful
There are no comments made yet.
andy rubey Accepted Answer Pending Moderation
  1. Thursday, 13 June 2024 19:14 PM UTC
  2. PowerBuilder
  3. # 1

Thanks for the fast replies, I got it figured out.  It was actually in the way the Azure Virtual Device was returning printers vs Citrix to our app.  

Comment
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Thursday, 13 June 2024 13:36 PM UTC
  2. PowerBuilder
  3. # 2

Hi.

You have to use the name of the printer... Is "\\\\ServerName\\PrinterName" a valid printername on your machine?

Andreas.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.