Search code examples
plonewkhtmltopdfdiazo

Plone collective.sendaspdf ignores diazo theme


I have a plone-site where I want to use collective.htmltopdf based on wkhtmltopdf for PDF-generation.

However when I print my site, the diazo theme doesn't get applied. The header HTTP_X_THEME_ENABLED is correctly passed to diazo.

There is no condition in rules.xml. The pages in question are public. I tried HTTPS and HTTP.

Why do the diazo rules not apply to wkhtmltopdf?

UPDATE I

The above is not true, when using wkhtmltopdf from my workstation. Smells like routing...


Solution

  • It is the way collective.wkhtmltopdf deals with the page source: It gets generated from a view (not via https) and looses the information about the theme there. When I quick-hack a url-source into the source, everything works as expected.

    In collective.sendaspdf-3.0-py2.7.egg/collective/sendaspdf/transforms/wk.py

        # Run the wkhtmltopdf command.
        args = [wk_command,
                '--disable-javascript',
                '--encoding',
                'utf-8',
                'http://ww2.mypage.com',
                #'file://%s/%s' % (export_dir, html_filename),
                '%s/%s' % (export_dir, filename)]
    

    This cries for a pull request...