and now for something completely different

This commit is contained in:
Sanj 2011-06-21 01:56:58 +05:30
parent 4b32d446ba
commit a1a701dad9

View File

@ -641,17 +641,19 @@ def product_pdf(request):
def article_pdf(request):
a_id = request.GET['id']
article = get_object_or_404_json(Article, pk=a_id)
dpi = request.GET.get('dpi', 200)
dpi = request.GET.get('dpi', 300)
width_mm = request.GET.get('width', article.typ.print_width)
height_mm = math.ceil(width_mm // article.typ.aspect_ratio)
pages = Page.objects.filter(article=article).order_by('page_no')
m = article.get_print_multiplier(dpi)
url = SITE_BASE + "/edit/view_article/%d/?m=%f" % (article.id, m)
# url_list = [url]
url_list = [url]
'''
url_list = []
for p in pages:
url = SITE_BASE + "/edit/view_article/%d/?m=%f&p=%d" % (article.id, m, p.id)
url_list.append(url)
'''
output_path = MEDIA_ROOT + "/pdf/" + article.name + "_" + str(article.current_revision()) + ".pdf"
pdf_path = print_url_list(url_list, width_mm, height_mm, dpi, output_path)
return HttpResponseRedirect(pdf_path.replace(MEDIA_ROOT, "/static"))