Print header for wxWebView

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
SalmonsSteve
Knows some wx things
Knows some wx things
Posts: 27
Joined: Sun Jun 24, 2012 6:00 pm

Print header for wxWebView

Post by SalmonsSteve »

I have a wxWebView control on a panel displaying an html documented consisting primarily of pre-formatted text output created by a calculation dll. The output, when printed, is usually between 3 and 7 pages long. I want to put a header and a footer on each page but I'm really not sure how to do it. I can print using wxWebview::Print() but I do not see any method for setting a header or a footer and those are items that I do not want to have to include in the display.
User avatar
doublemax
Moderator
Moderator
Posts: 19164
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Print header for wxWebView

Post by doublemax »

wxWebView::Print() just calls the Print function from the browser, there is nothing inside wx to put a header on each page.

But there might be a way on the HTML/CSS side:
https://stackoverflow.com/a/35662608
(Untested, i just Googled it).
Use the source, Luke!
SalmonsSteve
Knows some wx things
Knows some wx things
Posts: 27
Joined: Sun Jun 24, 2012 6:00 pm

Re: Print header for wxWebView

Post by SalmonsSteve »

Thank you, doublemax. I will take a look at that.
Looking at this from another direction, and I'm sorry I haven't personally tried to implement this before the question, can a wxHtmlWindow be placed on a panel? I notice in the wxHtmlEasyPrinting class there are methods for setting the header and the footer so I was thinking that it may be easier to use this with a wxHtmlWindow than dealing with whatever printing is available through wxWebView. The Html that I am rendering is actually super basic in that it is actually just a text file to start. Each line is read in and then wrapped with <pre> ... </pre> to display the pre-formatted text. At some point the html may become more complicated but definitely not in the next release of this program.
User avatar
doublemax
Moderator
Moderator
Posts: 19164
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Print header for wxWebView

Post by doublemax »

can a wxHtmlWindow be placed on a panel?
Yes. If you can live with its limitations, you can use it just like a text control or any other control.
Use the source, Luke!