HOWTO: Printing Tips for the Command Line
Forum rules
Share your brain ;)
Share your brain ;)
HOWTO: Printing Tips for the Command Line
OK, so I was playing around with printing from the command line, since I was using Wordgrinder, which doesn't print. I eventually ditched it because I couldn't get used to the screen display, but I did learn how to print some pretty nice looking documents with some command-line tools. I'm back to Vim, and :ha, but if your favorite editor doesn't print (or you're stuck with one that doesn't print) here's what you can do to get by.
1. Edit your document, then save it. Then save it again. Make a backup, then another.
2. See above.
3. fold --spaces [your_doc] > [print.fold] - this gives you a hard-wrapped document with no broken words.
4. pr --form-feed --length=85 [print.fold] > [print_your_doc] - the reason for that long page-length will be obvious in a second. At this stage, if you want a custom header, you'd add it with the --header=[header] option. For double-spaced documents, you'd add a --double-space option.
5. lp -o cpi=12 -o lpi=8 -o page-left=72 [print_your_doc] - This gives you a nice, readable output with enough margins all around to look pretty decent.
If you want double-spaced docs, or anything other than a quick and dirty, rough-draft quality document, you'd have to explore the different options in pr, but the above steps will get you where you're going without having to screw around with word processors or learning some Latex voodoo-ery. My first few drafts are always plain text, so I'm not even thinking markup or formatting until almost the end of the road.
1. Edit your document, then save it. Then save it again. Make a backup, then another.
2. See above.
3. fold --spaces [your_doc] > [print.fold] - this gives you a hard-wrapped document with no broken words.
4. pr --form-feed --length=85 [print.fold] > [print_your_doc] - the reason for that long page-length will be obvious in a second. At this stage, if you want a custom header, you'd add it with the --header=[header] option. For double-spaced documents, you'd add a --double-space option.
5. lp -o cpi=12 -o lpi=8 -o page-left=72 [print_your_doc] - This gives you a nice, readable output with enough margins all around to look pretty decent.
If you want double-spaced docs, or anything other than a quick and dirty, rough-draft quality document, you'd have to explore the different options in pr, but the above steps will get you where you're going without having to screw around with word processors or learning some Latex voodoo-ery. My first few drafts are always plain text, so I'm not even thinking markup or formatting until almost the end of the road.
-
- Baconator
- Posts: 10253
- Joined: Thu Sep 16, 2010 11:03 am
- Location: Pfälzerwald
- Contact:
- wuxmedia
- Grasshopper
- Posts: 6454
- Joined: Wed Oct 17, 2012 11:32 am
- Location: Back in Blighty
- Contact:
Re: HOWTO: Printing Tips for the Command Line
That's great Lawnfull, Nice guide.
I heard that lp(r) was supposed to be able to print PDF's from the commandline too, I didn't have much luck though 8)
I heard that lp(r) was supposed to be able to print PDF's from the commandline too, I didn't have much luck though 8)
-
- Baconator
- Posts: 10253
- Joined: Thu Sep 16, 2010 11:03 am
- Location: Pfälzerwald
- Contact:
Re: HOWTO: Printing Tips for the Command Line
wux, does xpdf do it? If no, we should investigate (because both use lpr)
xpdf -cmd some_small.pdf
click the printer icon, choose the printer and OK. Minimize xpdf, and switch to the terminal. In the xpdf output find "lp" and see what command it uses there to print.
xpdf -cmd some_small.pdf
click the printer icon, choose the printer and OK. Minimize xpdf, and switch to the terminal. In the xpdf output find "lp" and see what command it uses there to print.
..gnutella..
Re: HOWTO: Printing Tips for the Command Line
I still use this script. :)
- wuxmedia
- Grasshopper
- Posts: 6454
- Joined: Wed Oct 17, 2012 11:32 am
- Location: Back in Blighty
- Contact:
Re: HOWTO: Printing Tips for the Command Line
^ will try both, I ended up install some huge gnomish pdf reader because it had the 'standard' printer dialog popup box.
-
- Baconator
- Posts: 10253
- Joined: Thu Sep 16, 2010 11:03 am
- Location: Pfälzerwald
- Contact:
Re: HOWTO: Printing Tips for the Command Line
^ ...which is probably coming from system-config-printer or so. For kicks, try apvlv, atril, mupdf, pdfviewer or the good-old epdfview (not in the repos anymore, but binaries are available)
..gnutella..