A REST API service that provides PDF generation and screenshot capabilities using headless Chrome.
Convert HTML to PDF.
Request:
{
"html": "<html><body>Hello World</body></html>",
"options": {
"landscape": false,
"print_background": true,
"scale": 1.0,
"paper_width": 8.5,
"paper_height": 11,
"margin_top": 0.4,
"margin_bottom": 0.4,
"margin_left": 0.4,
"margin_right": 0.4
}
}Response: PDF file (application/pdf)
Convert HTML to PDF/A.
Request: Same as /v1/print
Response: PDF/A file (application/pdf)
Convert an existing PDF to PDF/A.
Request:
{
"pdf": "base64-encoded-pdf-content",
"options": {
"pdfa_version": "3b"
}
}Response: PDF/A file (application/pdf)
Capture a screenshot of HTML content.
Request:
{
"html": "<html><body>Hello World</body></html>",
"options": {
"width": 1280,
"height": 720,
"full_page": false
}
}Response: PNG image (image/png)
go run main.godocker build -t chrome-service .
docker run -p 8080:8080 chrome-servicePORT: HTTP server port (default: 8080)