mirror of
https://github.com/metafy-social/python-scripts.git
synced 2025-03-31 18:06:49 +00:00
commit
d507fb775b
16
scripts/word_to_pdf_converter/README.md
Normal file
16
scripts/word_to_pdf_converter/README.md
Normal file
@ -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
|
||||||
|

|
BIN
scripts/word_to_pdf_converter/Test.docx
Normal file
BIN
scripts/word_to_pdf_converter/Test.docx
Normal file
Binary file not shown.
BIN
scripts/word_to_pdf_converter/Test.pdf
Normal file
BIN
scripts/word_to_pdf_converter/Test.pdf
Normal file
Binary file not shown.
BIN
scripts/word_to_pdf_converter/example_screenshot.jpg
Normal file
BIN
scripts/word_to_pdf_converter/example_screenshot.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
1
scripts/word_to_pdf_converter/requirements.txt
Normal file
1
scripts/word_to_pdf_converter/requirements.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
docx2pdf==0.1.8
|
32
scripts/word_to_pdf_converter/script.py
Normal file
32
scripts/word_to_pdf_converter/script.py
Normal file
@ -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()
|
Loading…
x
Reference in New Issue
Block a user