PDF generation API
You need node
and we highly recommend installing it through a Version Manager, such as nvm
. The following will install node
LTS and npm
brew install nvm
nvm install --lts
We use bun
to install dependencies and run the app. Use brew
🍺 to install it.
brew install oven-sh/bun/bun
Install the Javascript dependencies
bun install
Run the following command to start the server:
bun start
To start in development mode, with the server reloading on each file change, run:
bun dev
Send a POST request to the /generate
endpoint with a JSON body containing the HTML you want to convert to a PDF.
curl -X POST "https://pdfgen.so/api/v1/generate" -H "Content-Type: application/json" -d '{"html": "<h1>Hello World</h1>"}'
The response will contain the PDF file.
PDFs are generated synchronously and are not saved to disk.
Bruno API client collection is saved in the bruno
folder. Import the collection and run it to test the API.