X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/29ef20529bc67b9c1ecb09cd067c4481d252916f..636fd34b05155b81691222ad80c4a3746d0c2fc1:/apps/catalogue/views.py diff --git a/apps/catalogue/views.py b/apps/catalogue/views.py index 76001f9e..b6521c7f 100644 --- a/apps/catalogue/views.py +++ b/apps/catalogue/views.py @@ -264,7 +264,7 @@ def book_html(request, slug): @never_cache -def book_pdf(request, slug): +def book_pdf(request, slug, mobile=False): book = get_object_or_404(Book, slug=slug) if not book.accessible(request): return HttpResponseForbidden("Not authorized.") @@ -272,7 +272,8 @@ def book_pdf(request, slug): # TODO: move to celery doc = book.wldocument() # TODO: error handling - pdf_file = doc.as_pdf(cover=True, ilustr_path=book.gallery_path()) + customizations = ['26pt', 'nothemes', 'nomargins', 'notoc'] if mobile else None + pdf_file = doc.as_pdf(cover=True, ilustr_path=book.gallery_path(), customizations=customizations) from catalogue.ebook_utils import serve_file return serve_file(pdf_file.get_filename(), book.slug + '.pdf', 'application/pdf')