the xhtml2pdf doc point to weasyprint [1]. After a quick look at the
doc [2], it look like a simple way to generate pdf from html file.
If you already have a url on your django app rendering the quote, I
would use weasyprint like that:
from io import BytesIO
from django.http.response import HttpResponse
from django.urls import reverse
from weasyprint import HTML
def view(request):
pdf = BytesIO()
HTML(url=reverse("app:quote").write_pdf(pdf)
return HttpResponse(pdf.getvalue(), content_type="application/pdf")
I haven't tested the code, but It should work, assuming "app:quote"
resolve to an actual url :)
[1] http://weasyprint.org/
[2] http://weasyprint.readthedocs.io/en/latest/tutorial.html#as-a-python-library
2016-10-03 14:05 GMT+02:00 M Hashmi <mhashmi1979@gmail.com>:
> Hi,
>
> I need some simple library to convert a simple quote form to PDF. I tried
> xhtml2pdf and few others but need really simple process to use but creating
> a fancy pdf.
>
> If anyone knows please let me know.
>
> Regards,
> Mudassar
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscribe@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CANoUts5Bz-bWq7vr%2BJtBOnDKj9EzkpnxYE5z2T9CV1TAN2Nr%2Bw%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
--
Cordialement, Coues Ludovic
+336 148 743 42
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEuG%2BTbinwRLBA0ZDafvoTww-MD%2Bejmhpj2KcPNpZuKkT0tdnQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment