pyFPDF Hello world example

# Import FPDF class
from fpdf import FPDF

# Create instance of FPDF class
pdf=FPDF()
# Add new page. Without this you cannot create the document.
pdf.add_page()
# Set font to Arial, 'B'old, 16 pts.  If you don't declare your font
# parameters you may get some font related errors.
pdf.set_font('Arial','B',16)
# Put a cell (box) 40 units wide and 10 units tall, 
# beginning from the left margin, and write 'Hello World!' inside it.
pdf.cell(40,10,'Hello World!')
# Output content into a file ('F') named 'hello.pdf'
pdf.output('hello.pdf','F')

helloworld1

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s