This API allows you to generate PDF files from web pages using Express and Puppeteer.
Warning
This API is not deployed, the request of api returns a 500 http error
- Installed Node.js
- npm or yarn installed
- Clone the repository or create a new directory for the project.
- Inside the project directory, initialize a new Node.js project:
npm init -y
- Install the necessary dependencies (Express and Puppeteer):
npm install express puppeteer
or
yarn add express puppeteer
To generate a PDF from a web page, make a GET request to the /generate-pdf
endpoint with the following query parameters:
url
: The URL of the web page to be converted to PDF.filename
(optional): The desired name for the PDF file (without the ".pdf" extension).
Example:
GET http://localhost:3000/generate-pdf?url=https://example.com&filename=myfile
This will generate a PDF file from the specified page and initiate the download with the specified name.