Leverages the Puppeteer library to expose Chromium print-to-pdf and screenshot over a service
Use this web service to programatically convert web pages to PDF or image. For example, create a cron job that uses the service to generate a daily report PDF from a web page and then email it. The HTML form allows you to easily build your request for embedding in an application. This service should only be installed internally on an intranet and not exposed to the Internet as it can be easily abused and would be a high security risk (For example using a file:// protocol in the URL exposes local files).
- Grab project
git clone https://github.com/jeffersonlab/puppet-show
cd puppet-show
- Launch Compose
docker compose up
- Launch web browser
http://localhost:3000/puppet-show
Note: Container requires privileged
mode in order to launch Chrome in a sandbox.
npm i puppet-show
npm start
Note: This application runs on the Node.js JavaScript runtime, which can be downloaded here.
The URL parameter names for the web service end point puppet-show/pdf and puppet-show/screenshot mirror the option names for the puppeteer print-to-pdf and screenshot functions found here. The puppet-show web forms can also be used to explore the API.
Note: The default values match the puppeteer defaults and the only required parameter is "url".
export PORT=3000
npm start
Note: Use the appropriate set environment variable command for your shell; Bash shell shown above. For C Shell use "setenv PORT 3000", and for Windows use "set PORT 3000".
- Bump the version number in package.json and the two instances in package-lock.json.
- Bump the version number in the VERSION file and commit and push to GitHub (using Semantic Versioning).
- The CD GitHub Action should run automatically invoking:
- The Create release GitHub Action to tag the source and create release notes summarizing any pull requests. Edit the release notes to add any missing details.
- The Publish NPM GitHub Action to create a deployment artifact on NPM.
- The Publish docker image GitHub Action to create a new demo Docker image.
The app is deployed at JLab on nodejs9.acc.jlab.org.