Python implements screenshot operations on the pptfile,

Source: Internet
Author: User

Python implements operations on pptfiles,

This example describes how to operate a pptfile in Python. Share it with you for your reference. The specific analysis is as follows:

The following code can be used for powerpoint files. You can specify the slide pages to be captured. You need to install powerpoint on the local machine and specify the size and resolution.

Import osimport comtypes. clientdef export_presentation (path_to_ppt, path_to_folder): if not (OS. path. isfile (path_to_ppt) and OS. path. isdir (path_to_folder): raise "Please give valid paths! "Powerpoint = comtypes. client. createObject ("Powerpoint. application ") # Needed for script to work, though I don't see any reason why... powerpoint. visible = True powerpoint. open (path_to_ppt) # Or some other image types powerpoint. activePresentation. export (path_to_folder, "JPG") # You can write it here: # Presentation. slides [1]. export ("C:/path/to/jpg.jpg", "JPG", 800,600); powerpoint. presentations [1]. close () powerpoint. quit ()

I hope this article will help you with Python programming.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.