ReportLab - PDF Processing with Python
ReportLab - PDF Processing with Python
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!
Bundles that include this book
Table of Contents
-
Introduction
- About the Author
- Conventions
- Setting up & Activating a Virtual Environment
- Dependencies
- Installation
- Configuration
- Reader Feedback
- Errata
- Code Examples
- Part I - The ReportLab Toolkit
-
Chapter 1 - Getting Started with Reportlab
- The Canvas Object
- Canvas Methods
- Using Colors in ReportLab
- Adding a Photo
- The textobject
- Create a Page Break
- Canvas Orientation (Portrait vs. Landscape)
- Other methods
- A Simple Sample Application
- Wrapping Up
-
Chapter 2 - ReportLab and Fonts
- Unicode / UTF8 is the Default
- The Standard Fonts
- Other Type-1 Fonts
- TrueType Fonts
- Asian Fonts
- Switching Between Fonts
- Wrapping Up
-
Chapter 3 - Intro to Page Layout
- The Basics of PLATYPUS
- Changing Fixed Elements Across Pages
- Flowable Methods
- Frame Basics
- Templates
- Flowable Orientation (Portrait vs. Landscape)
- Wrapping Up
-
Chapter 4 - Paragraphs
- Paragraph Styles
- Paragraph Markup Tags
- The Outermost Markup Tags
- Using Intra-Paragraph Markup
- Working with Fonts
- Superscripts & Subscripts
- Inserting Inline Images
- Numbering Paragraphs / Sections
- Bullets
- Wrapping Up
-
Chapter 5 - Tables
- The Table’s Methods
- Applying Style to Your Table
- Cell Formatting
- Changing Fonts in Tables
- Line Commands
- Cell Alignment
- Alternating Background Colors
- Putting Paragraphs in Your Cells
- Adding Images to Cells
- Spanning
- Wrapping Up
-
Chapter 6 - Other Flowables
- Preformatted
- XPreformatted
- The Image Flowable
- The Spacer Flowable
- PageBreak
- CondPageBreak
- KeepTogether
- How to Add a Table of Contents
- SimpleIndex
- ListFlowable / ListItem
- Wrapping Up
-
Chapter 7 - Creating Your Own Flowables
- Creating a Line Flowable
- Creating a Bordered Textbox + Line Flowable
- Modifying a Pre-Existing Flowable
- Wrapping Up
-
Chapter 8 - Intro to Graphics and Charts
- What is a Drawing?
- ReportLab’s Renderers
- The Coordinate System
- A Simple Drawing
- Supported Outputs
- Verifying Attributes
- Naming Shapes
- Charts and Graphs
- Labels
- Axes
- Bar Charts
- Line Charts
- Line Plots
- Pie Charts
- Adding Titles and Legends
- Odds and Ends
- Wrapping Up
-
Chapter 9 - Other Graphics
- Shapes
- Widgets
- Bar Codes
- Wrapping Up
-
Chapter 10 - Creating Special Features in Your PDF
- File Annotations
- Bookmarks
- Page Transitions
- Encryption
- Interactive Forms
- Wrapping Up
- Part II - Tutorials and How-Tos
-
Chapter 11 - Turning Data into PDFs
- Getting Started
- Creating the Base Template Class
- Refactoring the EOB Class
- Creating a Multipage Document
- Using Real Data
- Consuming XML
- Wrapping Up
-
Chapter 12 - Custom Headers and Footers
- A Naive Header
- Putting the Header on Every Page
- Adding a Logo
- Configurable Logos
- Adding Page Numbers
- Adding a Page Number of Total
- Headers + Footers
- Wrapping Up
-
Chapter 13 - Creating a PDF Library
- Accepting Different Data Formats
- Multipage Data Files
- Custom Stylesheets
- Configuring Your Application
- Adding a Graphical User Interface
- Finishing the User Interface
- Wrapping Up
-
Chapter 14 - The PyPDF2 Package
- Installation
- Extracting Metadata from PDFs
- Extracting Text from PDFs
- Splitting PDFs
- Merging Multiple PDFs Together
- Rotating Pages
- Overlaying / Watermarking Pages
- PDF Encryption
- Wrapping Up
-
Chapter 15 - The pdfrw Package
- Installation
- Extracting Information from PDF
- Splitting
- Merging / Concatenating
- Rotating
- Overlaying / Watermarking Pages
- Scaling
- Combining pdfrw and ReportLab
- Wrapping Up
-
Chapter 16 - Extracting and Exporting Data from PDFs
- Extracting Text with PDFMiner
- Exporting Text via pdf2txt.py
- Extracting Text with Slate
- Exporting Your Data
- Exporting to XML
- Exporting to JSON
- Exporting to CSV
- Extracting Images
- Wrapping Up
-
Chapter 17 - Filling in PDF Forms
- Creating a Simple Form
- Merging Overlays
- Other Ways to Fill Forms
- Using the pdfforms Package
- Wrapping Up
-
Chapter 18 - Converting Markup to PDF
- rst2pdf
- WeasyPrint
- Pandoc
- LaTeX
- Wrapping Up
-
Chapter 19 - The PyFPDF Package
- Installation
- Basic Usage
- Working with Fonts
- Drawing
- Adding Images
- Multipage Documents
- Headers and Footers
- Tables
- Transform HTML to PDF
- Web2Py
- Templates
- Wrapping Up
-
Appendix A - Adding SVG Files in ReportLab
- Dependencies
- Installation
- Usage
- Drawing on the Canvas
- Adding an SVG to a Flowable
- Scaling SVGs in ReportLab
- Using SVG Plots from matplotlib in ReportLab
- Using svg2pdf
- Wrapping Up
-
Appendix B - Getting System Fonts
- The fontTools Package
- Getting the System’s Fonts
- Wrapping Up
-
Appendix C - Creating a Color Demo
- Getting the Colors
- Wrapping Up
- Afterword and Thanks
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 earnedover $14 millionwriting, 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