How to use the imgkit.config.Config function in imgkit

To help you get started, we’ve selected a few imgkit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jarrekk / imgkit / imgkit / api.py View on Github external
def config(**kwargs):
    """
    Constructs and returns a :class:`Config` with given options

    :param wkhtmltopdf: path to binary
    :param meta_tag_prefix: the prefix for ``pdfkit`` specific meta tags
    """

    return Config(**kwargs)
github jarrekk / imgkit / imgkit / imgkit.py View on Github external
def __init__(self, url_or_file, source_type, options=None, toc=None, cover=None,
                 css=None, config=None, cover_first=None):
        self.source = Source(url_or_file, source_type)
        self.config = Config() if not config else config
        try:
            self.wkhtmltoimage = self.config.wkhtmltoimage.decode('utf-8')
        except AttributeError:
            self.wkhtmltoimage = self.config.wkhtmltoimage

        self.xvfb = self.config.xvfb

        self.options = {}
        if self.source.isString():
            self.options.update(self._find_options_in_meta(url_or_file))

        if options:
            self.options.update(options)

        self.toc = toc if toc else {}
        self.cover = cover