Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -160,10 +160,16 @@ def save_docx_as_pdf(doc_content, output_path='output.pdf'):
|
|
160 |
doc.save(temp_doc_path)
|
161 |
|
162 |
# Convert .docx to PDF
|
163 |
-
from docx2pdf import convert
|
164 |
-
convert(temp_doc_path, output_path)
|
165 |
-
os.remove(temp_doc_path)
|
166 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
def display_doc_as_image(pdf_path):
|
168 |
# poppler_path = 'usr/bin'
|
169 |
# images = convert_from_path(pdf_path, poppler_path=poppler_path)
|
|
|
160 |
doc.save(temp_doc_path)
|
161 |
|
162 |
# Convert .docx to PDF
|
163 |
+
# from docx2pdf import convert
|
164 |
+
# convert(temp_doc_path, output_path)
|
165 |
+
# os.remove(temp_doc_path)
|
166 |
+
|
167 |
+
subprocess.run(['libreoffice', '--headless', '--convert-to', 'pdf', temp_doc_path, '--outdir', os.path.dirname(output_path)])
|
168 |
+
|
169 |
+
# if uploaded_resume.type == "application/vnd.openxmlformats-officedocument.wordprocessingml.document":
|
170 |
+
# save_docx_as_pdf(resume_path, 'uploaded_resume.pdf')
|
171 |
+
# display_doc_as_image('uploaded_resume.pdf')
|
172 |
+
|
173 |
def display_doc_as_image(pdf_path):
|
174 |
# poppler_path = 'usr/bin'
|
175 |
# images = convert_from_path(pdf_path, poppler_path=poppler_path)
|