Which command(s) can be used to send a string to a printer? - Aix

This is a discussion on Which command(s) can be used to send a string to a printer? - Aix ; In looking at the various commands used for printing, all reference supplying a file to print from. Rather than using a file, I would like to send a string. Is this possible and which command(s) would I use?...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Which command(s) can be used to send a string to a printer?

  1. Which command(s) can be used to send a string to a printer?

    In looking at the various commands used for printing, all reference
    supplying a file to print from. Rather than using a file, I would
    like to send a string. Is this possible and which command(s) would I
    use?

  2. Re: Which command(s) can be used to send a string to a printer?

    On Dec 11, 7:27 am, rsine wrote:
    > In looking at the various commands used for printing, all reference
    > supplying a file to print from. Rather than using a file, I would
    > like to send a string. Is this possible and which command(s) would I
    > use?



    There are two reasons why lpr requires a named file.
    1) It doesn't print directly, print jobs are placed on a queue.
    2) It allows the file to be processed to print it properly. Many
    printers
    expect to get more than a raw ASCII string.

    If you really think you don't need that, you can write to the device
    with:
    echo "yourstring" >/dev/lp0

    Have a look at the splp command first, tho.
    --S

  3. Re: Which command(s) can be used to send a string to a printer?

    On Dec 11, 12:27 pm, rsine wrote:
    > In looking at the various commands used for printing, all reference
    > supplying a file to print from. Rather than using a file, I would
    > like to send a string. Is this possible and which command(s) would I
    > use?


    In general, the commands to submit a print job accept either a
    referenced file on disk OR standard input. I assume you are referring
    to printing using standard input. An example of this would be:

    echo TESTSTRING | lp

    This would submit 'TESTSTRING' to the system's default print queue.
    You can select an alternate print queue by specifying the -d switch.

    You may wish to investigate sending various control characters using
    echo - '\f' instructs a page-feed, for example.

    Please also note that lp waits for standard input to close before
    submitting the job to the queueing system.

    Hope this helps somehow....


    -Alex

+ Reply to Thread