mac实现ppt批量转pdf

引言

想把一门课的课件airdrop到ipda的notability里,但因为课件是ppt格式,所以要先转pdf。手动操作过于繁琐,所以查找并学习了如何实现批量操作,故记录。此文参考了知乎上的这篇回答

简介

有多种方法可以在mac上实现对ppt的转pdf操作,本文主要介绍AppleScript与Automator结合的方式。

步骤

Step 1: 在Automator中新建Quickaction

打开Automator,依次选择”File” > “New” > “Quick Action”
具体界面如下所示:

新建Quick Action界面

Step 2: 配置AppleScript

从左侧选中AppleScript并将其拉入到右侧的空白区域,之后对AppleScript做相关配置:(参考下图)

配置AppleScript

具体的AppleScript代码为:

1
on run {input, parameters}
	set theOutput to {}
	tell application "Microsoft PowerPoint" -- work on version 15.15 or newer
		launch
		set theDial to start up dialog
		set start up dialog to false
		repeat with i in input
			open i
			set pdfPath to my makeNewPath(i)
			save active presentation in pdfPath as save as PDF -- save in same folder
			close active presentation saving no
			set end of theOutput to pdfPath as alias
		end repeat
		set start up dialog to theDial
	end tell
	return theOutput
end run

on makeNewPath(f)
	set t to f as string
	if t ends with ".pptx" then
		return (text 1 thru -6 of t) & ".pdf"
	else
		return (text 1 thru -5 of t) & ".pdf"
	end if
end makeNewPath

Step 3: 应用

在Finder中选中一个或多个ppt,右击”services”,可以找到新命名的服务”ppt2pdf”。点击即可实现自动化的ppt转odf功能。

应用ppt2pdf