PDFMAN is a Puppeteer-based and wrapper providing a web API as an alternative to wkhtmltopdf. It exposes a web API for generating a PDF file from an HTML document. PDFMAN is built on top of the Puppeteer Report and is available as a Docker image on Docker Hub.
- Make sure you have Docker installed on your machine.
- Run the following command to start PDFMAN using Docker:
docker run --rm -p 3000:3000 -v /path/to/css/file/style.css:/app/tmp gorvelyfab/pdfman
- Access the PDFMAN API at
http://localhost:3000
to generate PDFs from HTML documents.
services:
pdfman:
image: gorvelyfab/pdfman
ports:
- 3000:3000
volumes:
./style.css:/app/tmp/style.css
environment:
PORT: 3000
Generate your first pdf document by making a post request at http://localhost:3000/pdf
. Make sur to Setup the request header Content-Type as multipart/form-data and the html file field name must be html
curl --request POST \
--url http://localhost:3000/pdf \
--header 'Content-Type: multipart/form-data \
--form html=@/home/gorvely/Downloads/demo/test.html
/* style.css */
body {
color: red;
}
<!-- file.html -->
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document Example</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Hello world</h1>
<p>This paragraph showing text colored in RED.</p>
</body>
</html>
Gorvely Tasinda gorvelyfab@gmail.com
Feel free to contribute to PDFMAN by submitting issues or pull requests. For major changes, please open an issue first to discuss potential modifications.
This project is licensed under the MIT License - see the LICENSE file for details.