Contents Up Previous Next

wxHtmlDCRenderer

This class can render HTML document into a specified area of a DC. You can use it in your own printing code, although use of wxHtmlEasyPrinting or wxHtmlPrintout is strongly recommended.

Derived from

wxObject

Members

wxHtmlDCRenderer::wxHtmlDCRenderer
wxHtmlDCRenderer::SetDC
wxHtmlDCRenderer::SetSize
wxHtmlDCRenderer::SetHtmlText
wxHtmlDCRenderer::Render
wxHtmlDCRenderer::GetTotalHeight


wxHtmlDCRenderer::wxHtmlDCRenderer

wxHtmlDCRenderer()

Constructor.


wxHtmlDCRenderer::SetDC

void SetDC(wxDC* dc, int maxwidth)

Assign DC instance to the renderer.

Parameters

maxwidth

See also SetSize.


wxHtmlDCRenderer::SetSize

void SetSize(int width, int height)

Set size of output rectangle, in pixels. Note that you can't change width of the rectangle between calls to Render! (You can freely change height.) If you set width equal to maxwidth then HTML is rendered as if it were displayed in fullscreen. If you set width = 1/2 maxwidth the it is rendered as if it covered half the screen and so on.


wxHtmlDCRenderer::SetHtmlText

void SetHtmlText(const wxString& html, const wxString& basepath = wxEmptyString, bool isdir = TRUE)

Assign text to the renderer. Render then draws the text onto DC.

Parameters

html

basepath

isdir


wxHtmlDCRenderer::Render

int Render(int x, int y, int from = 0, int dont_render = FALSE)

Renders HTML text to the DC.

Parameters

x,y

from

dont_render

Returned value is y coordinate of first cell than didn't fit onto page. Use this value as from in next call to Render in order to print multipages document.

Caution!

The Following three methods must always be called before any call to Render (preferably in this order):

Render() changes the DC's user scale and does NOT restore it.


wxHtmlDCRenderer::GetTotalHeight

int GetTotalHeight()

Returns the height of the HTML text. This is important if area height (see SetSize) is smaller that total height and thus the page cannot fit into it. In that case you're supposed to call Render as long as its return value is smaller than GetTotalHeight's.