From 56e8a0053e35718f634586bdb14f066c65fad104 Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Sat, 29 Aug 2020 14:28:27 +0200 Subject: pdf download on mobile --- server/views.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'server') diff --git a/server/views.py b/server/views.py index 15fb7b1..093b902 100644 --- a/server/views.py +++ b/server/views.py @@ -221,11 +221,12 @@ def ulist(request): # render context html = template.render(context) # render pdf using wkhtmltopdf - pdf = pdfkit.from_string(html, False, options={'javascript-delay':'1000'}) + pdf = pdfkit.from_string(html, False, options={'javascript-delay':'1000', 'no-stop-slow-scripts':False}) # build response filename = document.user.username + "_" + document.document_type.name + ".pdf" response = HttpResponse(pdf, content_type='application/pdf') response['Content-Disposition'] = 'attachment; filename="' + filename + '"' + response['Content-Length'] = len(pdf) return response # deapprove user @@ -603,11 +604,12 @@ def doclist(request): context = {'doc': doc, 'vac': vac_file, 'health': health_file, 'sign_doc_file': sign_doc_file} html = template.render(context) - pdf = pdfkit.from_string(html, False, options={'javascript-delay':'1000'}) + pdf = pdfkit.from_string(html, False, options={'javascript-delay':'1000', 'no-stop-slow-scripts':False}) # build response filename = document.user.username + "_" + document.document_type.name + ".pdf" response = HttpResponse(pdf, content_type='application/pdf') response['Content-Disposition'] = 'attachment; filename="' + filename + '"' + response['Content-Length'] = len(pdf) return response # get selected documents and check if user has permission to view -- cgit v1.2.1