This is a simple PDF generation service built with Node.js, Express, and Puppeteer. It exposes an API endpoint that accepts HTML content and a title, and returns a PDF document.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- Node.js
- npm or yarn
- Clone the repository:
git clone <repository_url>- Navigate to the project directory:
cd pdf_generation- Install the dependencies:
npm installor
yarn installStart the server:
node app.jsThe server will start on port 4000. You can access it at http://localhost:4000.
Send a POST request to http://localhost:4000/generate_pdf with a JSON body containing title and html fields. The html field should contain the HTML content you want to convert to PDF.
Example:
{
"title": "Hello World",
"html": "<h1>Hello World</h1>"
}The server will return a PDF document.
This project is licensed under the MIT License.