Creates a PDF given a FHIR resource.
- nodejs
Developed with node version - v22.2.0.
If you are developing with multiple nodejs versions, use NVM
- Install dependencies
npm install
- Run the server
node server.js
This will start the server on port 9000 by default
You may provide variables through the .env file
node --env-file=.env server.js
The service first uses EJS templates to bind a HTML template with the data, and then uses Puppeteer to convert the generated HTML to PDF. FhirPath is used as expression insides the ejs templates. See fhirpath.js for help on how to evaluate expressions.
curl -X POST --data "@./tests/resources/prescription.json" http://localhost:9000/prescription --output prescription.pdf
| property | description | example value |
|---|---|---|
| PORT | server port to listen to | 3000 |
| CACHE_TEMPLATE | if template content should be cached | true |
| TMPL_BASE_URL | base path of the templates. Can be http or file-path | http://localhost:8000 or /Users/yourname/templates |