def preview_library_pdf(request, document_id): document = get_object_or_404(Document, pk=document_id) inputFile = document.latest_version().content.path outputFile = "/tmp/%s.pdf" % document_id StandardLargePrint.dtbook2pdf(inputFile, outputFile) filename = document.title + u" 17pt" return render_to_mimetype_response('application/pdf', filename.encode('utf-8'), outputFile)
def preview_pdf(request, document_id): document = get_object_or_404(Document, pk=document_id) if request.method == 'POST': form = LargePrintProfileForm(request.POST) if form.is_valid(): inputFile = document.latest_version().content.path outputFile = "/tmp/%s.pdf" % document_id StandardLargePrint.dtbook2pdf(inputFile, outputFile, **form.cleaned_data) return render_to_mimetype_response('application/pdf', document.title.encode('utf-8'), outputFile) else: form = LargePrintProfileForm() return render_to_response('documents/todo_pdf.html', locals(), context_instance=RequestContext(request))
def preview_sale_pdf(request, document_id): document = get_object_or_404(Document, pk=document_id) if request.method == 'POST': form = SalePDFForm(request.POST) if form.is_valid(): inputFile = document.latest_version().content.path outputFile = "/tmp/%s.pdf" % document_id StandardLargePrint.dtbook2pdf(inputFile, outputFile, images=document.image_set.all(), **form.cleaned_data) filename = document.title + u" " + form.cleaned_data['font_size'] return render_to_mimetype_response('application/pdf', filename.encode('utf-8'), outputFile) else: form = SalePDFForm() return render(request, 'documents/todo_sale_pdf.html', locals())