wx.html.HtmlDCRenderer

Inheritance diagram for wx.html.HtmlDCRenderer:



Description

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 wx.html.HtmlEasyPrinting or wx.html.HtmlPrintout is strongly recommended.

Derived From

Properties Summary

Class API

Methods

__init__()
No docstrings available for this method.

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.


Returns:

int


Render(x, y, known_pagebreaks, from=0, dont_render=False, to=sys.maxint)

Renders HTML text to the DC.

Parameters:

  • x, y (int): position of upper-left corner of printing rectangle (see SetSize)
  • known_pagebreaks (list of integers)
  • from (int): y-coordinate of the very first visible cell
  • dont_render (bool): if True then this method only returns y coordinate of the next page and does not output anything
  • to (int): y-coordinate of the very last visible cell

Returns:

int

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.


SetDC(dc, pixel_scale=1.0)

Assign DC instance to the renderer.

pixel_scale can be used when rendering to high-resolution DCs (e.g. printer) to adjust size of pixel metrics.

Many dimensions in HTML are given in pixels – e.g. image sizes. 300x300 image would be only one inch wide on typical printer. With pixel_scale = 3.0 it would be 3 inches.

Parameters:

  • dc (wx.DC)
  • pixel_scale (double)

SetFonts(normal_face, fixed_face, sizes=None)

Sets fonts. See wx.html.HtmlWindow.SetFonts for detailed description.

Parameters:

  • normal_face (string)
  • fixed_face (string)
  • sizes (int)

SetHtmlText(html, basepath="", isdir=True)

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

Parameters:

  • html (string): HTML text. This is not a filename.
  • basepath (string): base directory (html string would be stored there if it was in file). It is used to determine path for loading images, for example.
  • isdir (bool): False if basepath is filename, True if it is directory name (see wx.FileSystem for detailed explanation)

SetSize(width, height)

Set size of output rectangle, in pixels.

Parameters:

  • width (int)
  • height (int)

Note

You can’t change width of the rectangle between calls to Render! (You can freely change height).


SetStandardFonts(size=-1, normal_face="", fixed_face="")

Parameters:

  • size (int)
  • normal_face (string)
  • fixed_face (string)

Properties

TotalHeight
See GetTotalHeight