Ser*_*nyy 3 printing cups lp lpr text-formatting
每当我使用lpr
orlp
命令打印文本文件时,单词在一行的末尾被切断并继续到另一行;例如,'understand' 将在第一行的末尾分成 'unde' 和在另一行的开头的 'rstand'。有没有办法以某种方式证明文件的文本以进行打印?我已经尝试过lpr -p
和-o media=a4
,以及适合页面的选项,但这些词仍然被切断。
对我有用的解决方案:
使用fold
. man
页面摘录:
Wrap input lines in each FILE (standard input by default), writing to
standard output.
-b, --bytes
count bytes rather than columns
-c, --characters
count characters rather than columns
-s, --spaces
break at spaces
-w, --width=WIDTH
use WIDTH columns instead of 80
Run Code Online (Sandbox Code Playgroud)
使用fold
(可能使用该-s
选项,以便它不会在字中断行)将文档设置为大约 80 个字符宽并打印:
fold -s myfile.txt | lpr
Run Code Online (Sandbox Code Playgroud)
或者,要保存格式化的版本:
fold -s myfile.txt > output.txt
Run Code Online (Sandbox Code Playgroud)