more playing with dpi

This commit is contained in:
sanj 2010-07-29 01:49:06 +05:30
parent 0bb0255531
commit cfb28074fb
2 changed files with 3 additions and 3 deletions

View File

@ -231,9 +231,9 @@ class Article(models.Model):
def get_print_multiplier(self, dpi): def get_print_multiplier(self, dpi):
product = Product.objects.get(pk=self.product.id) product = Product.objects.get(pk=self.product.id)
print_width_mm = product.typ.print_width print_width_mm = product.typ.print_width
dpm = dpi // 25.4 dpm = dpi / 25.4
pixel_width = print_width_mm * dpm pixel_width = print_width_mm * dpm
m = pixel_width // 800.0 m = pixel_width / 800.0
return m return m
def __unicode__(self): def __unicode__(self):

View File

@ -579,7 +579,7 @@ 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', 150) dpi = request.GET.get('dpi', 300)
width_mm = request.GET.get('width', article.product.typ.print_width) width_mm = request.GET.get('width', article.product.typ.print_width)
height_mm = int(width_mm // article.product.typ.aspect_ratio) height_mm = int(width_mm // article.product.typ.aspect_ratio)
pages = Page.objects.filter(article=article) pages = Page.objects.filter(article=article)