This project provides an HTTP API wrapper around the dompdf library which converts HTML to PDF. The API is created using the Laravel framework, and you can protect the API using the basic HTTP authentication scheme.
Run the docker container using the command below
docker run -p 8000:80 ndolestudio/dompdf-api
Make an HTTP request to convert an HTML string into a PDF file called document.pdf
curl -X POST -d '<h1>Hello World</h1>' http://localhost:8000 --output document.pdf
If you want to protect the API with basic auth, you can set the AUTH_USERNAME
and AUTH_PASSWORD
environment variables when running the docker container
docker run -p 8000:80 \
--env AUTH_USERNAME="username" \
--env AUTH_PASSWORD="password" \
ndolestudio/dompdf-api
NOTE: You must now set the username and password when making requests to the API
## username:password in base64 is dXNlcm5hbWU6cGFzc3dvcmQ=
curl -X POST -d '<h1>Hello World</h1>' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
http://localhost:8000 --output document.pdf
If you discover a security vulnerability within the dompdf-api service, please send an e-mail to Acho Arnold via [email protected]. All security vulnerabilities will be promptly addressed.
dompdf-api is an open-sourced software licensed under the MIT license.