首页 > 如何使用django_easy_pdf 将HTML导出成PDF?

如何使用django_easy_pdf 将HTML导出成PDF?

需求:

1、在django下面将HTML导出成PDF

问题:

我使用的是easy_pdf,运行时提示 int() argument must be a string or a number, not 'tuple' 

我的views:

from easy_pdf.views import PDFTemplateView
class HelloPDFView(PDFTemplateView):
    template_name = "123.html"

def get_context_data(self, **kwargs):
    return super(HelloPDFView, self).get_context_data(
        pagesize="A4",
        title="Hi there!",
        **kwargs
    )

我的URLs:

from books.views import HelloPDFView

url(r"^hello$", HelloPDFView.as_view()),


如果是简单的HTML,比如<h1>test</h1>这种的他生成就没问题。他对HTML中的CSS有什么要求? 不能贴附件吗? 把我的HTML模板贴上来。

【热门文章】
【热门文章】