2014-08-20 18:50:07 +00:00
|
|
|
from django.http import HttpResponse
|
|
|
|
|
2014-08-29 12:45:27 +00:00
|
|
|
from orchestra.utils.system import run
|
|
|
|
|
2014-08-20 18:50:07 +00:00
|
|
|
|
2014-08-19 18:59:23 +00:00
|
|
|
def generate_bill(modeladmin, request, queryset):
|
2014-08-20 18:50:07 +00:00
|
|
|
bill = queryset.get()
|
|
|
|
bill.close()
|
2014-08-29 12:45:27 +00:00
|
|
|
pdf = run('xvfb-run -a -s "-screen 0 640x4800x16" wkhtmltopdf - -',
|
|
|
|
stdin=bill.html.encode('utf-8'), display=False)
|
|
|
|
return HttpResponse(pdf, content_type='application/pdf')
|