flowpdf 1.1.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- flowpdf-1.1.7/MANIFEST.in +2 -0
- flowpdf-1.1.7/PKG-INFO +152 -0
- flowpdf-1.1.7/README.md +125 -0
- flowpdf-1.1.7/flowpdf/__init__.py +62 -0
- flowpdf-1.1.7/flowpdf/builder.py +662 -0
- flowpdf-1.1.7/flowpdf/client.py +194 -0
- flowpdf-1.1.7/flowpdf/exceptions.py +33 -0
- flowpdf-1.1.7/flowpdf/native.py +282 -0
- flowpdf-1.1.7/flowpdf/response.py +56 -0
- flowpdf-1.1.7/flowpdf/runtimes/linux-x64/native/libflowpdf_native.so +0 -0
- flowpdf-1.1.7/flowpdf/runtimes/win-x64/native/flowpdf_native.dll +0 -0
- flowpdf-1.1.7/flowpdf.egg-info/PKG-INFO +152 -0
- flowpdf-1.1.7/flowpdf.egg-info/SOURCES.txt +17 -0
- flowpdf-1.1.7/flowpdf.egg-info/dependency_links.txt +1 -0
- flowpdf-1.1.7/flowpdf.egg-info/requires.txt +1 -0
- flowpdf-1.1.7/flowpdf.egg-info/top_level.txt +1 -0
- flowpdf-1.1.7/pyproject.toml +37 -0
- flowpdf-1.1.7/setup.cfg +4 -0
- flowpdf-1.1.7/setup.py +47 -0
flowpdf-1.1.7/PKG-INFO
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: flowpdf
|
|
3
|
+
Version: 1.1.7
|
|
4
|
+
Summary: Open-source report generation library made in the Dominican Republic. Universal document engine and fluent report builder SDK for Python with native Rust Core, vector charts, custom TTF fonts, and WebAssembly
|
|
5
|
+
Home-page: https://codepro47rd.github.io/FlowPDF/
|
|
6
|
+
Author: Edwin Abreu, Felix R. Benzan, FlowPDF Contributors
|
|
7
|
+
Project-URL: Homepage, https://codepro47rd.github.io/FlowPDF/
|
|
8
|
+
Project-URL: Repository, https://github.com/CodePro47RD/FlowPDF
|
|
9
|
+
Project-URL: Documentation, https://codepro47rd.github.io/FlowPDF/llms.txt
|
|
10
|
+
Project-URL: Issues, https://github.com/CodePro47RD/FlowPDF/issues
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Topic :: Printing
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Rust
|
|
22
|
+
Requires-Python: >=3.9
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
Requires-Dist: requests>=2.28.0
|
|
25
|
+
Dynamic: home-page
|
|
26
|
+
Dynamic: requires-python
|
|
27
|
+
|
|
28
|
+
# FlowPDF Python SDK
|
|
29
|
+
|
|
30
|
+
Universal Document Engine and Fluent Report Builder SDK for Python, powered by in-process **Rust Core** and high-throughput remote HTTP rendering.
|
|
31
|
+
|
|
32
|
+
🇩🇴 **Made in the Dominican Republic** — FlowPDF is an open-source Dominican library for report and PDF generation.
|
|
33
|
+
|
|
34
|
+
[](https://pypi.org/project/flowpdf/)
|
|
35
|
+
[](https://opensource.org/licenses/MIT)
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## ⚡ Key Highlights
|
|
40
|
+
|
|
41
|
+
- **Ultra-Fast In-Process Generation**: Renders complete PDF documents in **~15ms - 40ms** with zero network latency using native Rust Core.
|
|
42
|
+
- **Embedded Multi-Platform Runtimes**: Bundles precompiled `win-x64` (`flowpdf_native.dll`) and `linux-x64` (`libflowpdf_native.so`) runtimes automatically loaded via `ctypes`.
|
|
43
|
+
- **Full Unicode & Spanish Accents Support**: Flawlessly renders Spanish accents (`á, é, í, ó, ú, ñ, Ñ`), inverted marks (`¿, ¡`), and currency symbols (`€, $, £`) with WinAnsi hexadecimal encoding.
|
|
44
|
+
- **Fluent Report Builder**: Declarative, composable, type-safe API for headers, tables, barcodes, QR codes, columns, rows, and cards.
|
|
45
|
+
- **Hybrid Architecture**: Switch between local in-process microsecond execution or cloud HTTP worker rendering with the exact same document definition.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 📦 Installation
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Install from wheel or PyPI
|
|
53
|
+
pip install flowpdf
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Or install locally from wheel:
|
|
57
|
+
```bash
|
|
58
|
+
pip install flowpdf
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 🚀 Quickstart: In-Process Native PDF Generation
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
from flowpdf import ReportDocument, FlowPdfEngine
|
|
67
|
+
|
|
68
|
+
# 1. Build document declaratively with Fluent API
|
|
69
|
+
doc = (
|
|
70
|
+
ReportDocument()
|
|
71
|
+
.title("Factura Comercial Electrónica")
|
|
72
|
+
.page(lambda p: p.a4().portrait().margin(15))
|
|
73
|
+
.header(lambda h: (
|
|
74
|
+
h.row(lambda r: (
|
|
75
|
+
r.column(lambda c: (
|
|
76
|
+
c.text("FLOWPDF ENTERPRISE").style("h2").bold().color("#1E40AF"),
|
|
77
|
+
c.text("Facturación Electrónica en Español: á é í ó ú ñ Ñ ¿ ¡ €").style("caption").color("#4B5563"),
|
|
78
|
+
), flex=3),
|
|
79
|
+
r.column(lambda c: (
|
|
80
|
+
c.qr_code("https://example.com/verify/FAC-2026-9901", size=60),
|
|
81
|
+
), flex=1),
|
|
82
|
+
))
|
|
83
|
+
))
|
|
84
|
+
.content(lambda c: (
|
|
85
|
+
c.spacer(10),
|
|
86
|
+
c.table(lambda t: (
|
|
87
|
+
t.column("Código", "sku", lambda col: col.width(70)),
|
|
88
|
+
t.column("Descripción del Artículo", "description", lambda col: col.flex(3)),
|
|
89
|
+
t.column("Cant.", "quantity", lambda col: col.width(50).center()),
|
|
90
|
+
t.column("Precio Unitario", "price", lambda col: col.width(90).right()),
|
|
91
|
+
t.column("Total", "total", lambda col: col.width(90).right()),
|
|
92
|
+
t.header_background("#1E40AF"),
|
|
93
|
+
t.zebra(True),
|
|
94
|
+
t.data([
|
|
95
|
+
{"sku": "SRV-01", "description": "Licencia Enterprise FlowPDF Anual", "quantity": 1, "price": "€ 1,200.00", "total": "€ 1,200.00"},
|
|
96
|
+
{"sku": "SUP-02", "description": "Soporte Técnico 24/7 y Consultoría", "quantity": 2, "price": "€ 150.00", "total": "€ 300.00"},
|
|
97
|
+
{"sku": "TRN-03", "description": "Capacitación de Ingeniería Avanzada", "quantity": 1, "price": "€ 450.00", "total": "€ 450.00"},
|
|
98
|
+
])
|
|
99
|
+
)),
|
|
100
|
+
c.spacer(15),
|
|
101
|
+
c.divider(1.0, color="#CBD5E1"),
|
|
102
|
+
c.spacer(5),
|
|
103
|
+
c.row(lambda r: (
|
|
104
|
+
r.column(lambda col: (
|
|
105
|
+
col.barcode("FAC20269901", barcode_type="code128", width=160, height=35),
|
|
106
|
+
), flex=1),
|
|
107
|
+
r.column(lambda col: (
|
|
108
|
+
col.text("Subtotal: € 1,950.00").align("right"),
|
|
109
|
+
col.text("ITBIS / IVA (18%): € 351.00").align("right"),
|
|
110
|
+
col.text("Total Facturado: € 2,301.00").style("h2").bold().color("#16A34A").align("right"),
|
|
111
|
+
), flex=1),
|
|
112
|
+
)),
|
|
113
|
+
))
|
|
114
|
+
.footer(lambda f: (
|
|
115
|
+
f.text("Documento generado in-process con FlowPDF Rust Core").style("caption").center()
|
|
116
|
+
))
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
# 2. Render directly in-process to PDF in ~30 ms!
|
|
120
|
+
pdf_bytes = doc.render_pdf()
|
|
121
|
+
|
|
122
|
+
with open("factura_electronica.pdf", "wb") as f:
|
|
123
|
+
f.write(pdf_bytes)
|
|
124
|
+
|
|
125
|
+
print(f"✅ PDF generado exitosamente ({len(pdf_bytes)} bytes)!")
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## 🌐 Remote HTTP Rendering (Cloud / Server)
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
from flowpdf import FlowPdfClient, ReportDocument
|
|
134
|
+
|
|
135
|
+
client = FlowPdfClient(base_url="http://localhost:8000", api_key="secret-api-key")
|
|
136
|
+
|
|
137
|
+
doc = (
|
|
138
|
+
ReportDocument()
|
|
139
|
+
.title("Reporte Remoto")
|
|
140
|
+
.content(lambda c: c.text("Generado en worker asíncrono con Celery y Redis").style("h1"))
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
# Render via HTTP
|
|
144
|
+
response = client.render(template_data=doc.build(), format="pdf")
|
|
145
|
+
response.save("reporte_remoto.pdf")
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## 📄 License
|
|
151
|
+
|
|
152
|
+
MIT © 2026 Edwin Abreu, Felix R. Benzan & FlowPDF Contributors.
|
flowpdf-1.1.7/README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# FlowPDF Python SDK
|
|
2
|
+
|
|
3
|
+
Universal Document Engine and Fluent Report Builder SDK for Python, powered by in-process **Rust Core** and high-throughput remote HTTP rendering.
|
|
4
|
+
|
|
5
|
+
🇩🇴 **Made in the Dominican Republic** — FlowPDF is an open-source Dominican library for report and PDF generation.
|
|
6
|
+
|
|
7
|
+
[](https://pypi.org/project/flowpdf/)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## ⚡ Key Highlights
|
|
13
|
+
|
|
14
|
+
- **Ultra-Fast In-Process Generation**: Renders complete PDF documents in **~15ms - 40ms** with zero network latency using native Rust Core.
|
|
15
|
+
- **Embedded Multi-Platform Runtimes**: Bundles precompiled `win-x64` (`flowpdf_native.dll`) and `linux-x64` (`libflowpdf_native.so`) runtimes automatically loaded via `ctypes`.
|
|
16
|
+
- **Full Unicode & Spanish Accents Support**: Flawlessly renders Spanish accents (`á, é, í, ó, ú, ñ, Ñ`), inverted marks (`¿, ¡`), and currency symbols (`€, $, £`) with WinAnsi hexadecimal encoding.
|
|
17
|
+
- **Fluent Report Builder**: Declarative, composable, type-safe API for headers, tables, barcodes, QR codes, columns, rows, and cards.
|
|
18
|
+
- **Hybrid Architecture**: Switch between local in-process microsecond execution or cloud HTTP worker rendering with the exact same document definition.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 📦 Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Install from wheel or PyPI
|
|
26
|
+
pip install flowpdf
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Or install locally from wheel:
|
|
30
|
+
```bash
|
|
31
|
+
pip install flowpdf
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 🚀 Quickstart: In-Process Native PDF Generation
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
from flowpdf import ReportDocument, FlowPdfEngine
|
|
40
|
+
|
|
41
|
+
# 1. Build document declaratively with Fluent API
|
|
42
|
+
doc = (
|
|
43
|
+
ReportDocument()
|
|
44
|
+
.title("Factura Comercial Electrónica")
|
|
45
|
+
.page(lambda p: p.a4().portrait().margin(15))
|
|
46
|
+
.header(lambda h: (
|
|
47
|
+
h.row(lambda r: (
|
|
48
|
+
r.column(lambda c: (
|
|
49
|
+
c.text("FLOWPDF ENTERPRISE").style("h2").bold().color("#1E40AF"),
|
|
50
|
+
c.text("Facturación Electrónica en Español: á é í ó ú ñ Ñ ¿ ¡ €").style("caption").color("#4B5563"),
|
|
51
|
+
), flex=3),
|
|
52
|
+
r.column(lambda c: (
|
|
53
|
+
c.qr_code("https://example.com/verify/FAC-2026-9901", size=60),
|
|
54
|
+
), flex=1),
|
|
55
|
+
))
|
|
56
|
+
))
|
|
57
|
+
.content(lambda c: (
|
|
58
|
+
c.spacer(10),
|
|
59
|
+
c.table(lambda t: (
|
|
60
|
+
t.column("Código", "sku", lambda col: col.width(70)),
|
|
61
|
+
t.column("Descripción del Artículo", "description", lambda col: col.flex(3)),
|
|
62
|
+
t.column("Cant.", "quantity", lambda col: col.width(50).center()),
|
|
63
|
+
t.column("Precio Unitario", "price", lambda col: col.width(90).right()),
|
|
64
|
+
t.column("Total", "total", lambda col: col.width(90).right()),
|
|
65
|
+
t.header_background("#1E40AF"),
|
|
66
|
+
t.zebra(True),
|
|
67
|
+
t.data([
|
|
68
|
+
{"sku": "SRV-01", "description": "Licencia Enterprise FlowPDF Anual", "quantity": 1, "price": "€ 1,200.00", "total": "€ 1,200.00"},
|
|
69
|
+
{"sku": "SUP-02", "description": "Soporte Técnico 24/7 y Consultoría", "quantity": 2, "price": "€ 150.00", "total": "€ 300.00"},
|
|
70
|
+
{"sku": "TRN-03", "description": "Capacitación de Ingeniería Avanzada", "quantity": 1, "price": "€ 450.00", "total": "€ 450.00"},
|
|
71
|
+
])
|
|
72
|
+
)),
|
|
73
|
+
c.spacer(15),
|
|
74
|
+
c.divider(1.0, color="#CBD5E1"),
|
|
75
|
+
c.spacer(5),
|
|
76
|
+
c.row(lambda r: (
|
|
77
|
+
r.column(lambda col: (
|
|
78
|
+
col.barcode("FAC20269901", barcode_type="code128", width=160, height=35),
|
|
79
|
+
), flex=1),
|
|
80
|
+
r.column(lambda col: (
|
|
81
|
+
col.text("Subtotal: € 1,950.00").align("right"),
|
|
82
|
+
col.text("ITBIS / IVA (18%): € 351.00").align("right"),
|
|
83
|
+
col.text("Total Facturado: € 2,301.00").style("h2").bold().color("#16A34A").align("right"),
|
|
84
|
+
), flex=1),
|
|
85
|
+
)),
|
|
86
|
+
))
|
|
87
|
+
.footer(lambda f: (
|
|
88
|
+
f.text("Documento generado in-process con FlowPDF Rust Core").style("caption").center()
|
|
89
|
+
))
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
# 2. Render directly in-process to PDF in ~30 ms!
|
|
93
|
+
pdf_bytes = doc.render_pdf()
|
|
94
|
+
|
|
95
|
+
with open("factura_electronica.pdf", "wb") as f:
|
|
96
|
+
f.write(pdf_bytes)
|
|
97
|
+
|
|
98
|
+
print(f"✅ PDF generado exitosamente ({len(pdf_bytes)} bytes)!")
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## 🌐 Remote HTTP Rendering (Cloud / Server)
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
from flowpdf import FlowPdfClient, ReportDocument
|
|
107
|
+
|
|
108
|
+
client = FlowPdfClient(base_url="http://localhost:8000", api_key="secret-api-key")
|
|
109
|
+
|
|
110
|
+
doc = (
|
|
111
|
+
ReportDocument()
|
|
112
|
+
.title("Reporte Remoto")
|
|
113
|
+
.content(lambda c: c.text("Generado en worker asíncrono con Celery y Redis").style("h1"))
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
# Render via HTTP
|
|
117
|
+
response = client.render(template_data=doc.build(), format="pdf")
|
|
118
|
+
response.save("reporte_remoto.pdf")
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## 📄 License
|
|
124
|
+
|
|
125
|
+
MIT © 2026 Edwin Abreu, Felix R. Benzan & FlowPDF Contributors.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""
|
|
2
|
+
FlowPDF Python SDK
|
|
3
|
+
Universal Document & Report Engine with In-Process Rust Core and Cloud API Client.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from .native import FlowPdfEngine
|
|
7
|
+
from .builder import (
|
|
8
|
+
ReportDocument,
|
|
9
|
+
PageConfigBuilder,
|
|
10
|
+
ColumnBuilder,
|
|
11
|
+
RowBuilder,
|
|
12
|
+
TableBuilder,
|
|
13
|
+
TableColumnBuilder,
|
|
14
|
+
ContainerBuilder,
|
|
15
|
+
TextBuilder,
|
|
16
|
+
)
|
|
17
|
+
from .client import FlowPdfClient
|
|
18
|
+
from .response import ReportResponse
|
|
19
|
+
from .exceptions import (
|
|
20
|
+
FlowPdfSDKError,
|
|
21
|
+
AuthenticationError,
|
|
22
|
+
NotFoundError,
|
|
23
|
+
ValidationError,
|
|
24
|
+
ServerError,
|
|
25
|
+
TimeoutError,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
__version__ = "1.1.7"
|
|
29
|
+
|
|
30
|
+
def extract_text(pdf_bytes: bytes) -> str:
|
|
31
|
+
"""Extracts text from PDF bytes using native Rust Core."""
|
|
32
|
+
return FlowPdfEngine.extract_text(pdf_bytes)
|
|
33
|
+
|
|
34
|
+
def extract_document(pdf_bytes: bytes, options=None) -> dict:
|
|
35
|
+
"""Extracts structured document data (pages, metadata) from PDF bytes using native Rust Core."""
|
|
36
|
+
return FlowPdfEngine.extract_document(pdf_bytes, options)
|
|
37
|
+
|
|
38
|
+
__all__ = [
|
|
39
|
+
# In-Process Native Engine
|
|
40
|
+
"FlowPdfEngine",
|
|
41
|
+
"extract_text",
|
|
42
|
+
"extract_document",
|
|
43
|
+
# Fluent Builders
|
|
44
|
+
"ReportDocument",
|
|
45
|
+
"PageConfigBuilder",
|
|
46
|
+
"ColumnBuilder",
|
|
47
|
+
"RowBuilder",
|
|
48
|
+
"TableBuilder",
|
|
49
|
+
"TableColumnBuilder",
|
|
50
|
+
"ContainerBuilder",
|
|
51
|
+
"TextBuilder",
|
|
52
|
+
# Remote HTTP Client
|
|
53
|
+
"FlowPdfClient",
|
|
54
|
+
"ReportResponse",
|
|
55
|
+
# Exceptions
|
|
56
|
+
"FlowPdfSDKError",
|
|
57
|
+
"AuthenticationError",
|
|
58
|
+
"NotFoundError",
|
|
59
|
+
"ValidationError",
|
|
60
|
+
"ServerError",
|
|
61
|
+
"TimeoutError",
|
|
62
|
+
]
|