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.
- Hello World!
- Change paper format to Letter and units to inches
- Text color
Text color by color hex values using
Text color by color names using
- 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
- Default margins
- Changing margins
- Mix page orientations
- Table with horizontal lines at top and bottom
- Table with horizontal lines after every row
- Table with alternate row colors
Table using HTML and
- Table with vertical and horizontal lines
- Table using only cell borders
- Simple table class
- 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
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
- The Visual Template Designer
Generating PDFs in web applications
Protecting with password a PDF
- Generating a password protected PDF file
PDF protection inside a
PDF protection inside a
- 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
Free Updates. Free App. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets), MOBI (for Kindle) and in the free Leanpub App (for Mac, Windows, iOS and Android). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.