1. Andreas Mykonios
  2. PowerBuilder
  3. Monday, 19 July 2021 15:35 PM UTC

Hi everyone.

We want to generate some reports (not from a datawindow). We can generate the information we need to an html file. Then we want to create a pdf from that html. It works fine, but it adds some information on the header and the footer, as shown bellow:

Is there any way to disable this information while using printas pdf? We don't want any other information to be included in the pdf except the contents of our html file.

Thank's.

Andreas.

Alexander Strelkov Accepted Answer Pending Moderation
  1. Wednesday, 21 July 2021 07:03 AM UTC
  2. PowerBuilder
  3. # 1

I recently developed a visual component (PBEdgeControl) for working with HTML5, JavaScript, CSS etc. based on MS Edge WebView2 (Chromium) control. You can download it from here. Read API reference guide for detail information. Hope it solves your prolem and will be helpful.

Comment
  1. Miguel Leeuwe
  2. Wednesday, 21 July 2021 09:11 AM UTC
Alexander, this is awesome!



Hower, I'm getting this error when I try to print to PDF in this line of your code:

li_rc = tp.CallDevToolsProtocolMethod(0, "Page.printToPDF", '{"landscape":true, "transferMode":"ReturnAsBase64"}')

---------------------------

CallDevToolsMethodCompleted

---------------------------

Result code: 0x80070057

The parameter is incorrect.

Result Json object:

---------------------------

OK

---------------------------

Any idea?

regards
  1. Helpful
  1. Alexander Strelkov
  2. Wednesday, 21 July 2021 09:43 AM UTC
Miguel,

I've tried this method too with the same result. MS support team is silent. Possibly they (MS) fix it in future version of WebView2. Until now you can play with json-parameters.
  1. Helpful
  1. Miguel Leeuwe
  2. Wednesday, 21 July 2021 12:39 PM UTC
That explains a lot. Fortunately I myself don't need to print to pdf this way yet. Maybe a workaround for people would be to Print to pdf. Windows 10 should have it always incorporated and officially everyone would be on w10 ( lol ).

Thank you very much for sharing this control, it might be very valuable for some people.

Cheers!
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Tuesday, 20 July 2021 20:40 PM UTC
  2. PowerBuilder
  3. # 2

I've made the feature request, to save anyone some time:

https://www.appeon.com/standardsupport/track/view?id=6968

 

Comment
There are no comments made yet.
Dan Cooperstock Accepted Answer Pending Moderation
  1. Monday, 19 July 2021 22:49 PM UTC
  2. PowerBuilder
  3. # 3

If you know your users will have Chrome installed, you can use a "headless chrome" command line to save the HTML to PDF using Chrome, with no header or footer. I can look up the command we are using, if you think that would be a decent solution for your case.

Comment
  1. Miguel Leeuwe
  2. Tuesday, 20 July 2021 17:08 PM UTC
I you'd use the new browser control (maybe an invisible control somewhere), which is based on the Chrome engine, wouldn't that solve the problem of users having to have Chrome installed?
  1. Helpful
  1. Dan Cooperstock
  2. Tuesday, 20 July 2021 17:20 PM UTC
Miguel, you can't use the new web browser control with command-line arguments, the way Andreas and I were discussing for use with chrome.exe. And I believe what he is saying (and nobody has contradicted) is that there's currently no way to remove the header and footer from that new web browser control when you print with it.
  1. Helpful
  1. Miguel Leeuwe
  2. Tuesday, 20 July 2021 20:11 PM UTC
Hi Dan, I see what you mean now.

The new webbrowser is based upon the open source CEF browser if I'm not mistaken. It certainly would allow to set the values you want: http://cefsharp.github.io/api/75.1.x/html/T_CefSharp_PdfPrintSettings.htm

but .... of course how to access that from the Appeon implementation of the webbrowser. Maybe using JS ?

regards and thanks for explaining.

  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 19 July 2021 16:19 PM UTC
  2. PowerBuilder
  3. # 4

Hi Andreas;

  Have you tried the PrintAsPDF() command instead?

Regards ... Chris

Comment
  1. Chris Pollach @Appeon
  2. Monday, 19 July 2021 21:36 PM UTC
Hi Andres;

Not currently that I know of. This would probably require an enhancement.

Regards ... Chris
  1. Helpful
  1. Miguel Leeuwe
  2. Tuesday, 20 July 2021 20:31 PM UTC
As much as I love the new webbrowser. Maybe we could save time by requesting Appeon, to give us FULL control over ALL of the properties and functionalities available in CEF. It's going to be a very long way if we have to request them one by one and I'll probably end up implementing my "own" visual ActiveX when I need the next functionality.

I'm already getting a warning when navigating to https://www.google.es telling me that my chrome browser is "outdated".

regards.

  1. Helpful
  1. Andreas Mykonios
  2. Wednesday, 21 July 2021 07:39 AM UTC
Hi Miguel.

Thanks.

I also like the webbrowser control an we have an application in which we use it a lot. There are cases where it can be more usefull than an RTE control.



Andreas.
  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.