Advertisement
greathector7

pdf con pyfpdf

May 6th, 2019
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.27 KB | None | 0 0
  1.  
  2.      title = "This The Doc Title"
  3.      heading = "First Paragraph"
  4.      text = 'bla ' * 10000
  5.  
  6.      pdf = FPDF()
  7.      pdf.add_page()
  8.      pdf.set_font('Times', 'B', 15)
  9.      pdf.cell(w=210, h=9, txt=title, border=0, ln=1, align='C', fill=0)
  10.      pdf.set_font('Times', 'B', 15)
  11.      pdf.cell(w=0, h=6, txt=heading, border=0, ln=1, align='L', fill=0)
  12.      pdf.set_font('Times', '', 12)
  13.      pdf.multi_cell(w=0, h=5, txt=text)
  14.      response = HttpResponse(pdf.output(dest='S'), content_type='application/pdf')
  15.      response['Content-Disposition'] = 'attachment; filename="expedientes.pdf"'
  16.      return response
  17.  
  18.  
  19.  
  20.  
  21.  
  22. resultado 5 paginas en blanco pero al ver el documento por equivocación en sublime se observa lo siguiente:
  23. %PDF-1.3
  24. 3 0 obj
  25. <</Type /Page
  26. /Parent 1 0 R
  27. /Resources 2 0 R
  28. /Contents 4 0 R>>
  29. endobj
  30. 4 0 obj
  31. <</Filter /FlateDecode /Length 420>>
  32. stream
  33. xœÍ™½N$1„sž¢C.iúÏm;E°ÁE~…ãØE+$^ÿzW‡ ¸ü*Æ²<¥QM}5£Ÿ­ÓÇÅõ¢«’6¡õ›n×iÊ2Y'õ™lƒÖ/ºý­Ý#ݼ<ÐÚ¿Ðzþ»Üõ¼º×&v^½ÙßÞén{Ü>·¯»oK¯6Fj_76é´>¾m“Âîçmî[úǧÜh‹z.    ª­Ns‚jÓÎCAµ‰s¦¶“£ƒj«×Ý@ý–Y'ÕV267î¨~ÓÁ) Ú$8@™Õf́ú­õd Ú*C&(³Ztî ÌjîÜ@;RÓÉʬ&ÅSPfÅTP¿EeÈ..........
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement