1)我分析一些页面以获取信息。
2) 由于它的信息很难分离,我把它安装到html页面,并用定制的css使它变得漂亮。
3) 然后我试着把它转换成pdf格式提供给客户。在
但是所有的pdf转换程序都要求提供特定的url或文件等等。例如:def parse(request):
done = csrf(request)
if request.POST:
USERNAME = request.POST.get('logins', '')
PASSWORD = request.POST.get('password', '')
dialogue_url = request.POST.get('links', '')
total_pages = int(request.POST.get('numbers', ''))
news = []
news.extend(parse_one(USERNAME, PASSWORD, dialogue_url, total_pages))
contex = {
"news" : news,
}
done.update(contex)
pageclan = render(request, 'marketing/parser.html', done)
# create an API client instance
client = pdfcrowd.Client(*** ***)
# convert a web page and store the generated PDF to a variable. That is doesn't work. Convertor doesn't support such url.
pdf = client.convertURI('pageclan')
# set HTTP response headers
response = HttpResponse(content_type="application/pdf")
response["Cache-Control"] = "max-age=0"
response["Accept-Ranges"] = "none"
response["Content-Disposition"] = "attachment; filename=jivo_log.pdf"
# send the generated PDF
response.write(pdf)
return response
有什么工具可以正常工作吗?在