From 2ea1d28e117edf09ae1054ac90822b072b9864e1 Mon Sep 17 00:00:00 2001 From: Sanj Date: Wed, 6 Jul 2011 18:52:30 +0530 Subject: [PATCH] err .. --- edgware/editor/print_pdf.py | 2 +- edgware/editor/views.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/edgware/editor/print_pdf.py b/edgware/editor/print_pdf.py index 0bb1a63..6215a1d 100644 --- a/edgware/editor/print_pdf.py +++ b/edgware/editor/print_pdf.py @@ -4,7 +4,7 @@ def print_url_list(urls, width, height, dpi, output_path): clean_urls = [] for u in urls: clean_urls.append("'" + u + "'") - cmd = "wkhtmltopdf -B 0 -L 0 -R 0 -T 0 --page-width %d --page-height %d -d %d %s '%s'" % (width, height, dpi, " ".join(clean_urls), output_path,) + cmd = "wkhtmltopdf -L 0 -R 0 -T 0 -B 0 --disable-smart-shrinking --page-width %d --page-height %d -d %d %s '%s'" % (width, height, dpi, " ".join(clean_urls), output_path,) # print cmd os.system(cmd) return output_path diff --git a/edgware/editor/views.py b/edgware/editor/views.py index d751632..fa94bc1 100644 --- a/edgware/editor/views.py +++ b/edgware/editor/views.py @@ -648,9 +648,10 @@ 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', 1200) + dpi = request.GET.get('dpi', 600) width_mm = request.GET.get('width', article.typ.print_width) - height_mm = int(round(width_mm / article.typ.aspect_ratio)) + width_mm = width_mm + .0 + 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)