How can I create a PDF horizontally?

0

How can I create a PDF horizontally?

'''Se genera el archivo PDF'''
'''Le indicamos que tiene que descargar el archivo en el navegador'''
response = HttpResponse(content_type='application/pdf')

'''Indicamos el nombre del archivo'''
response['Content-Disposition'] = 'attachment; filename=Layout_Disperciones.pdf'

# buff = BytesIO()
buff = open(RECURSOS_DIR + '/pdf/Layout_Disperciones.pdf', 'w')
titulo = "Notificaciones para disperciones y depósitos al dia:  " + str(fecha_layout) + '   Corte: ' + str(hora)

'''Se invoca el reporte, y se coloca el encabezado o titulo'''
rep = Reporte(letter,
              titulo)

doc = BaseDocTemplate(buff,
                      pagesize=rep.hoja,
                      rightMargin=15,
                      leftMargin=15,
                      topMargin=20,
                      bottomMargin=20,
                      )

frame2 = Frame(10 * mm, 10 * mm, rep.ancho - (20 * mm), rep.alto - (45 * mm), showBoundary=0)
doc.addPageTemplates(PageTemplate(id='contenido', frames=frame2, onPage=rep.pagina_reporte_edilar))

story = []

doc.build(story)
buff.close()

buff = open(RECURSOS_DIR + '/pdf/Layout_Disperciones.pdf', 'rb')
response.write(buff.read())

return response
    
asked by Jonathan Garcia 04.07.2018 в 16:44
source

0 answers