How to convert a .pptx to .pdf using Python

前端 未结 5 586
我寻月下人不归
我寻月下人不归 2021-02-05 22:53

I have been looking to convert a .pptx file to a .pdf file through a Python script for several hours but nothing seems to be working.

What I have tried:

5条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-05 23:07

    unoconv is a great tool to perform this task and it is indeed build in python. Regarding your problem, it might be related to a recurring problem with the way the python interpreter is set in the main unoconv file after it has been installed.

    To run it with python3 interpreter, replace #!/usr/bin/env python with #!/usr/bin/env python3 or #!/usr/bin/python3 in unoconv file (/usr/bin/unoconv).

    one liner:

    sudo sed -i -e '1s:#!/usr/bin/env python$:#!/usr/bin/env python3:' /usr/bin/unoconv
    

    You could also symlink /usr/bin/unoconv to /usr/local/bin/unoconv.

提交回复
热议问题