1. selvam G
  2. PowerBuilder
  3. Wednesday, 13 January 2021 16:16 PM UTC

Hi there,

We have recently migrated from PB 2017 to PB2019 R2 build 2328.

Our application being assessed thru Citrix. 

Application is not recognizing OS Windows 10 default printer.

it always prints to the last printer in the printer list.

I have tried the workaround as indicated in knowledge base

Windows API for GetDefaultPrinterW even it is showing up the last printer on the list as default printer.

Workstation does have a default printer set properly.

When we call printsetup(), it shows all the OS printers correctly, the issue is not the correct default printer is set.

When I run the same application PB2017 exe, default printer get set correctly without even calling windows API.

Any help is much appreciated.

Thanks

Selvam

 

Mark Lee @Appeon Accepted Answer Pending Moderation
  1. Monday, 29 November 2021 01:27 AM UTC
  2. PowerBuilder
  3. # 1

Hi All,

Good news that PowerBuilder 2021 GA (build 1288) is available for download. The
issue you reported has been fixed in this release. Please download and install
it to verify the issue you reported and let us know if any problems. 
You can get the installer from our Downloads portal at
https://account.appeon.com/download (login required).
 
In this version, we have enhanced the PrintGetPrinter function to gain the default printer in real-time. 
Previously, the printer name the PrintGetPrinter function gains is the default printer when the app is launched. And this printer name now won’t be changed regardless of the modification of the Windows default printer settings, but you can use the PrintSetPrinter() commands to set the new default printer.
 
In PowerBuilder 2021, if you are using Citrix, you can get the Windows default printer in real-time dynamically once the following configuration is set:
You should add a pb.ini file in the directory where the EXE resides, this pb.ini file contains the below content:
[Application]
Citrix=1  
 
We welcome all feedback from you!


Regards,

Comment
  1. Peter Thiem
  2. Wednesday, 2 February 2022 03:53 AM UTC
Hi Mark,



I tried using pb.ini with "[Application] Citrix=1" with PowerBuilder 2021 GA (build 1311) in Citrix (on Windows Server 2016), but the application has two problems.



1. If the user prints (a window, or a RTE, for example) without ever opening the "PrintSetup()", then the application prints using the "last printer in the printer list", instead of the default printer that the local computer/citrix have set.



2. Every time the user opens the "PrintSetup()" (available in the applications menu, for this application), the selected printer reverts back to the default printer that the local computer/citrix have set, rather than the printer selected by the user when they last used "PrintSetup()".



Are these powerbuilder bugs?



Or due to not using the settings correctly?



Is there a way to have the correct printer set automatically, without having the user execute "PrintSetup()" prior to the first time of any printing?



Cheers, Peter.



P.S. Our citrix environment is siloed off from me, so it is hard to do experiments, sorry.
  1. Helpful
  1. Mark Lee @Appeon
  2. Monday, 7 February 2022 02:40 AM UTC
Hi Peter,



For issue #1, this is a Windows feature. Please confirm whether you have enabled "Let Windows manage my default printer" (Windows--->Settings---->Devices--->Printers & scanners painter). If yes, please turn it off and see if it resolves the issue.





For issue #2, it may be related to #1 and it is probably the correct behavior.



For a Citrix environment, since it requires pb.ini with "[Application] Citrix=1" settings, I recommend you specify the default printer in your code after the program starts.
  1. Helpful
There are no comments made yet.
Tracy Lamb Accepted Answer Pending Moderation
  1. Thursday, 5 August 2021 18:36 PM UTC
  2. PowerBuilder
  3. # 2

Not to pile on, but...

I'm having the same problem.  I've got a very large MDI application, with dozens and dozens of windows. This code has been running for 20+ years, through all the migrations. All of the sudden, my print functions don't work properly.  

Print Setup isn't changing the Windows default printer

Print is ignoring the chosen printer and printing to the (old) default

Print Immediate IS remember what was set in Print Setup.

Very frustrating! This is a commercial application I resell to other corporations, and I don't feel like I can release the new version with these printing bugs. And they are BUGS...

Right now I feel like upgrading to Appeon's version of PB was a mistake...

~~~Tracy

 

 

