CUPS 从命令行打印远程 (http://) 文件
CUPS printing remote(http://) files from command line
我正在尝试创建自定义脚本来控制我的 CANON SELPHY PRINTER
表单命令行。
lp -d Canon_CP900 -o media="CP_C_size" /Users/sangyookim/Desktop/selphy.jpg
我已经测试了上面的代码,它工作得很好,正如我预期的那样。
但是我偶然发现了一个问题。
当我将 /Users/sangyookim/Desktop/selphy.jpg
或 filname
替换为网络 link 时,如下所示,它将 return 我 unable to access.. No such file or directory
http://res.cloudinary.com/splexz/image/upload/v1447239237/yer60xuvd6nmeldcbivd.png
如何使用 CUPS command line
从网络打印图像?
您不能直接打印远程网页(因为大多数 Linux 命令,包括 lp
,不了解 URL)。
至少,您需要先使用 wget or curl 等命令行 HTTP 客户端获取该网页,然后使用另一个命令(使用 lp
或 lpr
)来打印它(也许稍后从您的本地文件系统中删除下载的文件)。
对于图像,您可能需要一些转换器才能打印它们,例如来自 ImageMagick (which happens to understand URLs, thanks to Mark Setchell for commenting on this), to convert them to some .pdf
or perhaps .ps
file (unless you have configured lp
or CUPS to do the conversion automagically). Maybe you could use a2ps
的 convert
命令
您可以编写一些脚本(或 shell 函数)来完成所有工作。
在有限的情况下,您还可以考虑使用一些网络文件系统NFS, CIFS or set up some FUSE(我不建议这样做)。
我正在尝试创建自定义脚本来控制我的 CANON SELPHY PRINTER
表单命令行。
lp -d Canon_CP900 -o media="CP_C_size" /Users/sangyookim/Desktop/selphy.jpg
我已经测试了上面的代码,它工作得很好,正如我预期的那样。
但是我偶然发现了一个问题。
当我将 /Users/sangyookim/Desktop/selphy.jpg
或 filname
替换为网络 link 时,如下所示,它将 return 我 unable to access.. No such file or directory
http://res.cloudinary.com/splexz/image/upload/v1447239237/yer60xuvd6nmeldcbivd.png
如何使用 CUPS command line
从网络打印图像?
您不能直接打印远程网页(因为大多数 Linux 命令,包括 lp
,不了解 URL)。
至少,您需要先使用 wget or curl 等命令行 HTTP 客户端获取该网页,然后使用另一个命令(使用 lp
或 lpr
)来打印它(也许稍后从您的本地文件系统中删除下载的文件)。
对于图像,您可能需要一些转换器才能打印它们,例如来自 ImageMagick (which happens to understand URLs, thanks to Mark Setchell for commenting on this), to convert them to some .pdf
or perhaps .ps
file (unless you have configured lp
or CUPS to do the conversion automagically). Maybe you could use a2ps
convert
命令
您可以编写一些脚本(或 shell 函数)来完成所有工作。
在有限的情况下,您还可以考虑使用一些网络文件系统NFS, CIFS or set up some FUSE(我不建议这样做)。