A simple pdf table builder using the ReportLab Toolkit
Project description
reportlab-pdf-table-builder
A simple pdf table builder using the ReportLab Toolkit
Example usage
import datetime
from reportlab.lib import colors
from reportlab.lib.enums import TA_RIGHT, TA_CENTER, TA_LEFT
from reportlab.platypus import Spacer
from pdf_table_builder.builder import Row, Column, Grid, pfd_table_builder, ReportLabPDFBuilder
data = [
Row(columns=[Column(content='<font size=10>{}</font>'.format(datetime.date.today().strftime("%d/%m/%Y")))]),
Spacer(1, 1),
Row(columns=[Column(content='Title')]),
Spacer(1, 1),
# Image(buff1, width=150, height=300),
Row(
columns=[
Column(content='Panel color outside:'),
Column(content='7012 Matt'),
Column(content='$100', align=TA_RIGHT),
Column(content='test'),
Column(content='test2', grid=Grid(line_color=colors.yellow, line_width=2)),
],
grid=Grid(line_color=colors.blue, line_width=1),
# text_color=colors.red
),
Row(
columns=[
Column(content='test2', align=TA_CENTER, background_color=colors.red, text_color=colors.blue),
Column(content='Panel color outside:'),
Column(content='7012 Matt'),
Column(content='$100', align=TA_RIGHT, grid=Grid(line_color=colors.yellow, line_width=2)),
Column(content='test', align=TA_CENTER, background_color=colors.aqua),
Column(content='test2', align=TA_CENTER, background_color=colors.red, text_color=colors.white),
Column(content='test2', align=TA_CENTER, background_color=colors.purple, text_color=colors.red),
],
align=TA_LEFT,
background_color=colors.green,
text_color=colors.red,
),
Row(
columns=[
Column(content='test2', align=TA_CENTER, background_color=colors.red, text_color=colors.blue),
Column(content='Panel color outside:'),
Column(content='7012 Matt'),
Column(content='$100', align=TA_RIGHT),
Column(content='test1', background_color=colors.purple),
Column(content='test', align=TA_CENTER, background_color=colors.aqua, text_color=colors.yellow),
Column(content='test2', align=TA_CENTER, background_color=colors.red, text_color=colors.white),
],
background_color=colors.green,
text_color=colors.blue,
grid=Grid(),
),
]
table = pfd_table_builder(data)
pdfbuilder = ReportLabPDFBuilder()
pdfbuilder.add_to_story(table)
pdfbuilder.save_pdf_file('a.pdf')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for reportlab-pdf-table-builder-1.1.8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb911e0686df66d0d23194944e7ce115e6bd9bb8eddf007e8e4e20d645462b5e |
|
MD5 | e2d09376328aabe331924d051249d4c3 |
|
BLAKE2b-256 | 112a7a6f1ea9244ac04b9f5a035d53dbacf06ef2822b69edce64c561d69f2e5f |
Close
Hashes for reportlab_pdf_table_builder-1.1.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1559955aeb95b21aa1dced9fad288e799123dfe9ca7e5fa54037ea46a2f09af |
|
MD5 | 639ccd484996844018bbc354b559929b |
|
BLAKE2b-256 | ef710b9b8e1dec060a31483243bd02bd929af5b82d6ecae7e382c7c92807476c |