Beispiel #1
0
def create_abfrage_pdf(abfrage, kriterium1, kriterium2, tierhaltungen):
    fpdf = FPDF()
    fpdf.t_margin = 20
    fpdf.r_margin = 16
    fpdf.b_margin = 26
    fpdf.l_margin = 10
    fpdf.orientation = 'P'
    fpdf.format = 'A4'
    fpdf.set_font('Arial', '', 11)
    fpdf.add_page()

    spacing = 1.2
    width = 184  #210 - (16 + 10) = 184
    height = fpdf.font_size

    fpdf.set_font('Arial', '', 14)
    topic_height = fpdf.font_size
    if (kriterium2 and len(kriterium2) > 0):
        abfrage = "Abfrage " + abfrage + ", " + kriterium1 + " - " + kriterium2
    else:
        abfrage = "Abfrage " + abfrage + ", " + kriterium1
    fpdf.cell(width, topic_height * spacing, txt=abfrage, border=0)
    fpdf.ln(10)

    fpdf.set_font('Arial', '', 11)
    write_abfrage_table(fpdf, tierhaltungen, width, height, spacing)

    byte_string = fpdf.output(dest="S").encode('latin-1')
    return byte_string
Beispiel #2
0
def create_etiketten_pdf(personen):
    fpdf = FPDF()
    fpdf.t_margin = 20
    fpdf.r_margin = 16
    fpdf.b_margin = 26
    fpdf.l_margin = 10
    fpdf.orientation = 'P'
    fpdf.format = 'A4'
    fpdf.set_font('Arial', '', 11)
    fpdf.add_page()

    spacing = 1.0
    width = 184  #210 - (16 + 10) = 184
    height = fpdf.font_size

    write_etiketten_table(fpdf, personen, width, height, spacing)

    byte_string = fpdf.output(dest="S").encode('latin-1')
    return byte_string