This Express application serves as a PDF Generator API providing endpoints for uploading, retrieving, and extracting PDF files. It uses the pdf-lib library for PDF manipulation and multer for file uploading functionality.
GET /pdf/:filename| Parameter | Type | Description |
|---|---|---|
filename |
string |
Required. Your pdf filename |
POST /upload| Form Data | Type | Description |
|---|---|---|
file |
application/pdf |
Required. pdf file |
POST /register| Body | Type | Description |
|---|---|---|
| `{ | json |
Required. email, password |
| "email": "email", | ||
| "password": "password" | ||
| }` |
POST /login| Body | Type | Description |
|---|---|---|
| `{ | json |
Required. email, password |
| "email": "email", | ||
| "password": "password" | ||
| }` |
POST /extract-pages| Body | Type | Description |
|---|---|---|
| `{ | json |
Required. filename, selectedPages |
| "filename": "sample.pdf", | ||
| "selectedPages": [1, 3, 7], | ||
| "newFilename": "custom_extracted_file.pdf" | ||
| }` |
POST /login/extract-pages| Body | Type | Description |
|---|---|---|
| `{ | json |
Required. filename, selectedPages |
| "filename": "sample.pdf", | ||
| "selectedPages": [1, 3, 7], | ||
| "newFilename": "custom_extracted_file.pdf" | ||
| }` |
Install pdf-generator with git:
git clone https://github.com/ugauniyal/PDF-Generator.git
cd PDF-Generator/backendRun pdf-generator.:
node pdf-generator.jsTo run tests, run the following command. I used supertest to create the tests and jest for running the tests.
npm testhttps://pdf-generator-3n4m.onrender.com/
This NextJS application serves as a PDF Generator which lets the user to upload the pdf using a dropzone and then the user can preview the pages of the pdf that they uploaded. The user can also select the pages that they want to extract and then click on generate PDF to get a download link for the new pdf with extracted pages.
This is a Next.js project bootstrapped with create-next-app.
First, run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun devOpen http://localhost:3000 with your browser to see the result.
Install pdf-generator with git:
git clone https://github.com/ugauniyal/PDF-Generator.git
cd PDF-Generator/pdf-appTo run tests, run the following command. I used enzyme to create the tests and jest for running the tests.
npm test




