Fixes: libreoffice export pdf issue

This commit is contained in:
sauravniraula 2025-05-13 02:31:46 +05:45
parent 098267940b
commit efea0bc081
No known key found for this signature in database
GPG key ID: 60FCC1B5A5E83326
2 changed files with 7 additions and 3 deletions

View file

@ -44,7 +44,7 @@ class ExportAsPptxHandler(FetchPresentationAssetsMixin):
ppt_path = os.path.join(
self.presentation_dir,
f"{presentation.title.replace('/', '_').replace(' ', '_')}.pptx",
f"{presentation.title.replace('/', '_').replace(' ', '_').replace('"', "'")}.pptx",
)
ppt_creator = PptxPresentationCreator(self.data.pptx_model, self.temp_dir)
ppt_creator.create_ppt()

View file

@ -10,12 +10,16 @@ def get_pdf_from_pptx(pptx_path: str, temp_dir: str) -> str:
base_name = os.path.splitext(os.path.basename(pptx_path))[0]
print(base_name)
subprocess.run(
f"{os.getenv('LIBREOFFICE')} --headless --invisible --convert-to pdf {pptx_path} --outdir {temp_dir}",
result = subprocess.run(
f'{os.getenv("LIBREOFFICE")} --convert-to pdf "{pptx_path}" --outdir "{temp_dir}"',
shell=True,
capture_output=True,
text=True,
)
print("LibreOffice stdout:", result.stdout)
print("LibreOffice stderr:", result.stderr)
pdf_filename = f"{base_name}.pdf"
pdf_path = os.path.join(temp_dir, pdf_filename)
print(pdf_path)