This program is designed to process PDF files by removing specific pages from them depending on their page count.
- Make sure you have Node.js installed.
- Copy the contents of the
index.js
file into your project. - Install the necessary dependencies using the command
npm install pdf-lib fs
.
- Place the PDF files that need to be processed in folders in the specified format.
- Run the program, specifying the path to the root folder containing the folders with PDF files.
- The program will automatically process all PDF files according to the specified logic of page removal.
node index.js
-
removePages(filename, currPath)
: Function to remove pages from a PDF file depending on the number of pages. -
getDirectories(path)
: Function to get a list of folders in the specified directory.
filename
: Name of the PDF file.currPath
: Path to the current folder.
- The program works with PDF files located in the specified folders and does not modify the original files, but creates copies with modified pages.
- Before using, make sure you have all the necessary dependencies installed and that the paths to files and folders are correctly specified.
Yevhen Stuzhuk