Change paper format to Letter and units to inches

# 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.
# Loop through some font sizes
for fs in range(8, 37):
    # Regular font, notice the empty string ''

    # Create a cell 1.0 inches wide, automatic height
    # and write some text
    pdf.cell(1.0,0.0,'Hello World!')
    # Insert break 0.15 inches in height
    # Just like a carriage return

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

Leave a Reply

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

You are commenting using your 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