This is an archived forum post. The information may be outdated. Contact us if you have any questions.

Unable to generate PDF output

prismforimpact wrote on 2017-06-01:
I'm getting 502 - Sorry, we couldn't process your request. please help me out its so urgent !
url :http://prismforimpact.com/view_report1/71/6a951f10-4f12-4492-b731-320cfe0ebaaf/


code used to configure :


@login_required
def generate_pdf_view(request):
if request.user.groups.filter(name='Small-Enterprises'):
paths = path = request.GET.get('paths', None)
else:
path = request.GET.get('path', None)
try:
if request.user.groups.filter(name='Small-Enterprises'):
if paths:
html = "<div>%p/%n</div>"


#client.setFooterHtml(html)
#client.setPageHeight("297mm")
#client.setPageWidth("210mm")
#client.setHtmlZoom('100%')
pdf = client.convertURI(paths)
response = HttpResponse(content_type="application/pdf")
response["Cache-Control"] = "no-cache"
response["Accept-Ranges"] = "none"
response["Content-Disposition"] = "attachment; filename=prismforimpact_com.pdf"
response.write(pdf)

else:
response = HttpResponse(content_type="text/plain")
response.write("No Report Fo
und")
except pdfcrowd.Error, why:
response = HttpResponse(content_type="text/plain")
response.write(why)
return response
support wrote on 2017-06-05:
Hello,

Our system is unable to convert the page to PDF in under 40 seconds which is the hard limit for PDF processing on our end. In cases like this we recommend that you split the input HTML code into smaller chunks, convert each separately and then join the PDFs together using a third party tool. We frequently use and can recommend a command line tool called pdftk.

-- https://www.pdflabs.com/tools/pdftk-server