PyFPDF

http://www.blog.pythonlibrary.org/2018/06/05/creating-pdfs-with-pyfpdf-and-python/

pip install fpdf


# simple_demo.py

from fpdf import FPDF



def add_image(pdf, x,y, w, image_path):
    pdf.image(image_path, x, y, w)
    pdf.set_font("Arial", size=12)
    pdf.ln(85)  # move 85 down
    pdf.cell(400, 10, txt="{}".format(image_path), ln=1)




pdf = FPDF()
pdf.add_page()

# 제목 
pdf.set_font("Arial", size=20)
pdf.cell(200, 10, txt="DPQS", ln=1, align="C")

# 선 긋기 
pdf.set_line_width(1)
pdf.set_draw_color(255, 0, 0)
pdf.line(20, 20, 200, 20)

# 본문 
pdf.set_font("Arial", size=12)
pdf.cell(200, 10, txt="Welcome to Python!", ln=1, align="C")

image_path = "1-1.png"
add_image(pdf, 10, 30, 100, image_path)



# 저장 
pdf.output("simple_demo.pdf")

results matching ""

    No results matching ""