命令行等效于从 Mac OS X finder 打印 .docx 文件 [英] Command line equiv to print a .docx file from Mac OS X finder

查看:22
本文介绍了命令行等效于从 Mac OS X finder 打印 .docx 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序需要从命令行打印 MS Word .docx 文件.背景是这是在以 CUPS-PDF 作为默认打印机的 Snow Leopard 服务器上.如果在查找器中单击一次 .docx 文件进行选择,然后从文件菜单中选择打印,它会打开 MS Word(已安装 2011)并将文件以 PDF 格式打印到线轴(通过 CUPS).完美的!现在什么是 BASH 命令等价物???

I have an application need to print a MS Word .docx file from the command line. The background is this is on Snow Leopard Server with CUPS-PDF as the default printer. If in the finder I click once on the .docx file to select and then select print from the file menu it opens MS Word (2011 is installed) and prints the file to the spool (via CUPS) in PDF format. Perfect! Now what is the BASH command equivalent of that???

我尝试过 lpr,它似乎只适用于纯文本文件.我试过 OPEN,它可以打开 MS Word,但我看不到打开的打印"选项.我已经尝试过通常的 MS Office 等价物(OpenOffice 和 LibreOffice),它们都可以工作,但生成的 PDF 布局与 Word 生成的布局相差甚远,令人无法接受.我尝试使用 osascript = AppleScript = 它有效但不稳定 - 它并不总是触发.

I have tried lpr, which only appears to work with straight text files. I have tried OPEN which OPENS MS Word but I see no "print" option for open. I have tried the usual MS Office equivalent (OpenOffice and LibreOffice) which both work but the generated PDF layout is so far from that generated by Word that it is shamefully unacceptable. I tried using osascript = AppleScript = which works but is spotty - it does not always trigger.

我的挑战是我正在使用 PHP 程序从模板创建 .docx 文件,只需要将其转换为 PDF 并保留所有格式.

My challenge is I am creating the .docx outside of word from a template with a PHP program and just need to convert it to PDF retaining all formatting.

推荐答案

查看 launch,可在此处获得:http://sabi.net/nriley/software/,也可以使用自制软件或 macports 轻松安装.

Take a look at launch, available here: http://sabi.net/nriley/software/, also easy to install using homebrew or macports.

类似于open,但增加了一些额外的功能,包括

It is like open, but adds some extra features, including

-p       Ask application(s) to print document(s).

这篇关于命令行等效于从 Mac OS X finder 打印 .docx 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