7
मैं एक विधि है कि Reportlab लाइब्रेरी का उपयोग कर एक पीडीएफ फाइल उत्पन्न करता है:App इंजन पायथन में डेटास्टोर में Reportlab साथ उत्पन्न पीडीएफ को बचाने के लिए कैसे
def obtenerPDFNuevoPedido(self, handler,rsUsuarioPedido, rsPedido):
handler.response.headers['Content-Type'] = 'application/pdf'
handler.response.headers['Content-Disposition'] = 'attachment; filename=output.pdf'
story = []
story.append(Paragraph('CHIPAS', ParagraphStyle(name="centeredStyle", alignment=TA_CENTER, fontSize=20)))
story.append(Paragraph('____________ENLANUBE', ParagraphStyle(name="centeredStyle", alignment=TA_CENTER, fontSize=20)))
story.append(Spacer(6, 22))
story.append(Table([[Paragraph(str(strftime("%Y-%m-%d", gmtime())), ParagraphStyle(name="centeredStyle", alignment=TA_LEFT, fontSize=7)),
Paragraph(str(strftime("%H:%M:%S", gmtime())), ParagraphStyle(name="centeredStyle", alignment=TA_RIGHT, fontSize=7))]],colWidths=[5.05 * cm, 3.1 * cm]))
story.append(Paragraph("DEVELOPED AT ROSHKA-LABS", ParagraphStyle(name="centeredStyle", alignment=TA_CENTER, fontSize=6)))
story.append(Paragraph('-'*50, styleCentered))
#...
#...
doc = SimpleDocTemplate(handler.response.out, pagesize=letter)
doc.build(story)
जब मुझे लगता है कि विधि कॉल, यह एक संवाद सहेज सकते हैं, जहां मैं निर्दिष्ट कर सकते हैं कि फ़ाइल कहाँ सहेजी जानी चाहिए।
डेटास्टोर में जेनरेट की गई पीडीएफ फ़ाइल को सहेजने के लिए मैं कितना जोरदार हूं?
अग्रिम धन्यवाद!
धन्यवाद russenreaktor! मैंने आपके उत्तर की दो पंक्तियां संपादित की हैं =)। यह आकर्षण की तरह काम करता है! – Lucas