This server is built with Node.js and Express to compare text content between two uploaded PDF files.
- Node.js installed on your machine
- npm (Node Package Manager)
- Clone the repository:
https://github.com/itsRkator/compare-pdf - Navigate to the project directory:
cd compare-pdf - Install dependencies:
npm install
- Start the server:
node index.jsornpm start - The server will run on port 3000 by default (
http://localhost:3000/compare-pdfs)
- Upload two PDF files with keys
file1andfile2to compare their content. - If the files have differences, it will return the differing lines.
- If the files are identical, it will return a message indicating that.
- Open Postman and create a new POST request to
http://localhost:3000/compare-pdfs. - In the Body tab, select form-data.
- Add two keys:
file1andfile2, and select your PDF files for each key. - Click Send to initiate the comparison process.
Example using cURL:
curl -X POST -F "file1=@/path/to/first/file.pdf" -F "file2=@/path/to/second/file.pdf" http://localhost:3000/compare-pdfs
- express: Web framework for Node.js
- multer: Middleware for handling multipart/form-data (file uploads)
- pdf-parse: Library for extracting text from PDF files