1. Tomas Beran
  2. PowerBuilder
  3. Tuesday, 15 August 2023 18:03 PM UTC

Hi

is it possible to print from the new webview2 based webbrowser component included in PB 2022 R2 (build 2819)?

Print() method just opens preview.

Print(job, x, y) through job prints an empty page.

Is there a workaround through Javascript etc? I remember in old IE times some vbscript was necessary for correct printing.

Tomas Beran Accepted Answer Pending Moderation
  1. Thursday, 17 August 2023 11:35 AM UTC
  2. PowerBuilder
  3. # 1

Hi Kai,

the preview mode is not huge problem. It's just few additional clicks and inconsistency between Print and Print Preview. The question was more about a workaround like registry settings which makes "Print using system dialog" as a default action for print or javascript injection.

The method with generating PDF and printing with an associated application looks good but can anybody prove it works on computers with Adobe Acrobat Pro installed?

Thank you

Comment
There are no comments made yet.
Kai Zhao @Appeon Accepted Answer Pending Moderation
  1. Thursday, 17 August 2023 02:46 AM UTC
  2. PowerBuilder
  3. # 2

Hi Tomas,

Do you want to print WebBrowser without the dialog? Currently the print function of WebBrowser is using javascript. There is no feasible way to work around it.
I will record it as a new enhancement/requirement request and will transfer it to our product team for consideration.

Please try using PrintAsPDF(string PdfFile) to print web page as a PDF file without the user dialog, then you can print the PDF file by using the external function ShellExecuteA(). Please refer to the article below to print pdf file.
https://community.appeon.com/index.php/qna/q-a/can-i-print-pdf-docs-from-my-application
https://www.rgagnon.com/pbdetails/pb-0008.html

Regards,
kai

Comment
  1. Miguel Leeuwe
  2. Thursday, 17 August 2023 03:44 AM UTC
Please don't use ShellExecuteA() but ShellExecuteW() instead.
  1. Helpful
  1. Kai Zhao @Appeon
  2. Thursday, 24 August 2023 00:24 AM UTC
Miguel, Thanks.
  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.