-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPython_PDFConverter.py
More file actions
27 lines (21 loc) · 975 Bytes
/
Python_PDFConverter.py
File metadata and controls
27 lines (21 loc) · 975 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from PIL import Image
from docx2pdf import convert
file_type_input = input('Is the file type an .png/.jpg or .doc?\nEnter ".png" or ".jpg" or ".doc":\n')
if file_type_input == '.png':
image_1 = Image.open(input('Enter the source path:\n'))
im_1 = image_1.convert('RGB')
im_1.save(input('Enter the destination path:\n'))
elif file_type_input == '.jpg':
image_1 = Image.open(input('Enter the source path:\n'))
im_1 = image_1.convert('RGB')
im_1.save(input('Enter the destination path:\n'))
elif file_type_input == '.doc':
source_path = input('Enter the source path:\n')
convert(f'{source_path}')
#destination_path = input('Enter the new file name:\n')
#convert(f'{source_path}',f'{destination_path}')
#dest_full_path = input('Enter the destination path:\n')
#convert(f'{dest_full_path}')
else:
print('File type was not entered...Exiting the program.')
print('Script executed successfully. Please verify the results:\n')