ElasticSuite / chrome-print

basic chrome headless print server

Repository from Github https://github.comElasticSuite/chrome-printRepository from Github https://github.comElasticSuite/chrome-print

chrome-print

A headless chrome process with an express-based API in front of it. Upload an HTML file, specify width and height, get a PDF back.

Run

docker-compose up

Usage

# get the port the server is listening on
port=`docker ps |grep chromeprint_print |sed 's/.*:\([0-9]*\)-.*/\1/'`

# send the request
curl \
  -F "htmlFile=@test.html" \
  -F "width=8.5" \
  -F "height=11" \
  -X POST \
  -H "Content-Type: multipart/form-data" \
  -o test.pdf \
  http://localhost:$port/

Attribution

I basically copied and adapted code from this guy. My whole solution is obviously cobbled together from various slapped together sources, but it fits my needs.

About

basic chrome headless print server

License:MIT License


Languages

Language:JavaScript 87.2%Language:Shell 11.7%Language:HTML 1.1%