Django-Python easy way to convert PPTX to PDF?

34 Views Asked by At

I have tried several libraries for convert a PPTX file to PDF and all of them gives me error. For example I am trying to use an API of SDK python of GroupDocs, this is my method:

 def generate_and_save_pptx(self):
        pptx_template_path = ‘panel/templates/originals/Prueba.pptx
        pdf_filename = f’{self.client.name} - {self.type_submission.name}_tutorial.pdf’
        pdf_path = submission_directory_path(self,pdf_filename)
        api_instance = groupdocs_conversion_cloud.ConvertApi.from_keys(app_sid, app_key)
        convert_request = groupdocs_conversion_cloud.ConvertDocumentDirectRequest(
            "pdf",
            pptx_template_path,  # Reemplaza con la ruta correcta a tu archivo
            None,
            None,
            None
        )

        try:
    
        response = api_instance.convert_document_direct(convert_request)
            
        with open(pdf_path, "wb") as pdf_file:
            pdf_file.write(response)

Debugging it looks like I cant even enter into response. On the other hand it says folder doesnt exist but it exists, I save other files there without problem.

Any other libraries I have tried always have similar problemas, not enter into the response, save data corrupted, etc.

I just would like to find and easy and free way to convert pptx files to pdf

0

There are 0 best solutions below