diff --git a/scripts/word_to_pdf_converter/README.md b/scripts/word_to_pdf_converter/README.md new file mode 100644 index 0000000..14fdf39 --- /dev/null +++ b/scripts/word_to_pdf_converter/README.md @@ -0,0 +1,16 @@ +# Word file (docx) to PDF converter + +This is a easy-to-use Tkinter GUI application that takes a .docx file or a folder with .docx files as an input and converts them into .pdf files using the docx2pdf module + +### Installing Requirements + - Open Windows Command Prompt + - Run command ``` pip install docx2pdf ``` + +### Usage + - Install the requirements (Python and docx2pdf module) + - Run the script + - Select the file/files to be converted + - Wait for confirmation + + ### Screenshots + ![Screenshot](/scripts/word_to_pdf_converter/example_screenshot.jpg?raw=true) diff --git a/scripts/word_to_pdf_converter/Test.docx b/scripts/word_to_pdf_converter/Test.docx new file mode 100644 index 0000000..b08cc44 Binary files /dev/null and b/scripts/word_to_pdf_converter/Test.docx differ diff --git a/scripts/word_to_pdf_converter/Test.pdf b/scripts/word_to_pdf_converter/Test.pdf new file mode 100644 index 0000000..f7ee69e Binary files /dev/null and b/scripts/word_to_pdf_converter/Test.pdf differ diff --git a/scripts/word_to_pdf_converter/example_screenshot.jpg b/scripts/word_to_pdf_converter/example_screenshot.jpg new file mode 100644 index 0000000..75f685f Binary files /dev/null and b/scripts/word_to_pdf_converter/example_screenshot.jpg differ diff --git a/scripts/word_to_pdf_converter/requirements.txt b/scripts/word_to_pdf_converter/requirements.txt new file mode 100644 index 0000000..2405676 --- /dev/null +++ b/scripts/word_to_pdf_converter/requirements.txt @@ -0,0 +1 @@ +docx2pdf==0.1.8 \ No newline at end of file diff --git a/scripts/word_to_pdf_converter/script.py b/scripts/word_to_pdf_converter/script.py new file mode 100644 index 0000000..0026089 --- /dev/null +++ b/scripts/word_to_pdf_converter/script.py @@ -0,0 +1,32 @@ +import tkinter as tk +from docx2pdf import convert +import tkinter.ttk as ttk +from tkinter.filedialog import askopenfile, askdirectory +from tkinter.messagebox import showinfo + +win = tk.Tk() +win.title("Docx to PDF Converter") + + +def openfile(): + file = askopenfile(filetypes=[("Word Files", "*.docx")]) + convert(file.name) + showinfo("Done", "File Converted Successfully") + + +def openfolder(): + folder = askdirectory() + convert(folder) + showinfo("Done", "Files Converted Successfully") + + +label = tk.Label(win, text="Select File/Folder to convert: ") +label.grid(row=0, column=0, padx=5, pady=5) + +button1 = ttk.Button(win, text="Select File", width=30, command=openfile) +button1.grid(row=1, column=0, padx=5, pady=5) + +button2 = ttk.Button(win, text="Select Folder", width=30, command=openfolder) +button2.grid(row=2, column=0, padx=5, pady=5) + +win.mainloop()