[Python] Call the WPS V9 API to convert PPT to PDF and pythonwps.

Source: Internet
Author: User

[Python] Call the WPS V9 API to convert PPT to PDF and pythonwps.

WPS APIs, that is, COM, are mainly divided into V8 and V9 versions. examples that are easy to find on the Internet are V8. You can download the V9 API on the official website.

Python needs to install Python for Windows Extensions to call COM, that is, pywin32.

The call is simple. The Code is as follows:

 

Import sysimport osimport win32com. clientargc = len (sys. argv) print ("Number of arguments:", argc, 'arguments. ') print ('argument List:', str (sys. argv) if argc <2: sys. exit (-1) src = sys. argv [1] dst = sys. argv [2] wpp = win32com. client. dispatch ("Kwpp. application ") # o. visible = Falseppt = wpp. presentations. open (src) ppt. saveAs (dst, 32) ppt. close () wpp. quit () sys. exit (0)

Call time:

Xxx. py "src" "dst"

The first parameter is the source path.

The second parameter is the target path.

Address: http://www.cnblogs.com/gaoshang212/p/4896539.html

Related Article

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.