1、打开软件“自动操作”(mac自带软件)
2、新建——>服务,选取。
3、更改框起来的部分。1. “服务”收到选定的【文件或文件夹】位于【访达】2. 在左侧搜索框搜索对应操作拖到右侧,先【获得指定的访达项目】,然后【运行shell脚本】3. 更改shell脚本的传递输入【作为自变量】4. 添加对应的脚本代码如下:for f in "$@"do# Get the full file PATH without the extension filepathWithoutExtension="${f%.*}" # Convert the DOCX to HTML, which cupsfilter knows how to turn into a PDF textutil -convert html -output "$filepathWithoutExtension.html" "$f" # Convert the file into a PDF cupsfilter "$filepathWithoutExtension.html" > "$filepathWithoutExtension.pdf" # Remove the temporary HTML file, leaving only the PDF rm "$filepathWithoutExtension.html" >/dev/null # Remove the original file # rm "$f" > /dev/nulldone有一点基础的同学应该都看的懂,脚本是将作为输入的文件先转换为可以打印PDF的html格式,再转换为pdf,最后删除掉html格式的文件。因此只要是可以正确转换html格式并且编码格式正确的文件,都可以通过它转为pdf,十分方便啦~如果转为pdf后默认不想要原word文件,则删除倒数第二行的注释,即删掉“#”号,只保留rm "$f" > /dev/null。
4、command+s快捷键保存,命名为Convert to PDF。完成!现在可以打开你的访达,右键各种文本文件在服务中找到转换操作试一下啦~