How to add form feed for printing in linux

Hi All,

in Unix platform, if we want to add the form feed for the printer, we will edit the printer file in

/etc/lp/interface/model.orig/ folder with the "echo "\f\c" ". 

May i know that in Linux, how we can add this form feed?
Because in Linux, i can't found the same folder.

Thank You.

Hi @alicetan

You are using CUPS on RED-HAT?

See, for example:

If you are using CUPS, then this narrows the question to something more managable.

If not CUPS, what are you using to manage your printer?

See also, FYI only:

http://etutorials.org/Linux+systems/red+hat+linux+9+professional+secrets/Part+I+Setting+Up+Red+Hat+Linux/Chapter+4+Printer+Setup/Understanding+the+CUPS+Printing+System/

Hi Neo,

Yes, we are using CUPS, but it seem that CUPS do not have the setting for form feed(page eject).
Do you have idea how to set the form feed?

Because we are new in Linux platform so we are not familiar with CUPS also.

Thank You.

So, do you normally print using the lp command, for example:

lp -d printer -o PageSize=A4 /path/filename

What are you trying to do exactly? Advance based on page size when printing? What is the problem you want to solve?

Reference:

https://www.cups.org/doc/options.html

The
echo "\f\c"
works with the SysV echo (where /bin/sh is linked to ksh or is a Bourne shell).

For BSD and Linux you need the portable form
printf "\f\c\n"
(that works with all shells).

It is somehow possible to place an executable shell script into the CUPS filters. But it's quite some time ago that I worked with custom filters...

1 Like

Hi Neo,

we are not using the lp command to print the document, we are using the -Q printername and send the job to the printer device in server and print it out.

The problem we facing now is when we print the document, it do not have the page eject and causing alignment issue when print 2 document at a time.

We are new to Linux, previously we are using HP-UX.
In HP-UX environment, there is a file in "/etc/lp/interface/model.orig/" we can edit it to add in the "echo "\f\c", then when we choose to print to the printer, it will have the page eject.

But now in Linux, we can't find the way to add in this "echo "\f\c" to solve the page eject issue.

So hope that anyone in the group here can share some experience with us.

Thank You.

1 Like

Hi Madeln,

Can you share with us your experience how to using the "echo "\f\c" in Linux?

Thank You.

1 Like

You can test it on the command line.
In Linux in a /bin/sh shell
echo "\f\c"
will print
\f\c
While
printf "\f"
will do some "formfeed" action, e.g. clear the screen.
On Unix in a /bin/sh shell you will find that both commands behave the same.

Sorry, the \c\n (as in my last post) should not be in the printf.

2 Likes

Hey @alicetan

If you take a peek at the CUPS documentation, you can see that to submit commands to your default printer, typically you use:

# lpr filename

So, if you want to send any command to the printer, you can put the command in a file and then run the lpr command.

I have not tested this, but you can try to simply put the command you want to execute in a file and send that to the printer via lpr, for example to only print a form feed, or page feed, just put that sequence to send to the printer in a file and try sending it to the printer with lpr as above.

When you get this first step working; then you can see if you can add a CUPS filter or command to the pre-print process and you should be good to go.

I don't have a printer, so I cannot try this for you; but if you try some things and post back your results, we can help you get this working.

References:

I think using lpr to test the printer will go a long way to getting a CUPS system tested and debugged.