'`width, height`: page width and height in pixels
`base_dir`: The directory in which the HTML file that contains the table resides'

def __init__(self, html, base_dir, width, height, dpi, factor):

    from calibre.gui2 import secure_web_page
    QObject.__init__(self)
    self.app = None
    (self.width, self.height, self.dpi) = (width, height, dpi)
    self.base_dir = base_dir
    self.images = []
    self.tdir = tempfile.mkdtemp(prefix='calibre_render_table')
    self.loop = QEventLoop()
    self.page = QWebPage()
    secure_web_page(self.page.settings())
    self.page.loadFinished.connect(self.render_html)
    self.page.mainFrame().setTextSizeMultiplier(factor)
    self.page.mainFrame().setHtml(html, QUrl(('file:' + os.path.abspath(self.base_dir))))
