This commit is contained in:
Sanj 2011-07-06 18:52:30 +05:30
parent 7989765aaa
commit 2ea1d28e11
2 changed files with 4 additions and 3 deletions

View File

@ -4,7 +4,7 @@ def print_url_list(urls, width, height, dpi, output_path):
clean_urls = [] clean_urls = []
for u in urls: for u in urls:
clean_urls.append("'" + u + "'") 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 # print cmd
os.system(cmd) os.system(cmd)
return output_path return output_path

View File

@ -648,9 +648,10 @@ def product_pdf(request):
def article_pdf(request): def article_pdf(request):
a_id = request.GET['id'] a_id = request.GET['id']
article = get_object_or_404_json(Article, pk=a_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) 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') pages = Page.objects.filter(article=article).order_by('page_no')
m = article.get_print_multiplier(dpi) m = article.get_print_multiplier(dpi)
url = SITE_BASE + "/edit/view_article/%d/?m=%f" % (article.id, m) url = SITE_BASE + "/edit/view_article/%d/?m=%f" % (article.id, m)