python
python
npm list
PYTHON
To run this script on your laptop, you need to install the required dependencies. Here's what each part of
the code does and what you need to install:
Open the command prompt (cmd) and run the following command:
pymupdf (fitz) → This library allows reading, editing, and splitting PDFs.
tk (Tkinter) → This is a built-in Python library used to create graphical interfaces, such as file upload
dialogs.
python
Copy
Edit
from tkinter import filedialog # File dialog for selecting the PDF
fitz (from PyMuPDF) is used to open, read, and manipulate PDF files.
tkinter is used to create a graphical user interface (GUI) to select files.
python
Copy
Edit
Copy
Edit
def upload_file():
root = tk.Tk()
if file_path:
Passes the selected file to the split_pdf function with 10 pages per split.
4. Main Execution
python
Copy
Edit
if __name__ == "__main__":
upload_file()
Final Steps
Run it using:
sh
Copy
Edit
python split_pdf.py
The script will split the PDF into smaller files and save them in the same directory.