No description
https://pdf-tools-api.tbdh.app/
- Python 97.6%
- Dockerfile 2.4%
| .forgejo/workflows | ||
| .vscode | ||
| app | ||
| tests | ||
| vendored | ||
| .gitignore | ||
| .python-version | ||
| docker-compose.yml | ||
| Dockerfile | ||
| LICENSE | ||
| pyproject.toml | ||
| README.md | ||
| uv.lock | ||
pdf-tools-api
A REST API for extracting and processing PDF document content.
API URL: https://pdf-tools-api.tbdh.app/
Requirements
- Python >= 3.13
- uv
Setup
uv sync
Running
uv run fastapi dev
API Endpoints
POST /extract
Extract content from a PDF file at a given URL.
Request body:
| Field | Type | Default | Description |
|---|---|---|---|
pdf_url |
string (URL) |
required | URL pointing to the PDF file |
pages |
int[] |
null |
1-indexed list of pages to extract (all pages if omitted) |
include_header |
bool |
false |
Include page headers in output |
include_footer |
bool |
false |
Include page footers in output |
ignore_images |
bool |
true |
Skip images during extraction |
separate_pages |
bool |
false |
Return each page as a separate chunk |
include_pages_separators |
bool |
false |
Add separators between pages |
output |
string |
"markdown" |
Output format: markdown, json, or text |
Limits: PDF files must be under 5 MB.
Example:
{
"pdf_url": "https://example.com/document.pdf",
"pages": [1, 2, 3],
"output": "markdown"
}
POST /convert
Convert pages of a PDF file to images and upload them to storage.
Request body:
| Field | Type | Default | Description |
|---|---|---|---|
pdf_url |
string (URL) |
required | URL pointing to the PDF file |
pages |
int[] |
null |
1-indexed list of pages to convert (all pages if omitted) |
images_output |
string |
"png" |
Output image format: png or jpeg |
Response:
{
"converted_images": [
"https://cdn.example.com/folder/doc-id/page_1.png",
"https://cdn.example.com/folder/doc-id/page_2.png"
]
}
Limits: PDF files must be under 5 MB.
Example:
{
"pdf_url": "https://example.com/document.pdf",
"pages": [1, 2],
"images_output": "jpeg"
}