pdfci.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # -*- coding: utf-8 -*-
  2. from fpdf import FPDF
  3. class PDF(FPDF):
  4. def header(this):
  5. # Logo
  6. #this.image('logo_pb.png',10,8,33)
  7. # Arial bold 15
  8. this.set_font('Arial','B',15)
  9. # Move to the right
  10. this.cell(80)
  11. # Title
  12. this.cell(30,10,'Title',1,0,'C')
  13. # Line break
  14. this.ln(20)
  15. # Page footer
  16. def footer(this):
  17. # Position at 1.5 cm from bottom
  18. this.set_y(-15)
  19. # Arial italic 8
  20. this.set_font('Arial','I',8)
  21. # Page number
  22. #this.cell(0,10,'Page '+str(this.PageNo())+'/{nb}',0,0,'C')
  23. # Instanciation of inherited class
  24. pdf=PDF()
  25. pdf.alias_nb_pages()
  26. pdf.add_page()
  27. #pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf', uni=True)
  28. #pdf.set_font('DejaVu', '', 14)
  29. #pdf.add_font('Arial', '', 'Arial.ttf', uni=True)
  30. #pdf.set_font('Arial', '', 14)
  31. pdf.set_font('Helvetica', '', 14)
  32. for i in range(1,41):
  33. pdf.cell(0,10,('çþþþöðüi')+str(i),0,1)
  34. pdf.output('tuto2.pdf','F')