1. Daniel Vivier
  2. PowerBuilder
  3. Thursday, 21 April 2022 17:56 PM UTC

We want to use the WebBrowser control in PB2021 to load HTML files and save them as PDF. We have working code, but it is adding a header and footer to the page. We need to not have those!

Is there a way to force that? Maybe some JavaScript?

I have actually found a bunch of posts online with suggested CSS to put in an @media print { ... } section to control this, but they only work for single-page documents, because they set the @page margins to 0 (which prevents the header and footer from printing) and then set margins on the body. Unfortunately those margins on the body only apply to the top of the first page and the bottom of the last page, which is not good!

Thanks.

Daniel Vivier Accepted Answer Pending Moderation
  1. Monday, 25 April 2022 13:27 PM UTC
  2. PowerBuilder
  3. # 1

Perhaps this could be an enhancement request for the WebBrowser control? It's obviously possible with Chromium (or WebView2, if Appeon switches to that) since there is a UI in Chrome, and command-line option for headless Chrome commands, that omits headers and footers on the printed pages (or ones saved to PDF).

Also I'm testing AntView, an ActiveX cover for WebView2, and it doesn't add headers and footers when saving to PDF. 

Comment
  1. Armeen Mazda @Appeon
  2. Monday, 25 April 2022 15:11 PM UTC
Hi Dan, We do use Chromium. Please email product enhancement requests to product@appeon.com. Thanks.
  1. Helpful
  1. Daniel Vivier
  2. Monday, 25 April 2022 15:16 PM UTC
Thanks, Mark. That seems way too complicated for our usage - it really needs to be an enhancement to the WebBrowser's API.

Thanks, Armeen, I did email it in now as an enhancement request.
  1. Helpful
  1. Mark Goldsmith
  2. Monday, 25 April 2022 15:47 PM UTC
You're welcome Dan and fully agree on the need for the enhancement. As well I can certainly appreciate wanting to keep it simple. Sometimes I'll take a bit of complexity before having to purchase a third party control like AntView (and nothing against them) if I can accomplish the same without additional license costs and another control to manage. Hopefully Appeon will accept your enhancement request and soon lol. If you have a change of heart let me know and I'll share some code with you (for MS Word).

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