Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docx2pdf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from pathlib import Path
from tqdm.auto import tqdm

time_delay = 0.5
try:
# 3.8+
from importlib.metadata import version
Expand All @@ -23,6 +24,7 @@ def windows(paths, keep_active):
for docx_filepath in tqdm(sorted(Path(paths["input"]).glob("[!~]*.doc*"))):
pdf_filepath = Path(paths["output"]) / (str(docx_filepath.stem) + ".pdf")
doc = word.Documents.Open(str(docx_filepath))
time.sleep(time_delay)
doc.SaveAs(str(pdf_filepath), FileFormat=wdFormatPDF)
doc.Close(0)
else:
Expand Down