def print_servicio(request, id): id = int(id) servicio = Ordenes_de_servicio.objects.get(pk=id) nombre = "%s|%s" % (servicio.cotizacion.contacto.cliente.nombre, servicio.id) response = HttpResponse(content_type="application/pdf") response["Content-Disposition"] = 'filename="%s.pdf"' % nombre buffer = BytesIO() reporte = Impresion(buffer, "Letter") reporte.doc.topMargin = 100 reporte.doc.leftMargin = 72 pdf = reporte.print_servicio(id=id) response.write(pdf) return response
def print_servicio(request, id): id = int(id) servicio = Ordenes_de_servicio.objects.get(pk=id) nombre = '%s|%s' % (servicio.cotizacion.contacto.cliente.nombre, servicio.id) response = HttpResponse(content_type='application/pdf') response['Content-Disposition'] = 'filename="%s.pdf"' % nombre buffer = BytesIO() reporte = Impresion(buffer, 'Letter') reporte.doc.topMargin = 100 reporte.doc.leftMargin = 72 pdf = reporte.print_servicio(id=id) response.write(pdf) return response