Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.89 KB | None | 0 0
  1. from reportlab.pdfgen.canvas import canvas
  2. from reportlab.lib.enums import TA_JUSTIFY, TA_LEFT, TA_CENTER
  3. from reportlab.lib.pagesizes import letter
  4. from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
  5. from reportlab.lib.units import cm
  6. from reportlab.platypus import Image
  7. from reportlab.platypus import Frame, Paragraph, Spacer
  8. from reportlab.platypus import SimpleDocTemplate
  9.  
  10. print(cm)
  11.  
  12.  
  13. doc = SimpleDocTemplate("form_letter.pdf",pagesize=letter,
  14.                         rightMargin=1*cm,leftMargin=1.5*cm,
  15.                         topMargin=1*cm,bottomMargin=2*cm)
  16.  
  17. story = []
  18.  
  19. im = Image("cat.jpg")
  20. im._restrictSize(100, 100)
  21.  
  22. styles = getSampleStyleSheet()
  23. styles.add(ParagraphStyle(name="Temp", alignment=TA_LEFT), "Kekus")
  24.  
  25. p = Paragraph("kek", styles["Kekus"])
  26. story.append(im)
  27. story.append(p)
  28. story.append(p)
  29. story.append(p)
  30. story.append(p)
  31. doc.build(story)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement