httpdf
PDF as React components, props over HTTP.
Getting started
- Extend the
n6g7/httpdf
image and copy your own PDF documents source: - Build and run:
- Generate pdf with HTTP requests:
See the example directory for a full example with docker-compose.
Features
Props
Query parameters and body data sent with the request are passed to the react components as props.
They are validated using prop-types and, if there are any, errors are returned with a 400 HTTP response.
Custom filename
By default, the suggested filename of the generated pdf will be computed from the component's file name (doc.js
-> doc.pdf
).
If you would like to receive a different filename, you can override it with the filename
query parameter:
Watch mode
Use the HTTPDF_WATCH
environment variable while developing to watch and automatically reload files as you make changes:
Images
Copy your image files anywhere on the docker image and you can use the react-pdf API to render images:
See react-pdf docs for the list of available props.
Custom fonts
Copy your font files anywhere on the docker image and you can use the react-pdf API to use custom fonts:
Browse the test files for a description of all the features.
Async props
Perform asynchronous actions before rendering in the getAsyncProps
static method:
Contributing
- Release:
yarn version && make release