Link to home
Start Free TrialLog in
Avatar of sco505
sco505Flag for New Zealand

asked on

Get printer to cut after each job in sco unix

Using sco openserver 5.0.5 for a dry cleaning point of sale system.  When staff enter the items the printer will print tags for each one so they can be attached to the item.  The tag printer is a Samsung impact emulating Epson. Works great except it would be nice if it would  cut after each tag is printed.

The printer is set up as lp and model epson.  Is there a command I can insert into the lp script to tell the printer to cut after each tag is printed.  I have attached the lp file.  I hope this is the right one that is being used for the printer.
Also is there some way I can get the printer to print in bold.

Printer is attached to serial port 1 /dev/tty1a
LP
Avatar of arnold
arnold
Flag of United States of America image

See whether you set the length of output to match the length of tag, and then make sure you activate the cutter.

Here is an example reference, see if you send these controls whether the cutter activates at "end of page"

http://lprng.sourceforge.net/DISTRIB/RESOURCES/PPD/epson.htm
Avatar of sco505

ASKER

Thanks for that, but I have no idea where I would insert these in the lp file.

You're talking to a dummy as far as this is concerned.
Avatar of sco505

ASKER

I should have mentioned that the printer prints on 76mm x 76mm paper rolls
These are control characters that set the printer to indicate the length of the paper, enable cutter at end of page, before you send the data

I.e.
First thing your lp filter/script should send the control characters setting the page size, activating.
76mm, meaning it has 8-10 lines
Don't the tags have perforations for easy tearing.
In the example echo "\033\" etc are commands to the printer that are not output.

You have to identify the control that triggers the cut solenoid.

Look at the specs of your printer, while it can emulate, at times, it has its own......

I.e you would at the end of the tag send the EOF\EOR triggering the cutter.
Avatar of sco505

ASKER

Each tag could be different from others, eg 1 could have this printed

1 Trousers
Blue
Monday
-------------------------Invoice #------

the next
 
Dress Shirt
White
Press Only
Monday
-------------------------Invoice #------

It would be nice if they were cut after each one.  Saves using scissors
That is part of the filter that processes the data I.e. At the conclusion of the data it issues the correct echo "\cut\ you have to identify the control sequence to do that.

Alternatively, your script will have to first check how many lines, set the length, and then output the data.

I.e. Job has 10 lines, once ten lines are output with the printer set to cut at end of page, once the 10 lines are output, the cutter will be kicked in.
The next set for a five line printout, will do the same thing after the last line is output.

The lp setup, filters allow the sending process to set page lengths as well.....

...
What exact model of Samsung printer?  The answers above are correct, but it looks like you need a little more help.

In SCO or any Sys V system, the printer driver is nothing but a filter...

Raw data -> Filter (oven) -> Print data (cooked data)

The added codes the filter puts in allow for things like this, the exact code to activate the cutter is what is needed, along with the form length possibly.  The default Epson SCO driver "filter" has no cutter available; It's relatively easy to add the escape sequence to tell the printer to cut, then it's a matter of telling it when to cut...
It could be as simple as adding the cut command to the from feed depending on the data stream.
The decimal/ASCII FX example \033 is the octal representation of ESC or the decimal rep of 27

Activate cutter At end of page in the filter setting parameters.
echo "\033\0314\c" #cutter on end of page
echo "\0332\c" #set six lines per inch
echo "\033C02\c" #set page length 2 inches

File to be printed
1
.
.
.
13
And see whether between line 12 and 13 the paper is cut.

Man lpr I think it too has an option to set page settings.
Here is the ASCII table you can use to convert the FX code examples into the control commands.

http://www.asciitable.com

The directives \033 Uses octal data, for non render able characters/controls such as escape, control, etc.
Characters can be entered as A or as \101
Esc A
\033A\c or \033\101\c
Avatar of sco505

ASKER

I assume that the lp file I attached to my original query is the 1 that is used.  I copied it form /usr/spool/lp/admins/lp/interfaces.  
I tried inserting echo "\033\0314\c" in a couple of places without any luck. (bottom of file in red)

Am I putting them in the wrong place?  I have no idea
LP.doc
Yes, you are placing one line out of three that you need.

See whee you have z001 reset printer to default.
The three lines need to be right after that.
I believe each line is described as to what I think it sets and what its implications are.

