GithubHelp home page GithubHelp logo

django-pdfkit's Introduction

Django PDFKit

Django view that converts HTML to PDF using webkit - via pdfkit and wkhtmltopdf.

Build Status Code Health Code Coverage Documentation Status Latest Version Supported Python versions Downloads

Prerequisites

You need to install wkhtmltopdf.

The versions in Debian/Ubuntu repositories (installed using apt-get install wkhtmltopdf) have reduced functionality and you will most likely want to install one of the stable binaries provided at http://wkhtmltopdf.org/downloads.html which provide increased functionality (headless, patched Qt, better rendering support).

Installation of the pre-compiled binaries on Ubuntu is as simple as;

wget http://download.gna.org/wkhtmltopdf/0.12/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
tar -xf wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
sudo cp -r wkhtmltox/* /usr/

Install

pip install django-pdfkit

Usage

Simply use the class based PDFView which is a drop in replacement for TemplateView.

# urls.py
from django_pdfkit import PDFView

...
url(r'^my-pdf/$', PDFView.as_view(template_name='my-pdf.html'), name='my-pdf'),
...

Then in your browser goto http://localhost:8000/my-pdf/ and it will magically render as a PDF.

See the docs for more information.

Author

Alex Hayes <[email protected]>

django-pdfkit's People

Contributors

alexhayes avatar cahersan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

django-pdfkit's Issues

Email attachment

Useful package, thanks for this. But there is way to for instance use it to generate email attachment. I understand that I can use plain pdfkit.
Maybe it should be refactored to PDF class with all the methods from PDFView and PDFView should be a wrapper over it?

Compatibility with pdfkit==0.6.1

ERROR: Cannot install django-pdfkit==0.3.1 and pdfkit==0.6.1 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested pdfkit==0.6.1
    django-pdfkit 0.3.1 depends on pdfkit<=0.6.0 and >=0.5.0

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

I have to pin both django-pdfkit and pdfkit because pdfkit 0.6.1 fixes an important bug, but django-pdfkit only accepts up to 0.6.0. This results in a conflict that I can't resolve until it's fixed here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.