-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
690 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,7 @@ venv/ | |
|
||
# Possible PDF generated from testing | ||
tests/outputs/** | ||
|
||
# Documentation site | ||
site/ | ||
.cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block outdated %} | ||
You're not viewing the latest version. | ||
<a href="{{ '../' ~ base_url }}"> | ||
<strong>Click here to go to latest.</strong> | ||
</a> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
### Added | ||
|
||
- Documentation site built with Github Pages and Material for MkDocs | ||
|
||
## [0.4.1] - 2023-12-11 | ||
|
||
### Fixed | ||
|
||
- Implemented an internal workaround for older Gotenberg versions and their handling of non-latin filenames. | ||
- When detected, the files will be copied into a temporary directory and the filename cleaned | ||
- Gotenberg 8.0.0 will start implementing something similar once released | ||
- The pulled Gotenberg image is now inspected, allowing local re-creation of failures against specific digests | ||
- The `:edge` tag testing is now allowed to fail | ||
|
||
## [0.4.0] - 2023-12-04 | ||
|
||
### Changed | ||
|
||
- Removed some certain special cases from coverage | ||
- Updated `pre-commit` hook versions | ||
- Updated how pytest is configured, so it will apply to any invocation | ||
- Updated test running image to log at warning or lower using text format | ||
- Updated test running image from 7.9.2 to 7.10.1 | ||
- For the moment, send both `pdfa` and `pdfFormat` for compatibility with 7.9 and 7.10 | ||
- See [here](https://github.com/stumpylog/gotenberg-client/issues/5#issuecomment-1839081129) for some subtle differences in what these options mean | ||
|
||
### Added | ||
|
||
- Added new test job against Gotenberg's `:edge` tag | ||
|
||
## [0.3.0] - 2023-10-17 | ||
|
||
### Added | ||
|
||
- Support for the output filename and request tracing for all routes | ||
|
||
### Removed | ||
|
||
- References to compression and Brotli. Gotenberg doesn't seem to ever compress response data | ||
|
||
### Fixed | ||
|
||
- An issue with the sorting of merging PDFs. Expanded testing to cover the merged ordering | ||
|
||
### Changed | ||
|
||
- Multiple merge calls on the same route will maintain the ordering of all files, rather than just per merge call | ||
|
||
## [0.2.0] - 2023-10-16 | ||
|
||
### Added | ||
|
||
- CodeQL scanning via GitHub | ||
- Codecov.io coverage shield | ||
|
||
### Changed | ||
|
||
- Updated pypa/gh-action-pypi-publish from 1.8.8 to 1.8.10 | ||
- Updated actions/checkout from 3 to 4 | ||
- Mis-spelled `gotenerg_url` for a `Client` is now `host` and no longer keyword only | ||
|
||
## [0.1.0] - 2023-10-15 | ||
|
||
### Added | ||
|
||
- Chromium conversion routes | ||
- LibreOffice conversion routes | ||
- PDF/A conversion route | ||
- PDF merge route | ||
- Health status route | ||
- Testing and typing all setup and passing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Gotenberg Python Client | ||
|
||
This is a Python client for interfacing with [Gotenberg](https://gotenberg.dev/), which in turn is a wrapper around | ||
powerful tools for PDF generation and creation in various ways, using a stateless API. It's a very powerful tool | ||
to generate and manipulate PDFs. | ||
|
||
## Features | ||
|
||
- HTTP/2 enabled by default | ||
- Abstract away the handling of multi-part/form-data and deal with `Path`s instead | ||
- Based on the modern [httpx](https://github.com/encode/httpx) library | ||
- Full support for type hinting and concrete return types as much as possible | ||
- Nearly full test coverage run against an actual Gotenberg server for multiple Python and PyPy versions | ||
|
||
## Examples | ||
|
||
Converting a single HTML file into a PDF: | ||
|
||
```python | ||
from gotenberg_client import GotenbergClient | ||
|
||
with GotenbergClient("http://localhost:3000") as client: | ||
with client.chromium.html_to_pdf() as route: | ||
response = route.index("my-index.html").run() | ||
Path("my-index.pdf").write_bytes(response.content) | ||
``` | ||
|
||
Converting an HTML file with additional resources into a PDF: | ||
|
||
```python | ||
from gotenberg_client import GotenbergClient | ||
|
||
with GotenbergClient("http://localhost:3000") as client: | ||
with client.chromium.html_to_pdf() as route: | ||
response = route.index("my-index.html").resource("image.png").resource("style.css").run() | ||
Path("my-index.pdf").write_bytes(response.content) | ||
``` | ||
|
||
Converting an HTML file with additional resources into a PDF/A1a format: | ||
|
||
```python | ||
from gotenberg_client import GotenbergClient | ||
from gotenberg_client.options import PdfAFormat | ||
|
||
with GotenbergClient("http://localhost:3000") as client: | ||
with client.chromium.html_to_pdf() as route: | ||
response = route.index("my-index.html").resources(["image.png", "style.css"]).pdf_format(PdfAFormat.A1a).run() | ||
Path("my-index.pdf").write_bytes(response.content) | ||
``` | ||
|
||
Converting a URL into PDF, in landscape format | ||
|
||
```python | ||
from gotenberg_client import GotenbergClient | ||
from gotenberg_client.options import PageOrientation | ||
|
||
with GotenbergClient("http://localhost:3000") as client: | ||
with client.chromium.html_to_pdf() as route: | ||
response = route.url("https://hello.world").orient(PageOrientation.Landscape).run() | ||
Path("my-world.pdf").write_bytes(response.content) | ||
``` | ||
|
||
To ensure the proper clean up of all used resources, both the client and the route(s) should be | ||
used as context manager. If for some reason you cannot, you should `.close` the client and any | ||
routes: | ||
|
||
```python | ||
from gotenberg_client import GotenbergClient | ||
|
||
try: | ||
client = GotenbergClient("http://localhost:3000") | ||
try: | ||
route = client.merge(["myfile.pdf", "otherfile.pdf"]).run() | ||
finally: | ||
route.close() | ||
finally: | ||
client.close() | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Roadmap | ||
|
||
## Webhooks | ||
|
||
Implement adding the [webhooks](https://gotenberg.dev/docs/webhook) via headers as defined in the | ||
documentation. |
Oops, something went wrong.