當前位置: 首頁>>代碼示例>>Python>>正文


Python pyfpdf.FPDF類代碼示例

本文整理匯總了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()
開發者ID:bitvinci,項目名稱:skipsvaki_poc,代碼行數:8,代碼來源:exporters.py

示例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')
開發者ID:flavio-casacurta,項目名稱:soag,代碼行數:16,代碼來源:validarerwin.py

示例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')
開發者ID:AndreMassashi,項目名稱:web2py-recipes-source,代碼行數:15,代碼來源:default.py

示例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")
開發者ID:Jbaumotte,項目名稱:web2py,代碼行數:15,代碼來源:default.py

示例5: __init__

 def __init__(self):
     FPDF.__init__(self,'L')
開發者ID:japastor,項目名稱:controlies,代碼行數:2,代碼來源:logprinter.py

示例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")
開發者ID:flavio-casacurta,項目名稱:soag,代碼行數:17,代碼來源:sortnens.py

示例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")
開發者ID:aditya260694,項目名稱:Resume-Builder,代碼行數:91,代碼來源:default.py

示例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)
#.........這裏部分代碼省略.........
開發者ID:PulkitIIIT,項目名稱:Resume-Builder,代碼行數:101,代碼來源:default.py


注:本文中的gluon.contrib.pyfpdf.FPDF類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。