Python does PDF: pyFPDF
Python does PDF: pyFPDF
$9.99
Minimum price
$14.99
Suggested price
Python does PDF: pyFPDF

This book is 100% complete

Completed on 2016-04-09

About the Book

Follow book updates at @edwood_ocasio

Through this book I hope to share my hard earned knowledge about generating PDF documents dynamically using Python and libraries like pyFPDF, the main subject of this book.

If you are a busy professional developer like I am you do not want to spend too much time reading through lots of explanations. You want to get to the solution to your problem fast. That is why this book is written in cookbook style divided in some common themes. Most of the explaining will be done in the code's comments. The free sample already provides around 30 useful code examples!

I consider the book complete in the sense that it already covers basic and advanced topics about the most used features of pyFPDF.  However, the content will keep expanding.  I am actively working with the library in actual client's projects and I will share with book buyers any new knowledge, trick or hack I learn.

This book can help you add more value to client's projects that require generating PDF reports and, hopefully, that will mean more time and money for you.

About the Author

Edwood Ocasio
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

The Leanpub 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Write and Publish on Leanpub

Authors, publishers and universities use Leanpub to publish amazing in-progress and completed books and courses, just like this one. You can use Leanpub to write, publish and sell your book or course as well! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.

Learn more about writing on Leanpub