dimanche 30 novembre 2014

Formating file in command line for printing


Whenever I print a text file with lpr or lp commands , the words are cut off at the end of one line and continue onto the other, e.g. 'understand' would be split into 'unde' at the end of line one and 'rstand' at the beginning of other. Is there a way to justify the text of a file somehow for printing ? I've tried 'lpr -p' and '-o media=a4' , and fit-to-page option, but the words are still cut off. I've been looking around online and on stackexchange, but haven't found anything yet. Trivial question, of course, but still would be nice to know.


Solutions that worked for me:



  1. garethTheRed's fold: fold -s textfile.txt | lpr

  2. fmt command found here and here: fmt -u -w 80 textfile.txt | lpr ; note , that width 80 could be changed to whatever you like, but for me this seems to work well enough



Aucun commentaire:

Enregistrer un commentaire