my code is:
view
class PDFHandler(APIView):
class SimpleExample(APIView):
renderer_classes = (PDFRenderer)
def get(self, request):
pdf = BytesIO()
gen_pdf = canvas.Canvas(pdf)
gen_pdf.drawString(100, 100, 'Simple example')
gen_pdf.showPage()
gen_pdf.save()
return PDFResponse(
pdf.getvalue(),
file_name='example',
status=status.HTTP_200_OK
)
html :
<input id="new" type = "button" value = "crear archivo">
<script>
$(function () {
$('#new').click(function() {
$.ajax({
type: "GET",
dataType: "JSON",
url: "/pdf/",
contentType: "application/json;charset= utf-8",
success: function (data) {
}
})
});
});
</script>
result in the page is
<https://lh3.googleusercontent.com/--xYLYP9w80s/V_fXhsea6LI/AAAAAAAAAro/26_-LQbn9vgptUTus5vsqbG0As-PtSPiACLcB/s1600/res.png>
how to send PDF and show in the html???? :S
--
You received this message because you are subscribed to the Google Groups
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.