西麦农场

时间尺度守恒


  • 首页

  • 分类

  • 归档

  • 坑List

macOS中自动化批量将PPT文档导出为PDF

2019-02-14 | DevFAQ | macOS 自动化 PPT PDF

说明

业务需求,需要在手机端(web)显示ppt或者word文档,第一版考虑使用PDF显示,可在手机端使用js直接解析pdf性能糟糕,查看或者翻页不够流畅,立马考虑使用图片来代替PDF。
1.macOS中自动化批量将Word文档导出为PDF
2.macOS中自动化批量将PDF文档导出为图片

前置条件

电脑上必须安装 Microsoft PowerPoint软件

操作步骤

  • 打开自动操作,新建『工作流程』
  • 将『操作>文件和文件夹>获取指定的访达项目』拖到操作区域,或者直接选择一个PPT文件拖动到操作区域。
  • 将『操作>实用工具>运行AppleScript』拖到操作区域,复制一下代码
  1. on run {input, parameters}
  2. set theOutput to {}
  3. tell application "Microsoft PowerPoint" -- work on version 15.15 or newer
  4. launch
  5. repeat with i in input
  6. set t to i as string
  7. if t ends with ".ppt" or t ends with ".pptx" then
  8. set pdfPath to my makeNewPath(i)
  9. open i
  10. save active presentation in pdfPath as save as PDF -- save in same folder
  11. set end of theOutput to pdfPath as alias
  12. end if
  13. end repeat
  14. end tell
  15. tell application "Microsoft PowerPoint" -- work on version 15.15 or newer
  16. quit
  17. end tell
  18. return theOutput
  19. end run
  20. on makeNewPath(f)
  21. set t to f as string
  22. if t ends with ".pptx" then
  23. return (text 1 thru -5 of t) & "pdf"
  24. else
  25. return (text 1 thru -4 of t) & "pdf"
  26. end if
  27. end makeNewPath
  • 将『操作>文件和文件夹>移动访达项目』拖到操作区域,选择要输出的目录。
  • 在『获取指定的访达项目』中选择想要导出为PDF文件的PPT文件。点击运行即可。
    macOS中自动化批量将PPT文档导出为PDF

    使用中的问题

    暂无问题。
  • 目录
  • 站点概览
  • 说明
  • 前置条件
  • 操作步骤
  • 使用中的问题
    戊在西安填坑中

    戊在西安填坑中

    29 日志
    7 分类
    50 标签
    0%
    © 2017- 戊在西安填坑中 | 陕ICP备13008306号-3 | 主题 NexT.Pisces