ReportLab: PDF Processing with Python

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Author(s): Michael Driscoll

Language: English

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