说明
业务需求,需要在手机端(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 newerlaunchrepeat with i in inputset t to i as stringif t ends with ".ppt" or t ends with ".pptx" thenset pdfPath to my makeNewPath(i)open isave active presentation in pdfPath as save as PDF -- save in same folderset end of theOutput to pdfPath as aliasend ifend repeatend telltell application "Microsoft PowerPoint" -- work on version 15.15 or newerquitend tellreturn theOutputend runon makeNewPath(f)set t to f as stringif t ends with ".pptx" thenreturn (text 1 thru -5 of t) & "pdf"elsereturn (text 1 thru -4 of t) & "pdf"end ifend makeNewPath
