• Python 97.6%
  • Dockerfile 2.4%
Find a file
2026-04-12 22:09:01 +08:00
.forgejo/workflows fix: ci issue 2026-04-10 04:16:53 +08:00
.vscode Feat/pdf-to-images (#1) 2026-04-09 22:00:40 +02:00
app feat: setup rate-limiting headers 2026-04-12 22:09:01 +08:00
tests chore: ci deploy 2026-04-04 01:37:59 +08:00
vendored Feat/pdf-to-images (#1) 2026-04-09 22:00:40 +02:00
.gitignore Feat/pdf-to-images (#1) 2026-04-09 22:00:40 +02:00
.python-version init app 2026-04-04 00:48:20 +08:00
docker-compose.yml feat: setup docker deploy 2026-04-04 00:52:10 +08:00
Dockerfile feat: setup docker deploy 2026-04-04 00:52:10 +08:00
LICENSE add license 2026-04-04 01:06:31 +08:00
pyproject.toml feat: setup rate-limiting headers 2026-04-12 22:09:01 +08:00
README.md docs: update readme 2026-04-10 04:22:06 +08:00
uv.lock feat: setup rate-limiting headers 2026-04-12 22:09:01 +08:00

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"
}