Comment
  1. Mark Lee @Appeon
  2. Tuesday, 31 August 2021 03:09 AM UTC
Hi Tracy,



Glad to hear that you can resolve one of the issues.

I can’t reproduce the issue ‘the printer dialog box shows twice’ using the code you provided. Maybe it is related to your code or environment.

I suggest you create a complete small case and see if it is reproducible and then provide it for us to further analyze.



Regards,
  1. Helpful
  1. Miguel Leeuwe
  2. Wednesday, 2 February 2022 16:20 PM UTC
Hi Tracy,

By any chance: You wouldn't be printing to "Microsoft PDF" would you? That one has the problem of trying to print once with the setup and then finally with the real print.

regards
  1. Helpful
  1. Tracy Lamb
  2. Wednesday, 2 February 2022 16:36 PM UTC
Hi there... not having any trouble with Microsoft PDF. Just with dw.Print() ignoring which printer the user selects and always printing to the default printer.
  1. Helpful 1
There are no comments made yet.
Mark Lee @Appeon Accepted Answer Pending Moderation
  1. Saturday, 8 May 2021 10:06 AM UTC
  2. PowerBuilder
  3. # 3

 Hi Kevin,


After having a few meetings with Selvam, we found out a solution and provided a new PBSHR190.dll file for him and he confirmed that it works (Ticket 5874).

Attached you can find the PBSHR190.dll file. If you confirm that your issue is the same as his, you can:

  1. Try to upgrade your PB to PB 2019 R2 2353.
  2. Backup the original PBSHR190.dll file.
  3. Replace the old one in the runtime folder with the attached one and see if it resolves your issue.

 

Regards,

Attachments (1)
Comment
  1. Olan Knight
  2. Monday, 10 May 2021 22:01 PM UTC
Mark, is this a replacement for the PB2019R3 b2703 "pbshr.dll" located in the following folder?

C:\Program Files (x86)\Appeon\Common\PowerBuilder\Runtime 19.2.0.2703



Thanks,

Olan
  1. Helpful
  1. Mark Lee @Appeon
  2. Tuesday, 11 May 2021 03:12 AM UTC
Hi Olan,



Unfortunately, this DLL was compiled based on PB 2019 R2 2353, so in theory, it couldn’t be used in PB 2019 R3 2703.

If you want to verify this issue, you can test it using the PowerBuilder 2021 Beta version. It can be downloaded from the Appeon Downloads portal https://account.appeon.com/download/beta (login required).



BTW, the PowerBuilder 2021 GA version might be released after 2 or 3 months, I am not sure about the exact date yet.



Regards,
  1. Helpful
There are no comments made yet.
Kevin Dinh Accepted Answer Pending Moderation
  1. Tuesday, 13 April 2021 20:27 PM UTC
  2. PowerBuilder
  3. # 4

Hello,

We have the same issue.  Using PB2019 R2 build 2328 connected through Citrix.  We are unable to see the default printers.  We have no issue when using PB12.5 version.

The only option from the "Print Setup" window is..
Sybase DataWindow PS on FILE:

Is there any patch or fix for this issue?

We use Citrix to host a lot of our big Customers.  This will impact and hurt our business really bad.

Any suggestions?

Thanks,

Kevin

Comment
There are no comments made yet.
selvam G Accepted Answer Pending Moderation
  1. Wednesday, 3 February 2021 22:25 PM UTC
  2. PowerBuilder
  3. # 5

 

Hi Ameen

Finally we have rolled back to PB2017 and no printing issues.
As you have mentioned, I have created two sample test applications in PB 2017 and PB 2019.

click on File- Print Setup 
It will point to correct default printer in Citrix environment for PB 2017 application.
Click on Call Api button it will show correct default printer when PrintGetPrinter as well as GetDefaultPrinterW called.

SetDefaultPrinterW does work fine.

 

Migrated that into PB2019
It will not point to correct default printer when we do print setup.
Always points to Microsoft XPS Document Writer when PrintGetPrinter called.

GetDefaultPrinterW  works fine but SetDefaultPrinterW does not work.


It does look like a regression bug.
Please let me know.

Thanks
Selvam

 

 

