A Node.js utility for extracting and processing data from PDF files. This tool reads a PDF, extracts words along with their page and line numbers, and saves the results as a JSON file.
- Extracts words from PDF files
- Tracks page and line numbers for each word
- Filters out short and special-character words
- Exports results to a clean, readable JSON file
git clone https://github.com/yourusername/pdf-processing-project.git
cd pdf-processing-projectnpm installPlace your PDF file (e.g., Lecturesonvedanta.pdf) in the project directory.
npm startThe extracted word data will be saved to word_data.json.
- Reads the PDF file using
pdf-parse - Splits the text into pages and lines
- Extracts words, cleans them, and filters out words shorter than 4 characters
- Saves the output as a JSON array with word, page, and line information
.
├── index.js # Main script
├── Lecturesonvedanta.pdf# Sample PDF (add your own)
├── word_data.json # Output file
├── package.json # Project metadata
└── .gitignore
[
{
"word": "Vedanta",
"page": 0,
"line": 1
},
{
"word": "philosophy",
"page": 0,
"line": 2
}
]