本文整理汇总了Python中gluon.contrib.pyfpdf.FPDF类的典型用法代码示例。如果您正苦于以下问题:Python FPDF类的具体用法?Python FPDF怎么用?Python FPDF使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FPDF类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, title="No Title", lang=None):
FPDF.__init__(self)
self.smTitle = str(title)
self.smLang = lang
self.set_title("Data Export")
# first page:
self.add_page()
示例2: report
def report():
id = request.args(0)
if not id: redirect(URL('index'))
title = "Nome Externo"
heading = "First Paragraph"
text = 'xpto ' * 100
pdf = FPDF()
pdf.add_page()
pdf.set_font('Times','B',15)
pdf.cell(w=210,h=9,txt=title,border=0,ln=1,align='C',fill=0)
pdf.set_font('Times','B',15)
pdf.cell(w=0,h=6,txt=heading,border=0,ln=1,align='L',fill=0)
pdf.set_font('Times','',12)
pdf.multi_cell(w=0,h=5,txt=text)
response.headers['Content-Type']='application/pdf'
return pdf.output(name='report.pdf',dest='S')
示例3: get_me_a_pyfpdf
def get_me_a_pyfpdf():
title = "This The Doc Title"
heading = "First Paragraph"
text = 'bla '* 10000
pdf=FPDF()
pdf.add_page()
pdf.set_font('Times','B',15)
pdf.cell(w=210,h=9,txt=title,border=0,ln=1,align='C',fill=0)
pdf.set_font('Times','B',15)
pdf.cell(w=0,h=6,txt=heading,border=0,ln=1,align='L',fill=0)
pdf.set_font('Times','',12)
pdf.multi_cell(w=0,h=5,txt=text)
response.headers['Content-Type']='application/pdf'
return pdf.output(dest='S')
示例4: get_me_a_pyfpdf
def get_me_a_pyfpdf():
title = "This The Doc Title"
heading = "First Paragraph"
text = "bla " * 10000
pdf = FPDF()
pdf.add_page()
pdf.set_font("Times", "B", 15)
pdf.cell(w=210, h=9, txt=title, border=0, ln=1, align="C", fill=0)
pdf.set_font("Times", "B", 15)
pdf.cell(w=0, h=6, txt=heading, border=0, ln=1, align="L", fill=0)
pdf.set_font("Times", "", 12)
pdf.multi_cell(w=0, h=5, txt=text)
response.headers["Content-Type"] = "application/pdf"
return pdf.output(dest="S")
示例5: __init__
def __init__(self):
FPDF.__init__(self,'L')
示例6: report
def report():
id = request.args(0) or 0
if not id:
redirect(URL("index"))
title = "SORT com uma saida"
heading = "First Paragraph"
text = "xpto " * 100
pdf = FPDF()
pdf.add_page()
pdf.set_font("Times", "B", 15)
pdf.cell(w=210, h=9, txt=title, border=0, ln=1, align="C", fill=0)
pdf.set_font("Times", "B", 15)
pdf.cell(w=0, h=6, txt=heading, border=0, ln=1, align="L", fill=0)
pdf.set_font("Times", "", 12)
pdf.multi_cell(w=0, h=5, txt=text)
response.headers["Content-Type"] = "application/pdf"
return pdf.output(name="report.pdf", dest="S")
示例7: mypdf3
def mypdf3():
r=db(request.args[0]==db.details.myid).select()
s=db(request.args[0]==db.project.myid).select()
t=db(request.args[0]==db.achievements.myid).select()
u=db(db.auth_user.id==request.args[0]).select(db.auth_user.email)
from gluon.contrib.pyfpdf import FPDF, HTMLMixin
pdf=FPDF()
pdf.add_page()
pdf.set_font('Arial','BU',40)
#pdf.cell(w=60,h=10,txt="",border=2,align='L',fill='0')
pdf.set_text_color(100,0,100)
pdf.cell(w=80,h=30,txt="Curriculum Vitae",ln=2,border=2,align='L',fill='0')
pdf.set_text_color(0,0,0)
pdf.set_font('Arial','BU',30)
pdf.set_text_color(0,0,100)
pdf.cell(w=80,h=30,txt="Biodata",ln=1,border=2,align='L',fill='0')
pdf.set_font('Arial','',15)
pdf.set_text_color(0,0,0)
pdf.cell(w=60,h=10,txt="Name :",border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=r[0].name,ln=1,border=2,align='L',fill='0')
pdf.set_text_color(0,0,0)
pdf.cell(w=60,h=10,txt="Current Year :",border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=r[0].current_year,border=2,ln=1,align='L',fill='0')
pdf.cell(w=60,h=10,txt="CGPA :",border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=str(r[0].cg),ln=1,border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt="College :",border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=r[0].college,border=2,ln=1,align='L',fill='0')
pdf.cell(w=60,h=10,txt="Branch :",border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=r[0].branch,border=2,ln=1,align='L',fill='0')
pdf.set_text_color(0,0,0)
#pdf.cell(w=60,h=10,txt="",ln=1,border=2,align='L',fill='0')
#pdf.cell(w=60,h=10,txt="",ln=1,border=2,align='L',fill='0')
#pdf.cell(w=60,h=10,txt="",ln=1,border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt="",ln=1,border=2,align='L',fill='0')
pdf.set_font('Arial','BU',30)
pdf.set_text_color(0,0,100)
if len(s) != 0:
pdf.cell(w=60,h=10,txt="Projects/Interns ",border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=" ",ln=1,border=2,align='L',fill='0')
pdf.set_text_color(0,0,0)
for i in s:
pdf.set_font('Arial','BI',20)
pdf.cell(w=60,h=10,txt=i.name,ln=1,border=2,align='L',fill='0')
pdf.set_font('Arial','',15)
pdf.cell(w=60,h=10,txt="",ln=1,border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt="Mentor :",border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=i.mentor,ln=1,border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt="Organistion :",border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=i.org,ln=1,border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt="Description :",border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=i.Description,ln=1,border=2,align='L',fill='3')
pdf.cell(w=60,h=10,txt="Skills Used :",border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=i.skills_used,ln=1,border=2,align='L',fill='3')
pdf.cell(w=60,h=10,txt="",ln=1,border=2,align='L',fill='0')
#pdf.cell(w=60,h=10,txt="",ln=1,border=2,align='L',fill='0')
pdf.set_font('Arial','BU',30)
pdf.set_text_color(0,0,100)
if len(s) != 0:
pdf.cell(w=60,h=10,txt="Achievements ",border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=" ",ln=1,border=2,align='L',fill='0')
pdf.set_text_color(0,0,0)
for i in t:
pdf.set_font('Arial','',15)
pdf.cell(w=60,h=10,txt=i.what,ln=1,border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt="",ln=1,border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt="",ln=1,border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt="",ln=1,border=2,align='L',fill='0')
pdf.set_font('Arial','BU',30)
pdf.set_text_color(0,0,100)
pdf.cell(w=60,h=10,txt="Contact Details",ln=1,border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt="",ln=1,border=2,align='L',fill='0')
pdf.set_text_color(0,0,0)
pdf.set_font('Arial','',15)
#pdf.cell(w=40,h=10,txt="Email :",border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=u[0].email,ln=1,border=2,align='L',fill='0')
#pdf.cell(w=40,h=10,txt="Address :",border=2,align='L',fill='0')
#pdf.cell(w=60,h=10,txt="",border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=r[0].address+', ',border=2,ln=1,align='L',fill='0')
#pdf.cell(w=60,h=10,txt="",border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=r[0].city+', '+r[0].cstate,border=2,ln=1,align='L',fill='0')
#pdf.cell(w=60,h=10,txt="",border=2,align='L',fill='0')
#pdf.cell(w=60,h=10,txt=r[0].cstate,border=2,ln=1,align='L',fill='0')
response.headers['Content-Type']='application/pdf'
return pdf.output(dest="S")
示例8: mypdf
def mypdf():
query=(int)(request.args(0))
r=db((db.student.student_id==query)).select(db.student.ALL)
s=db((db.course.student_id==query)).select()
t=db(db.project.student_id==query).select()
u=db(db.extra.student_id==query).select()
a=db(db.institution.student_id==query).select()
b=db(db.work_expr.student_id==query).select()
c=db(db.activity.student_id==query).select()
from gluon.contrib.pyfpdf import FPDF, HTMLMixin
pdf=FPDF()
pdf.add_page()
pdf.set_font('Arial','BU',40)
#pdf.cell(w=60,h=10,txt="",border=2,align='L',fill='0')
pdf.set_text_color(100,0,100)
pdf.cell(w=80,h=30,txt="RESUME",ln=2,border=2,align='L',fill='0')
pdf.set_text_color(0,0,0)
pdf.set_font('Arial','BU',30)
pdf.set_text_color(0,0,100)
pdf.cell(w=80,h=30,txt="My Details:",ln=1,border=2,align='L',fill='0')
pdf.set_font('Arial','',15)
pdf.set_text_color(0,0,0)
pdf.cell(w=60,h=10,txt="Name :",border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=r[0].name,ln=1,border=2,align='L',fill='0')
str1=str(r[0].age)
pdf.set_font('Arial','',15)
pdf.set_text_color(0,0,0)
pdf.cell(w=60,h=10,txt="Age :",border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=str1,ln=1,border=2,align='L',fill='0')
pdf.set_font('Arial','',15)
pdf.set_text_color(0,0,0)
pdf.cell(w=60,h=10,txt="Gender :",border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=r[0].gender,ln=1,border=2,align='L',fill='0')
pdf.set_font('Arial','',15)
pdf.set_text_color(0,0,0)
pdf.cell(w=60,h=10,txt="Date Of Birth :",border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=str(r[0].dob),ln=1,border=2,align='L',fill='0')
pdf.set_font('Arial','',15)
pdf.set_text_color(0,0,0)
pdf.cell(w=60,h=10,txt="Address :",border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=r[0].address1,ln=1,border=2,align='L',fill='0')
pdf.set_font('Arial','',15)
pdf.set_text_color(0,0,0)
pdf.cell(w=60,h=10,txt="",border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=r[0].address2,ln=1,border=2,align='L',fill='0')
pdf.set_font('Arial','',15)
pdf.set_text_color(0,0,0)
pdf.cell(w=60,h=10,txt="",border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=r[0].address3,ln=1,border=2,align='L',fill='0')
pdf.set_font('Arial','',15)
pdf.set_text_color(0,0,0)
pdf.cell(w=60,h=10,txt="Contact",border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=r[0].contact,ln=1,border=2,align='L',fill='0')
pdf.set_font('Arial','',15)
pdf.set_text_color(0,0,0)
pdf.cell(w=60,h=10,txt="E-mail :",border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=r[0].email,ln=1,border=2,align='L',fill='0')
if len(a):
pdf.set_text_color(0,0,0)
pdf.set_font('Arial','BU',30)
pdf.set_text_color(0,0,100)
pdf.cell(w=80,h=30,txt="EDUCATION",ln=1,border=2,align='L',fill='0')
for x in a:
pdf.set_font('Arial','',15)
pdf.set_text_color(0,0,0)
#pdf.cell(w=60,h=10,txt=s[0].name :",border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=x.title,border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=x.name,ln=1,border=2,align='L',fill='0')
if len(b):
pdf.set_text_color(0,0,0)
pdf.set_font('Arial','BU',30)
pdf.set_text_color(0,0,100)
pdf.cell(w=80,h=30,txt="WORK EXPERIENCE",ln=1,border=2,align='L',fill='0')
pdf.set_font('Arial','',15)
pdf.set_text_color(0,0,0)
for x in b:
#pdf.cell(w=60,h=10,txt=s[0].name :",border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=x.name,border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=x.as_post,border=2,align='L',fill='0')
pdf.cell(w=60,h=10,txt=x.type_of,ln=1,border=2,align='L',fill='0')
if len(s):
pdf.set_text_color(0,0,0)
pdf.set_font('Arial','BU',30)
pdf.set_text_color(0,0,100)
pdf.cell(w=80,h=30,txt="COURSES TAKEN",ln=1,border=2,align='L',fill='0')
for x in s:
pdf.set_font('Arial','',15)
pdf.set_text_color(0,0,0)
#.........这里部分代码省略.........