Linux Commands Examples

A great documentation place for Linux commands

print

execute programs via entries in the mailcap file


see also : view - see - edit - compose - update-mime

Synopsis

run-mailcap --action=ACTION [--option[=value]] [MIME-TYPE:[ENCODING:]]FILE [...]

The see, edit, compose and print versions are just aliases that default to the view, edit, compose, and print actions (respectively).


add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!

examples

0
source

How to print a large page on multiple smaller pages?

Poster Printer works with your existing printer to allow you to print documents at a much larger size than would fit on a single printed page.

alt text

(open source, Windows)

0
source

Printing transcript with ANSI escape sequence

Scratching my own itch, I hacked a solution converting transcripts to HTML in Python. Here it is.

0
source

How to resume CUPS printer from command line?

The -E option of lpadmin should do that. You can probably just create a cron job with the lpadmin command.

lpadmin [ -E ] [-U username ] [ -h server[:port] ] -p printer option(s)

Hourly cron entry:

0 * * * * /usr/sbin/lpadmin -E -p your_printer

You can add that by running:

sudo crontab -e
0
source

Most convenient way to get a "2up" (2 pages per physical page / sheet) option for LPR?

The lpr that comes with CUPS recognizes the number-up option. Just combine it with CUPS-PDF.

0
source

How to set default "Page Setup ?Page Size" as A4 in Firefox?

  1. In the address bar, type "about:config".
  2. Enter "print.postscript.paper_size" in the filter box and press Enter.
  3. Double-click the entry named "print.postscript.paper_size".
  4. Enter "paper" in the dialog box and press OK.
0
source

Windows can see Ubuntu Server printer, but can't print to it

Did you upgrade to 9.10 (Karmic)?

On the thread here, people mention that once they upgraded from Jaunty to Karmic they had to repeat the printer server instructions before XP could connect the printer again.

Maybe that will help you?

0
source

How can I automatically convert all source code files in a folder (recursively) to a single PDF with syntax highlighting?

(from StackOverflow)

for i in *.src; do echo "$i"; echo "---"; cat "$i"; echo ; done > result.txt

This will result a result.txt containing:

  • Filename
  • separator (---)
  • Content of .src file
  • Repeat from the top until all *.src files are done

If your source code have different extension, just change as needed. You can also edit the echo bit to add necessary information (maybe echo "filename $1" or change the separator, or add an end-of-file separator).

the link have other methods, so use whatever method you like best. I find this one to be most flexible, although it does come with a slight learning curve.

The code will run perfectly from a bash terminal (just tested on a VirtualBox Ubuntu)

If you don't care about filename and just care about content of files merged together:

cat *.src > result.txt

will work perfectly fine.

Another method suggested was:

grep "" *.src > result.txt

Which will prefix every single line with the filename, which can be good for some people, personally I find it too much information, hence why my first suggestion is the for loop above.

Credit to those in the StackOverflow forum people.

EDIT: I just realized that you are after specifically HTML or PDF as the end result, some solutions I've seen is to print the text file into PostScript and then convert postscript to PDF. Some code I've seen:

groff -Tps result.txt > res.ps

then

ps2pdf res.ps res.pdf 

(Requires you to have ghostscript)

Hope this helps.

0
source

Printing without a spooler

I would suggest you start by asking your system administrator (or a more experienced user of the system in question) how to print. If it turns out that printing really isn't set up yet, ask them very nicely if they could please look into it.

(I'm assuming, of course, that your question means "Is there a way for a user without root access to set up printing?")

If printing isn't set up and your sysadmin can't find the time to set it up, then presumably the printer you want to print to is on the network -- it would be pointless to connect a printer directly to a server and then not configure the server to print to it -- and so you could presumably install everything necessary to print to it under your home directory, but it would probably be quite a lot of work to build it all, and it would probably be a bit fragile. (Hence, it should be your last resort.)

A better plan might be to set up a VM in which to discover precisely what must be done to make your printer work from a system running the distro and version that the server is running, and ask your administrator if they could please just do those few things?

0
source

How print multiple independent pages in one print job?

The way I do it:

  • Print all web pages to separate PDFs (single page per sheet!)
  • Use pdftk to join the PDFs: pdftk print1.pdf print2.pdf cat output out.pdf
  • Use a PDF viewer to print out.pdf with 4 pages per sheet

It's a little bit cumbersome, but it works.

0
source

Printing from Firefox on Linux with bad and random letter spacing

I've had this issue in the past when software was scaling the page to fit, causing some of the letters to bunch together. It was scaling down only 1 or 2 percent, so it was hard to notice on the printed copy.

Is it just the print preview, or does the actual printed page have the incorrect letter spacing? It's possible the zoom setting on the print preview causes the weird letter spacing and a printed copy would look correct.

What if you printed as a PDF file - do you get the same results?

description

run-mailcap (or any of its aliases) will use the given action to process each mime-type/file in turn. Each file is specified as its mime-type, its encoding (e.g. compression), and filename together, separated by colons. If the mime-type is omitted, an attempt to determine the type is made by trying to match the file’s extension with those in the mime.types files. If the encoding is omitted, it will also be determined from the file’s extensions. Currently supported encodings are gzip (.gz), bzip (.bz), bzip2 (.bz2), and compress (.Z). A filename of "-" can be used to mean "standard input", but then a mime-type must be specified.

Both the user’s files (~/.mailcap; ~/.mime.types) and the system files (/etc/mailcap; /etc/mime.types) are searched in turn for information.

EXAMPLES
see picture.jpg
print output.ps.gz
compose text/html:index.htm
extract-mail-attachment msg.txt | see image/tiff:gzip:-

OPTIONS
All options are in the form --<opt>=<value>.
--action=<action>

Performs the specified action on the files. Valid actions are view, cat (uses only "copiousoutput" rules and sends output to STDOUT) , compose, composetyped, edit and print. If no action is specified, the action will be determined by how the program was called.

--debug

Turns on extra information to find out what is happening.

--nopager

Ignores any "copiousoutput" directive and sends output to STDOUT.

--norun

Displays the found command without actually executing it.

copyright

run-mailcap (and its aliases) is in the public domain (the only true "free").


see also

update-mime


author

run-mailcap (and its aliases) was written by Brian White <bcwhite[:at:]pobox[:dot:]com>.

How can this site be more helpful to YOU ?


give  feedback