Using empty text cells to place other text cells

# Import FPDF class
from fpdf import FPDF

# Create instance of FPDF class
# Letter size paper, use inches as unit of measure
pdf=FPDF(format='letter', unit='in')

# Add new page. Without this you cannot create the document.
pdf.add_page()

# Remember to always put one of these at least once.
pdf.set_font('Times','',10.0) 

# Text in cell 2.5 inches wide, automatic height (0.0)
# starting at left margin
pdf.cell(2.5,0.0,'Hello World!')

# Remember this? 0.25 inches line break
pdf.ln(0.25)

# Move 1.0 inch to the right
pdf.cell(1.0)
# Now write text in cell 2.5 inches wide, 0.15 in height.
# Notice we did not put any line break, so this text should follow
# immediately. Will leave borders to emphasize the cell concept.
pdf.cell(2.5,0.15,'Hello World!', border=1)
# Keep in the same line and write again.
pdf.cell(2.5,0.15,'Hello World Again!', border=1)

# Now a line break
pdf.ln(0.15)

# output content into a file ('F') named 'hello7.pdf'
pdf.output('hello7.pdf','F')

helloworld7

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