Skip to content

A class-based view that generated pdfs using WeasyPrint

License

Notifications You must be signed in to change notification settings

maisim/django-weasyprint

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-weasyprint

A class-based view that generated pdfs using WeasyPrint

About this fork

I combined all the forks lying around.

Then I found out weasyprint does not support 'rem' units. :( So I stopped working on it.

Then I added 'rem' support. :D And worked a little more on the mixins.

Usage

Use PDFTemplateView as class based view base class or the just the mixin PDFTemplateResponseMixin on a TemplateView (or subclass thereof).

Example

from django.conf import settings
from django.views.generic import DetailView

from django_weasyprint import PDFTemplateResponseMixin


class MyModelView(DetailView):
    model = MyModel
    template_name = 'mymodel.html'


class MyModelViewPrintView(PDFTemplateResponseMixin, MyModelView):
    stylesheets = [
        settings.STATIC_ROOT   "css/app.css",
    ]

About

A class-based view that generated pdfs using WeasyPrint

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%