说明
业务需求,需要在手机端(web)显示ppt或者word文档,第一版考虑使用PDF显示,可在手机端使用js直接解析pdf性能糟糕,查看或者翻页不够流畅,立马考虑使用图片来代替PDF。
1.macOS中自动化批量将Word文档导出为PDF
2.macOS中自动化批量将PDF文档导出为图片
前置条件
电脑上必须安装 Microsoft PowerPoint软件
操作步骤
- 打开自动操作,新建『工作流程』
- 将『操作>文件和文件夹>获取指定的访达项目』拖到操作区域,或者直接选择一个PPT文件拖动到操作区域。
- 将『操作>实用工具>运行AppleScript』拖到操作区域,复制一下代码
on run {input, parameters}
set theOutput to {}
tell application "Microsoft PowerPoint" -- work on version 15.15 or newer
launch
repeat with i in input
set t to i as string
if t ends with ".ppt" or t ends with ".pptx" then
set pdfPath to my makeNewPath(i)
open i
save active presentation in pdfPath as save as PDF -- save in same folder
set end of theOutput to pdfPath as alias
end if
end repeat
end tell
tell application "Microsoft PowerPoint" -- work on version 15.15 or newer
quit
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 -5 of t) & "pdf"
else
return (text 1 thru -4 of t) & "pdf"
end if
end makeNewPath