About

Code samples and notes from the book: Python does PDF: pyFPDF

hero

You can follow the book updates and tweets related to programming and free/libre open source software for science at @edwood_ocasio

About Edwood Ocasio

Developer with 20+ years of experience in different programming languages and industries. Python is currently my main business programming language and I make a living thanks to it. For the same amount of years teached college level computers, software development and mathematics.

Table of contents

  • Introduction
  • Installation
  • Writing text

    • Hello World!
    • Change paper format to Letter and units to inches
    • Text color
    • Text color by color hex values using hex2dec function
    • Text color by color names using webcolors module
    • Change font family and style
    • Text alignment and borders
    • Positioning text cells (boxes)

      • Using empty text cells to place other text cells
      • Using the effective page width to distribute content evenly
      • Using the effective page width to center text across a page
      • Using method set_xy() to exactly position a text cell
    • Wrapping text automatically (multi_cell)

      • Simple use of multi_cell
    • Putting two adjacent multi_cell blocks
    • Three adjacent multi cell columns
    • Coloring multi_cell blocks
    • Adjust cell width and height exactly to the text
    • Margins

      • Default margins
      • Changing margins
    • Mix page orientations
  • Tables

    • Table with horizontal lines at top and bottom
    • Table with horizontal lines after every row
    • Table with alternate row colors
    • Table using HTML and write_html
    • Table with vertical and horizontal lines
    • Table using only cell borders
    • Simple table class
  • Images

    • Image dimensions
    • Image types supported
    • Image positioning
    • Images with borders
    • Images in tables
    • Build a PDF with images in folder
    • Images as watermarks

      • Single page
      • Every page
  • Templates

    • The Visual Template Designer

      • Designer Toolbar
    • Replicating a document from a scanned image

      • Insert document background
      • Insert text elements
      • Preview PDF document
      • The template file
      • The code to fill the template
    • Clearing template contents before processing
    • Modifying template’s elements at runtime
    • Templates with more than one page
  • Generating PDFs in web applications

    • Using web2py
    • Using flask
  • Protecting with password a PDF

    • Generating a password protected PDF file
    • PDF protection inside a web2py web application
    • PDF protection inside a flask web application
  • One liners

    • Empty PDF document
    • Hello PDF document
    • Convert text file to PDF
    • Directory listing as a PDF, using multi_cell
    • From standard input to PDF
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