Albin O. Kuhn Library & Gallery - Staff Wiki


Using the File Combination Tool

File Combination Tool

This tool is designed to combine various types of files (such as PDFs, DOCX, PPTX) into a single PDF file. It also handles conversion of DOCX and PPTX files to PDF format.

 

Requirements

Python 3.x

tkinter

pandas

PyPDF2

docx2pdf

spire.presentation

moviepy

 

Following steps are to be done before using this tool for the first time only-

Python-

Ensure Python is installed in your system.

  1. In Windows search bar, type Command prompt or cmd.

  1. Type python -V

It will show python version. Ensure it is 3.2 or higher.

 

Install pip packages-

In the command prompt type these commands separately or download requirements.txt-

Pandas:

pip install pandas

PyPDF2:

pip install PyPDF2

docx2pdf:

pip install docx2pdf

spire-presentation:

pip install spire-presentation

moviepy:

pip install moviepy

 

If requirements.txt is downloaded then copy the complete path where this file got downloaded-

pip install -r PATH/requirements.txt

 

Usage Instructions

  1. Ensure all necessary dependencies are installed.

  1. If the spreadsheet that you’re working on doesn’t already contain columns AE, Main_file, and AF, Additional_files, add those columns to it

  1. In the Main_file column, fill in the name of the coversheet followed by a comma, followed by the name of the file

  1. In the Additional_files column, fill in the name of any supplementary file (If there are more than 1 then zip them and add zip file name here)

  1. Download the script: Download the File_combine_tool.py

  1. Ensure the excel file and all main/supplementary files are closed before running the script.

  1. Run the Script:

·         Double-click the File_combine_tool.py file to execute the script.

·         Alternatively, run the script from the command line using the following command:

python File_combine_tool.py

  1. Browse and Select Files:

    • Browse and select the Excel file containing the list of files to be combined.

    • Browse and select the input folder containing the files listed in the Excel file.

    • Browse and select the output folder where the combined files will be saved.

  2. Execute Script:

    • After selecting the Excel files, click the " Combine Files " button.

  3. Script Completion:

    • Once the process is complete, a message box will indicate successful completion, and the program will close after pressing OK

    • Once the process is complete, check if all the files are in the output folder.

  4. Check excel file. If file is not combined properly or some error is encountered, it will show “Please combine files manually” instead of the filename.

  5. Check the same thing for extent. Error- “Please fill manually”.

  6. View Logs:

    • Logs for the script execution are stored in a file named file_combine.log which is in the same folder as the script.

    • This log file provides information about any errors encountered during the file processing such as file not found in the input folder, error while opening a file, error while converting/combining the files etc.

  7. Work on these errors and try to resolve them. Once resolved, you can work on these files manually or run the script again.

 

Notes

  1. Ensure file names match the names written in excel sheet. (Filenames in the excel sheet should be written along with their extensions. PDF file names with or without extensions are ok)

  1. Close the excel file before running the tool.

  1. Ensure all files and coversheets are in the input folder.

  1. If any 1 of the files (coversheet, main file or additional file) given in spreadsheet is missing from the input folder, “Please combine files manually” error will show in the spreadsheet. Due to which file this error is coming, can be seen in the logs.

  1. If the file is there in the input folder but still “file not found” error is coming in the logs, it means there is mismatch in the file name.


Albin O. Kuhn Library & Gallery . University of Maryland, Baltimore County . 1000 Hilltop Circle . Baltimore MD 21250
(410) 455-2232. Questions and comments to: Web Services Librarian