Open drgarcia1986 opened 9 years ago
Example
from weasyprint import HTML
class FromTemplate(APIView):
renderer_classes = (PDFRenderer, )
def get(self, request):
pdf = StringIO()
# This example may change to a new drf-pdf response
HTML(string='<h1>Foo</h1>').write_pdf(pdf)
return PDFResponse(
pdf.getvalue(),
file_name='example',
status=status.HTTP_200_OK
)
We could do this using render_to_string (from django.template.loader)
May I know what are you trying to achieve here?
http://weasyprint.org/docs/