Uncategorized

powerpoint – How can i convert ppt to pdf in python code?


import os
import comtypes.client

def ppt_to_pdf(intput_path, output_path):

    intput_path = os.path.abspath(intput_path)
    output_path = os.path.abspath(output_path)

    powerpoint = comtypes.client.CreateObject("Powerpoint.Application")

    powerpoint.Visible = 1

    slides = powerpoint.Presentations.Open(intput_path)

    slides.SaveAs(output_path, 32)

    slides.Close()

I use this code for converting ppt file to pdf file, but i want write code without importing comtypes.client because i want this code can execute in computer which don’t have powerpoint program.

Secondly, I want to convert file without watermark.

What can i do??

import os
import comtypes.client

def ppt_to_pdf(intput_path, output_path):

    intput_path = os.path.abspath(intput_path)
    output_path = os.path.abspath(output_path)

    powerpoint = comtypes.client.CreateObject("Powerpoint.Application")

    powerpoint.Visible = 1

    slides = powerpoint.Presentations.Open(intput_path)

    slides.SaveAs(output_path, 32)

    slides.Close()

This is my previous code.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *