awesome-notebooks icon indicating copy to clipboard operation
awesome-notebooks copied to clipboard

Python - Convert file from .pptx to .pdf

Open jravenel opened this issue 2 years ago • 13 comments

Let's find a way to do it so we can render pptx via pdf inside Jupyter env.

jravenel avatar Oct 03 '22 12:10 jravenel

Hey @jravenel i would like to work on this, can u please assign it to my name

rexdivakar avatar Oct 03 '22 12:10 rexdivakar

Hey @rexdivakar thanks for the suggestion. Let me connect you to @FlorentLvr that will be the reviewer.

I just added you to the contributor team on the GitHub org. Let's ensure the pptx is accessible over the internet so anyone can reproduce. I found this one for example : https://www.just.edu.jo/~zasharif/Web/SE495/Python/Slides/python1.ppt

So the template would look like:

Input: FILE = "https://www.just.edu.jo/~zasharif/Web/SE495/Python/Slides/python1.ppt"

Model: function to transform the file into pdf

Output: fallback message "✅ {FILE} has been successfully converted to PDF"

is that clear for you? Let me know.

jravenel avatar Oct 03 '22 15:10 jravenel

Hey @jravenel after quite digging i figured it out that this cannot be fully automated without having PowerPoint installed, cox there seems to be no direct way for converting this ppt file to a pdf without external translation enabled. Kindly advice.

rexdivakar avatar Oct 04 '22 01:10 rexdivakar

@rexdivakar Thanks for your message, did you try this lib?

https://pypi.org/project/ppt2pdf/

  • https://gist.github.com/vikram-ai/5c811d076f7c4d17d3b497fc5fff8224

? Let me know 🙏

jravenel avatar Oct 04 '22 06:10 jravenel

Yup they all have dependency over PowerPoint software and cannot be used across platforms without office softwares installed.

rexdivakar avatar Oct 04 '22 06:10 rexdivakar

I guess this on is the same ? https://community.esri.com/t5/python-questions/how-can-i-use-python-to-convert-ppt-to-pdf/td-p/310114

It looks like it works for them by reading the thread

jravenel avatar Oct 04 '22 06:10 jravenel

Hey @jravenel i would like to work on this ,is it not assigned to anyone, can u please assign it to my name

Venkatakrishnan-Ramesh avatar Oct 06 '22 13:10 Venkatakrishnan-Ramesh

I guess this on is the same ? https://community.esri.com/t5/python-questions/how-can-i-use-python-to-convert-ppt-to-pdf/td-p/310114

It looks like it works for them by reading the thread

Testing the same will rasie a PR asap, kindly assign it to my name

rexdivakar avatar Oct 06 '22 14:10 rexdivakar

image

All the snippets you shared require some form of office installation over the device, as i mentioned earlier we cannot directly convert it as its a binary module. Do you have any other suggestions ?

rexdivakar avatar Oct 08 '22 02:10 rexdivakar

Hey @jravenel i would like to work on this ,is it not assigned to anyone, can u please assign it to my name

@Venkatakrishnan-Ramesh It's already assigned as you may see the discussion on this thread 😉

jravenel avatar Oct 08 '22 05:10 jravenel

image

All the snippets you shared require some form of office installation over the device, as i mentioned earlier we cannot directly convert it as its a binary module. Do you have any other suggestions ?

  • [x] @rexdivakar we have not been able to sync with @Dr0p42 about this but we will discuss it during the weekly product roadmap next Monday ! Thanks for the research on this 🙏 you can join the meeting next Monday it's public

jravenel avatar Oct 08 '22 05:10 jravenel

sure definitely !

rexdivakar avatar Oct 08 '22 07:10 rexdivakar

@rexdivakar moved it to in progress for discussion, I'm wondering if it would not be better to just use the Google Slide API to build slides and export them as a PPT or whatever format programatically, google slides API seems better option, what do you think guys @FlorentLvr @Dr0p42 ?

jravenel avatar Oct 12 '22 20:10 jravenel

Hi @jravenel I have a solution for it. May you please assign it to me? and I will also need your help to install LibreOffice on your servers. A solution can be found in this link in google collab if anyone would like to try it themselves.

Short answer, yes it needs windows to use Microsoft API, but LibreOffice command line has an api to convert pptx files to pdf as well. " !soffice --headless --convert-to pdf $file_path ".

The only thing that is needed is installation of LibreOffice which can be done but I doubt that Naas requires a password to install it "I tried".

Thank you in advance,

AhmedMousa-ag avatar Nov 08 '22 14:11 AhmedMousa-ag

Hey @AhmedMousa-ag, we need to dig into it. Can you share more about the LibreOffice install procedure so we can see if it's possible to do it and what we can do apart from this feature?

jravenel avatar Nov 08 '22 16:11 jravenel

@Dr0p42 do you think we can set this up in naas? https://colab.research.google.com/drive/1LzpwMj2sktmQYnpo-Tht0k2p84NXAuAb?usp=sharing

jravenel avatar Nov 08 '22 21:11 jravenel