Skip to content

A Restful API for print PDF with WeasyPrint.

License

Notifications You must be signed in to change notification settings

timfanda35/weasyprint-pdf-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WeasyPrint PDF API

A Restful API for print PDF with WeasyPrint.

Use the pre-build container image

Pull Image

Get the latest version (main branch)

docker pull ghcr.io/timfanda35/weasyprint-pdf-api:latest

Or use specific version (recommended)

docker pull ghcr.io/timfanda35/weasyprint-pdf-api:1.1.1

Run Container

Run with default port 8000

docker run -it --rm -p 8000:8000 ghcr.io/timfanda35/weasyprint-pdf-api:latest

Run with specific port, like 8080

docker run -it --rm -p 8080:8080 -e PORT=8080 ghcr.io/timfanda35/weasyprint-pdf-api:latest

Access Swagger UI

Open http://localhost:8000/docs in the browser.

Send Request

POST /pdfs, for example:

{ "html": "<h1>Hello World</h1>" }

Response will be streaming download.

You can also specific filename:

{ "filename": "shipping-label", "html": "<h1>Hello World</h1>" }

Development

Use thg dev container with VS Code

https://vscode.com.tw/docs/devcontainers/containers

Test

Install httpx and pytest

pip install httpx pytest

Run test cases

pytest

About

A Restful API for print PDF with WeasyPrint.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 2

  •  
  •