********************** wx.html.HtmlDCRenderer ********************** Inheritance diagram for `wx.html.HtmlDCRenderer`: | .. inheritance-diagram:: 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 ^^^^^^^^^^^^^ * `wx.Object <../Widgets/wx.Object.html>`_ Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `GetTotalHeight <#GetTotalHeight>`_ * `Render <#Render>`_ * `SetDC <#SetDC>`_ * `SetFonts <#SetFonts>`_ * `SetHtmlText <#SetHtmlText>`_ * `SetSize <#SetSize>`_ * `SetStandardFonts <#SetStandardFonts>`_ Properties Summary ^^^^^^^^^^^^^^^^^^ * `TotalHeight <#TotalHeight>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__() `No docstrings available for this method.` -------- .. method:: GetTotalHeight() Returns the height of the HTML text. This is important if area height (see `SetSize <#SetSize>`_) is smaller that total height and thus the page cannot fit into it. In that case you're supposed to call `Render <#Render>`_ as long as its return value is smaller than `GetTotalHeight`. | **Returns:** `int` -------- .. method:: 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 <#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): * `SetDC <#SetDC>`_ * `SetSize <#SetSize>`_ * `SetHtmlText <#SetHtmlText>`_ `Render()` changes the DC's user scale and does **not** restore it. -------- .. method:: 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 <../Widgets/wx.DC.html>`_) * `pixel_scale` (double) -------- .. method:: 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) .. seealso:: `SetSize <#SetSize>`_, `wx.html.HtmlWindow.SetFonts `_ -------- .. method:: SetHtmlText(html, basepath="", isdir=True) Assign text to the renderer. `Render <#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 <../Widgets/wx.FileSystem.html>`_ for detailed explanation) -------- .. method:: 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 <#Render>`_! (You can freely change height). -------- .. method:: SetStandardFonts(size=-1, normal_face="", fixed_face="") | **Parameters:** * `size` (int) * `normal_face` (string) * `fixed_face` (string) -------- Properties ^^^^^^^^^^ .. attribute:: TotalHeight See `GetTotalHeight <#GetTotalHeight>`_