'How to make code of converting Docx to PDF in this code?
import aspose.slides as slides
import time
from tkinter import filedialog, Tk
import os
import aspose.words as aw
root = Tk()
files = filedialog.askopenfilenames(parent = root, title = "Choose files")
files = root.tk.splitlist(files)
start = time.time()
for f in files:
ext = os.path.splitext(f)
if ext == ".ppt":
pres = slides.Presentation(f)
pres.save(f+".pdf", slides.export.SaveFormat.PDF)
elif ext == ".docx":
doc = aw.Document(f) #problem part
doc.save(f+".pdf")
end = time.time()
print("Time Taken:%f secs" %(end-start))
This is the code of converting ppt and docx to PDF.
I am trying to make the system to check whether the extension of selected files from file dialog are pptx or docx and do correct process.
But when I tried to make code of docx part, converting docx to pdf didn't work.
I tried multiple times with different libraries.(docx2pdf, aspose)
Could someone help me out with this problem?
Thank you
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
