1234567891011121314151617181920212223242526 |
- # -*- coding: utf-8 -*-
- from django.http import HttpResponse
- from django.shortcuts import render, get_object_or_404
- from coin.billing.process_latex import process_latex
- from coin.billing.models import Invoice
- def pdf_test(request):
- context = {"blop": "COIN !"}
- response = HttpResponse(content_type='application/pdf')
- response['Content-Disposition'] = 'attachment; filename="somefilename.pdf"'
- response.write(process_latex('billing/test.tex', context))
- return response
- def invoice_pdf(request, pk):
- invoice = get_object_or_404(Invoice, pk=1)
- context = {"invoice": invoice}
- response = HttpResponse(content_type='application/pdf')
- response['Content-Disposition'] = 'attachment; filename="facture.pdf"'
- response.write(process_latex('billing/invoice.tex', context))
- return response
|