Skip to content

gray-adeyi/folio-pdf

Repository files navigation

Folio PDF

Downloads Downloads Downloads

A Python PDF library powered by bindings to the Go-based Folio PDF library. It provides features such as a layout engine, HTML-to-PDF rendering, forms, digital signatures, barcodes, and PDF/A support.

Folio PDF is currently under active development, so some functionality may not yet work as expected and APIs may change over time. Suggestions and bug reports are welcome at folio-pdf issues.

Installation

With uv

uv add folio-pdf

With pip

pip install folio-pdf

Usage

Building a pdf from scratch

from folio_pdf import Document, Font

doc = Document.new_a4()
doc.set_title("PDF Document Example")
doc.set_watermark("Made with Folio PDF")

page = doc.add_page()
font = Font(StandardPDFFonts.HELVETICA_BOLD)
page.add_text("I love folio pdf", font, 14, 100, 100)
doc.save("result.pdf")

Generating a pdf from html

from folio_pdf import html_to_pdf

html = '''
<h1 style="color: red;">Hello, world!</h1>
'''
html_to_pdf(html, "result.pdf")
# see generated result.pdf the generated pdf

Packages

 
 
 

Contributors

Languages