Attachments (1)
Comment
  1. Armeen Mazda @Appeon
  2. Thursday, 4 February 2021 01:01 AM UTC
Glad to hear you have a temporary working solution. Please open support ticket and submit your test case. https://www.appeon.com/standardsupport/newbug
  1. Helpful
There are no comments made yet.
selvam G Accepted Answer Pending Moderation
  1. Thursday, 21 January 2021 16:56 PM UTC
  2. PowerBuilder
  3. # 6

Hi Chris

I have tried your workaround of writing the default printer in ini file. 

Printgetprinters works fine but printsetprinter fails.

Support team are saying PB2019 R2 cannot support windows server 2008, that could be the issue.

Apparently PB2019 supports windows server 2008 .

My question is there anyway I can go back from PB2019 R2 to Pb2019?

This way I can solve the issue quickly.

Our application is pure client server application, no power server or web involved.

Please let me know.

Thanks

Selvam

 

Comment
  1. selvam G
  2. Thursday, 21 January 2021 18:13 PM UTC
Hi Chris

We do not have 2019 source code, we have migrated from 2017 to PB 2019 R2.

And made ton of changes on business functions but no change to print functions at all.

So, Downgrade will not be a easier solution I guess!

Yes, I do understand upgrading to 2012/ 16 windows server is the ideal way.

Thanks

Selvam
  1. Helpful
  1. selvam G
  2. Thursday, 21 January 2021 18:17 PM UTC
Hi Armeen

Same application is working in PB 2017, same workstation OS, same server. Only change is PB2019.

Obviously our infra team is pointing fingers at PB2019 R2.



Thanks

Selvam
  1. Helpful
  1. Armeen Mazda @Appeon
  2. Thursday, 21 January 2021 18:35 PM UTC
Can you make a little reproducible test case? Specifically, make a a little new app in PB 2017 that invokes the printsetprinter, and then make a backup of the PBL and migrate it to PB 2019. Test both PB 2017 and 2019 versions on Windows 10. If 2017 works but 2019 doesn't, I would recommend opening a support ticket because regression bugs on a supported feature gets high priority.
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 13 January 2021 21:33 PM UTC
  2. PowerBuilder
  3. # 7

Hi Selvam;

  I was pretty sure that MR2353 would not be the answer as it contained no printer fixes. Either my suggestion in ticket #5864 or Olan's would be the workaround(s) for now AFAIK.

  Lets see what the main Support / Engineering says on the open ticket.

Regards ... Chris

Comment
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Wednesday, 13 January 2021 18:55 PM UTC
  2. PowerBuilder
  3. # 8

I have the exact same setup.

My solution was as follows:
1. On the main window, there is a field that shows the current printer

2. On the main window, there is a button that pops up a response window that allows the user to select which printer they want.

3. If the user selects a different printer, the Windows Registry is updated to the newly selected printer, the "Current Printer" field is updated, and PrintSetPrinter(<new_printer>) is called for the app/


Olan

Comment
  1. selvam G
  2. Wednesday, 13 January 2021 19:07 PM UTC
Hi Olan,

Thanks for your suggestion.

The problem with this solution is, then user need to select the printer every time when they launch the application. This is new behavior in PB2019 where as on our older version PB2017 application, it always prints to default printer.

Thanks

Selvam
  1. Helpful
  1. Olan Knight
  2. Monday, 18 January 2021 23:12 PM UTC
Store the last selected printer for the user in the Windows Registry, and retrieve that value as the preferrend printer.

If you have a preferred printer, then set that value with script in the PostOpen event into the Current Printer as well as the application.
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 13 January 2021 18:24 PM UTC
  2. PowerBuilder
  3. # 9

Selvam;

  Thank you for opening up ticket # 5874. I have made a few suggestions in my reply and also forwarded this over to the main Support / Engineering Team. I checked in the MR #2353 and there are no Citrix/Printer fixes listed there but, it might be worth trying that MR if you have some time to test. In the mean-time, lets see what feedback we get from the main support team.

Regards ... Chris

Comment
  1. selvam G
  2. Wednesday, 13 January 2021 19:31 PM UTC
Ok, I have tried MR# 2353 and did not help. FYI please.

Thanks

Selvam

  1. Helpful
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.