After printer is reset to default, the next line sets/enables the cut mechanism at the end if the page. The next commands sets the line sizing of 6 lines per inch. The next command sets the size of the paper I the example it is 2 inches.
Once that is set, between the 12th and 13th output lines, if everything goes as planned, the printer cutter should activate.
If you have a windows system near by that has a comm port to which you can connect this printer.
Set it up as an ASCII Epsom emulated similar to what you think it is. Set page size and print a test and you should see the cutter activate.  Look at the printer properties/settings it should have an option dealing with the cut, it should show there the control sequence that it issues to trigger the cut. ^B or something like that, translating it into the \033X\c
Will help as you an add it at the end after the data stream instead of \f\c

Not sure whether \f\c is supposed to be a form feed to end of page so it can be torn at the perforation.

If true, once cutting is properly enabled, and page length set, the printer should position the paper in the correct .......... And cut
One more thing, you have not yet identified the Samsung printer that you have model.
Avatar of sco505

ASKER

It's a Samsung Biloxon SRP-275CG
Avatar of sco505

ASKER

Sorry I use a Mac.  
I've inserted the 3 lines as suggested just below the Z001 line.
Still no luck.  Printed a ptest file but it didn't cut at all
The system you are using is unimportant.

I am missing something, your question deals with sco Unix is this a VM/or a separate system?
Can you connect the printer to your Mac and print? It too should activate the cutter at the end of the page.

What is the model of the Samsung impact printer?

There are many impact printers being sold with emulating Epson.
Some include their own options but should follow the Epson ESP/P, the difficulty is that one has to identify which Epson commands it might vary/include some direct option that will activate the cutter.I.e.
Avatar of sco505

ASKER

It's a Samsung Biloxon SRP-275CG

It is a separate system.
Try adding the following sequence  echo "\033@\035V\c" after the Echo "\f\c"
Any way to get the actual data stream?  Maybe set up another printer with device /tmp/label.tst and print to that.

The filter itself is only going to add the command to the end of the job, unless each label is printed as a separate job adding a cut here won't do what you want.

The manual looks to have a command to set for cut on form feed - if the data stream has form feeds then maybe we can set it as a parameter up around the banner line option.  If not then SED or AWK could insert it in the stream.
agree with the form feed which I think \f\c does, but one is required to activate that mode of operation, set the page length, number of lines per ......

The sequence is missing a 1 after the V
Echo "\033@\035V1\c"

Try this Echo "\033@\035V1" | lpr -Pprintername

This should bypass the filer.
Form feed is Echo "\014\c"
Avatar of sco505

ASKER

Tried adding echo "\033@\035V\c"  after the first  echo "\f\c" .  Nothing

Added it after the last echo "\f\c" and nothing, but when I pressed the Paper Feed button it cut.
Getting there.  

If it could do a 3 line feed at the very end of the job regardless of how many labels were printed and then when the Paper Feed button was pressed it would cut I'm sure that would satisfy the user
Try \014\c
Should trigger a form feed based on the page length in the printer.
I am not sure what \f\c is supposed to do..
The \f\c is equivalent to  \014\c in SCO print filters.
Three line feed? if you do nothing and hit feed form on the printer how long I the paper before it is cut.  That will tell you what the page length is set to.
See if you can change the page length with the suggestions from before and see if the printer form feed matches that.
Avatar of sco505

ASKER

It would cut immediately.  After adding the 1 after the 035 it now cuts at the end.
Just 3 line feed now.  Tried adding \014\c line 3 times but nothing
Cuts at the end of what?

You need to use the z0001 which first resets the printer to default.

Then you can look at z002 and possibly add a check for allowing you to specify the page length of each label.

Your initial question suggests that you want to minimize paper waste I.e. A 6 line label should be cut after the sixth line, a 9 line label should be cut after the 9th, this precludes the
Comment out the prior page size setting, the lines per inch controls for the font size.
The \033@ resets the printer to defaults
If you add a echo "\035V1\c", does it cut?
Or did you mean Echo "\0351\c" triggers the cut?
Avatar of sco505

ASKER

It's working in as much as it cuts after each label except the last one.  So have to feed paper and rip off.
ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sco505

ASKER

We've changed the system.  Swapped printers around.  To be fair I should close this question and start another which I will do shortly.  Still having problems but slightly different.  Thanks again