阅读背景:

如何在wkhtmltopdf上添加页脚和标题? (Django的)

来源:互联网 

My views look like this:

我的观点如下:

from django.shortcuts import render
from django.views.generic.base import View
from wkhtmltopdf.views import PDFTemplateView
from wkhtmltopdf.views import PDFTemplateResponse

class MyPDF(PDFTemplateView):
    filename = 'my_pdf.pdf'
    template_name = 'my_template.html'
    header_template='header.html'
    footer_template='footer.html'
    context={'title': 'Testis'}
    cmd_options = {'margin-top': 3}


    def get(self, request):
        response = PDFTemplateResponse(request=request,
                                   template=self.template_name,
                                   context=self.context,
                                   header_template=self.header_template,
                                   footer_template=self.footer_template,
                                   cmd_options=self.cmd_options
                                   )
        return response
from djan



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: