Skip to main content

doc License: GPL v3

Status

pytests push-pypi push-doc

maintained issues pr

Compatibilities

ubuntu unix

python

Contact

linkedin website mail

PdfFactory

A class to update and/or create a pdf object, and add pages to it. For now only matplotlib.figure and tablewriter.TableWriter objects can be added.

Can be opened at the beginning of a long code to add pages from different functions. Will create a file in the tmp directory where pages are added, and will modify the true file when the update() method is called. update() is called each time and add_*() method is called. This can be prevented by passing the argument update=False to those methods. In that case, the user will have to call the update() method later. This can save computation time if a lot of pages are added during the execution of the code.

The output file is recreated by default when update() is called for the first time. This can be switched off by calling will_recreate(False) before adding anything to the Pdf object. In that case, pages are appended to the already existing file.

The tmp file is deleted after update() finishes, and is recreated later if need be. The tmp file might not be deleted if the program stops abruptly.

Installation

pip install pdffactory

Usage

# noinspection PyShadowingNames
import matplotlib.pyplot as plt
import pandas as pd
from tablewriter import TableWriter
from pdffactory import PdfFactory

# Also accepts remote TransparentPath objects
pdf = PdfFactory("test.pdf")
pdf.will_recreate(False)
plt.plot([1, 2, 3], [1, 4, 9])
df = pd.DataFrame([[1, 2, 3],[4, 5, 6]], index = ["b", "a"])
tb = TableWriter(data=df)
pdf.add_figure(plt.gcf())
pdf.add_table(tb)

Metadata

Release files for pdffactory 0.1.33

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pdffactory 0.1.33
File Size Uploaded
pdffactory-0.1.33.tar.gz 38.2 kB Details

Release files / pdffactory-0.1.33.tar.gz

Download URL pdffactory-0.1.33.tar.gz
Size 38.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8173db2584f1cef4500311989e53cf398253f95f23e8333d906f0c5b09de4bb2
BLAKE2b-256 checksum
How to use checksums
3898213cbdadcb2c1ca6c8a79b63fd36d476fd844c9ab30bfe643805c0abe675
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Release history Release notifications | RSS feed

This release

0.1.33 This release

1 release file

0.1.32

1 release file

0.1.31

1 release file

0.1.30

1 release file

0.1.17

1 release file

0.1.15

1 release file

0.1.13

1 release file

0.1.9

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page