Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add background: pipe output of wkhtml to pdftk #147

Open
benjaminderei opened this issue Jun 7, 2017 · 1 comment
Open

add background: pipe output of wkhtml to pdftk #147

benjaminderei opened this issue Jun 7, 2017 · 1 comment

Comments

@benjaminderei
Copy link

how to subclass PDFTemplateView to add another subprocess call and pipe the ouput of wkhtmltopdf to pdftk (pdftk - background background.pdf output -) ?

@notanumber
Copy link

I've done this in my fork I think with a little bit of work it could be cleaned up and possibly merged into the project but would introduce a dependency on PDFTK. I also removed the old subprocess.py module in my fork as I'm not interested in Python versions older than 2.7, but there's no reason it couldn't be re-inserted.

As-is, you can use it by setting background_template to the template you'd like to use as the background. Personally, I have something like:

{% extends 'print.html' %}
{% load staticfiles %}
{% block content %}
<div class="watermark">
    <img class="watermark-logo" src="{% static 'img/logo.png' %}">
</div>
{% endblock %}

This is working great for me. If anyone has suggestions on how this can be improved in order to be useful for anyone else, let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants