Leanpub Header

Skip to main content

ReportLab - PDF Processing with Python

ReportLab has been around since the year 2000 and has remained the primary package that Python developers use for creating reports in the PDF format. It is an extremely powerful package that works across all the major platforms. This book will also introduce the reader to other Python PDF packages.

The author is letting you choose the price you pay for this book!

Pick Your Price...
PDF
EPUB
WEB
1,108
Readers
421
Pages
80,487Words
About

About

About the Book

ReportLab is the primary package that most Python developers use for creating PDFs programmatically. This book will take a deep dive into this package and teaches you how to use this versatile library.

This book covers the following topics:

  • Creating PDFs with ReportLab Canvas methods
  • Using PLATYPUS in ReportLab for Dynamic Reports
  • Turning Data into Reports with ReportLab
  • Splitting / Joining PDFs with PyPDF2 and pdfrw
  • Rotating Pages
  • PDF Security
  • Merging PDFs
  • and much, much more!

Price

Pick Your Price...

Minimum price

$19.99

$24.99

You pay

$24.99

Author earns

$19.99
$

All prices are in US $. You can pay in US $ or in your local currency when you check out.

EU customers: prices exclude VAT, which is added during checkout.

...Or Buy With Credits!

Number of credits (Minimum 2)

2
The author will earn $24.00 from your purchase!
You can get credits monthly with a Reader Membership

Author

About the Author

Michael Driscoll

Michael has been programming with Python since 2006. He is the author of the popular Python blog, The Mouse Vs. the Python. Michael has been a technical reviewer for Packt Publishing and No Starch Press.  He is also a contributor on Real Python.

He also co-authored The Essential Core Python Cheat Sheet for DZone.

Michael released his first book, Python 101, June 3rd, 2014. He wrote the follow up, Python 201: Intermediate Python and published it in the summer of 2016. He is also the author of wxPython Cookbook from Apress as well as Python Interviews from Packt Publishing.

Michael is currently working on some new books as well.

Leanpub Podcast

Episode 47

An Interview with Michael Driscoll

Contents

Table of Contents

Introduction

  1. About the Author
  2. Conventions
  3. Setting up & Activating a Virtual Environment
  4. Dependencies
  5. Installation
  6. Configuration
  7. Reader Feedback
  8. Errata
  9. Code Examples

Part I - The ReportLab Toolkit

Chapter 1 - Getting Started with Reportlab

  1. The Canvas Object
  2. Canvas Methods
  3. Using Colors in ReportLab
  4. Adding a Photo
  5. The textobject
  6. Create a Page Break
  7. Canvas Orientation (Portrait vs. Landscape)
  8. Other methods
  9. A Simple Sample Application
  10. Wrapping Up

Chapter 2 - ReportLab and Fonts

  1. Unicode / UTF8 is the Default
  2. The Standard Fonts
  3. Other Type-1 Fonts
  4. TrueType Fonts
  5. Asian Fonts
  6. Switching Between Fonts
  7. Wrapping Up

Chapter 3 - Intro to Page Layout

  1. The Basics of PLATYPUS
  2. Changing Fixed Elements Across Pages
  3. Flowable Methods
  4. Frame Basics
  5. Templates
  6. Flowable Orientation (Portrait vs. Landscape)
  7. Wrapping Up

Chapter 4 - Paragraphs

  1. Paragraph Styles
  2. Paragraph Markup Tags
  3. The Outermost Markup Tags
  4. Using Intra-Paragraph Markup
  5. Working with Fonts
  6. Superscripts & Subscripts
  7. Inserting Inline Images
  8. Numbering Paragraphs / Sections
  9. Bullets
  10. Wrapping Up

Chapter 5 - Tables

  1. The Table’s Methods
  2. Applying Style to Your Table
  3. Cell Formatting
  4. Changing Fonts in Tables
  5. Line Commands
  6. Cell Alignment
  7. Alternating Background Colors
  8. Putting Paragraphs in Your Cells
  9. Adding Images to Cells
  10. Spanning
  11. Wrapping Up

Chapter 6 - Other Flowables

  1. Preformatted
  2. XPreformatted
  3. The Image Flowable
  4. The Spacer Flowable
  5. PageBreak
  6. CondPageBreak
  7. KeepTogether
  8. How to Add a Table of Contents
  9. SimpleIndex
  10. ListFlowable / ListItem
  11. Wrapping Up

Chapter 7 - Creating Your Own Flowables

  1. Creating a Line Flowable
  2. Creating a Bordered Textbox + Line Flowable
  3. Modifying a Pre-Existing Flowable
  4. Wrapping Up

Chapter 8 - Intro to Graphics and Charts

  1. What is a Drawing?
  2. ReportLab’s Renderers
  3. The Coordinate System
  4. A Simple Drawing
  5. Supported Outputs
  6. Verifying Attributes
  7. Naming Shapes
  8. Charts and Graphs
  9. Labels
  10. Axes
  11. Bar Charts
  12. Line Charts
  13. Line Plots
  14. Pie Charts
  15. Adding Titles and Legends
  16. Odds and Ends
  17. Wrapping Up

Chapter 9 - Other Graphics

  1. Shapes
  2. Widgets
  3. Bar Codes
  4. Wrapping Up

Chapter 10 - Creating Special Features in Your PDF

  1. File Annotations
  2. Bookmarks
  3. Page Transitions
  4. Encryption
  5. Interactive Forms
  6. Wrapping Up

Part II - Tutorials and How-Tos

Chapter 11 - Turning Data into PDFs

  1. Getting Started
  2. Creating the Base Template Class
  3. Refactoring the EOB Class
  4. Creating a Multipage Document
  5. Using Real Data
  6. Consuming XML
  7. Wrapping Up

Chapter 12 - Custom Headers and Footers

  1. A Naive Header
  2. Putting the Header on Every Page
  3. Adding a Logo
  4. Configurable Logos
  5. Adding Page Numbers
  6. Adding a Page Number of Total
  7. Headers + Footers
  8. Wrapping Up

Chapter 13 - Creating a PDF Library

  1. Accepting Different Data Formats
  2. Multipage Data Files
  3. Custom Stylesheets
  4. Configuring Your Application
  5. Adding a Graphical User Interface
  6. Finishing the User Interface
  7. Wrapping Up

Chapter 14 - The PyPDF2 Package

  1. Installation
  2. Extracting Metadata from PDFs
  3. Extracting Text from PDFs
  4. Splitting PDFs
  5. Merging Multiple PDFs Together
  6. Rotating Pages
  7. Overlaying / Watermarking Pages
  8. PDF Encryption
  9. Wrapping Up

Chapter 15 - The pdfrw Package

  1. Installation
  2. Extracting Information from PDF
  3. Splitting
  4. Merging / Concatenating
  5. Rotating
  6. Overlaying / Watermarking Pages
  7. Scaling
  8. Combining pdfrw and ReportLab
  9. Wrapping Up

Chapter 16 - Extracting and Exporting Data from PDFs

  1. Extracting Text with PDFMiner
  2. Exporting Text via pdf2txt.py
  3. Extracting Text with Slate
  4. Exporting Your Data
  5. Exporting to XML
  6. Exporting to JSON
  7. Exporting to CSV
  8. Extracting Images
  9. Wrapping Up

Chapter 17 - Filling in PDF Forms

  1. Creating a Simple Form
  2. Merging Overlays
  3. Other Ways to Fill Forms
  4. Using the pdfforms Package
  5. Wrapping Up

Chapter 18 - Converting Markup to PDF

  1. rst2pdf
  2. WeasyPrint
  3. Pandoc
  4. LaTeX
  5. Wrapping Up

Chapter 19 - The PyFPDF Package

  1. Installation
  2. Basic Usage
  3. Working with Fonts
  4. Drawing
  5. Adding Images
  6. Multipage Documents
  7. Headers and Footers
  8. Tables
  9. Transform HTML to PDF
  10. Web2Py
  11. Templates
  12. Wrapping Up

Appendix A - Adding SVG Files in ReportLab

  1. Dependencies
  2. Installation
  3. Usage
  4. Drawing on the Canvas
  5. Adding an SVG to a Flowable
  6. Scaling SVGs in ReportLab
  7. Using SVG Plots from matplotlib in ReportLab
  8. Using svg2pdf
  9. Wrapping Up

Appendix B - Getting System Fonts

  1. The fontTools Package
  2. Getting the System’s Fonts
  3. Wrapping Up

Appendix C - Creating a Color Demo

  1. Getting the Colors
  2. Wrapping Up

Afterword and Thanks

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

The Leanpub 60 Day 100% Happiness Guarantee

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

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $14 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. 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) and EPUB (for phones, tablets and Kindle). 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.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

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. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub