Increase the letters per line in DOS Output

1

0

I am printing no of lines in DOS(CMD Prompt In Windows 7) using Batch file into DOT MATRIX Printer. Its A5 Paper. The problem is I cant able to add more than 53 characters per line for A5 print. How to increase the characters per line for this A5 size.

Suresh

Posted 2013-10-21T08:59:02.700

Reputation: 13

1Is it actually MS-DOS? Or the Windows CMD prompt? – Alan B – 2013-10-21T09:24:38.897

its CMD Prompt in Windows 7 – Suresh – 2013-10-21T09:27:08.553

What's the make and model of the printer? – Rik – 2013-10-21T10:24:20.967

TVS MSP 250 Star Dot Matrix Printer – Suresh – 2013-10-21T10:26:29.713

Answers

1

This printer (TVS MSP 250 Star) supports ESC/P (this is an Epson standard) and IBM Proprinter emulation. This means you can send a small file before your actual file which switches the printer to condensed mode.

For the ESC/P emulation you can do the following:

Make a small.txt file:

<#27><#15>

This is not a literal file. The file should be just 2 character (#27 and #15). You'll need an editor who can create an "Escape" (#27) and "Condensed" (#15) character (e.g. Hex-editor). If you don't have one see below how to make the file.

Next you can print your file like this:

copy small.txt+ACTUAL_FILE.TXT LPT1
exit

If you don't have a Hex-editor you can do the following:

Make a textfile with the following (call it small.vbs):

Wscript.Stdout.Write Chr(27)+Chr(15)

Then execute the following on a command prompt:

cscript /nologo small.vbs > small.txt

This will result in a small.txt file which you can use with the copy command.

Edit: It is recommended to try #15 only first. If that does not work try #27#15.

To write #15 in C# you could use (char)15 or \x0F.

From the ESC/P manual: enter image description here and

enter image description here

Edit:

To summarize (excluding the borders/margins, so it could be less with margins):

  • 10cpi ≈ 58 characters = Esc P (#27P)
  • 12cpi ≈ 70 characters = Esc M (#27M)
  • 15cpi ≈ 87 characters = Esc g (#27g)
  • 10cpi condensed ≈ 100 characters = Esc P SI (#27P#15)
  • 12cpi condensed ≈ 116 characters = Esc M SI (#27M#15)
  • 15cpi condensed ≈ (not available)

So the smallest would be #27M#15. (116 characters)

If you don't need the file to be opened in a normal editor you can include these codes in your file. You can then also add goodies like bold, italic etc. To set a word in bold you could do the following:

This is a #27Ebold#27F word.

#27E sets bold and #27F cancels it again. You could also switch back to 10cpi and combine it with bold.

#27M#15This is a #18#27P#27Ebold#27F#27M#15 word.

#27M#15 to set it to 12cpi condensed. #18 to cancel condensed. #27P to set 10cpi and after the word #27M#15 to set it to 12cpi condensed again.

You could also use the "Double font width/height":

#27M#15This is a #27W#1#27w#1big#27W#0#27w#0 word.

#27W#1 Double font width and #27w#1 Double font height and #0 to cancel them again.

You see that you can combine all of these codes to do anything. There is also a "Master Select" (page 125 of the manual). If you switch a lot between fonts you can use that to switch cpi, bold, condensed, italic etc in one command. (#27!+n where n is the type)

Rik

Posted 2013-10-21T08:59:02.700

Reputation: 11 800

i am writing into text file using c#. Is it possible to write in sample.vbs file using c#. And its not mentioned how many characters per line i can able to print – Suresh – 2013-10-21T10:54:35.937

If you're writing the text-file yourself you could also just add #27#15 before the file itself (no need for the small.txt). BTW it is recommended to just try #15 only first. If the #15 before the file does not work try #27#15. You can use (char)15 or \x0F in C#. – Rik – 2013-10-21T10:57:31.220

How many characters it will print per line? – Suresh – 2013-10-21T11:03:54.333

I added a screenshot from the manual. when 12Cpi is selected condensed will be 20cpi. To select 12cpi you can also do #27M (or char(27) + M) – Rik – 2013-10-21T11:06:08.743

Added a link to the ESC/P manual from Epson. You can find more handy codes like draft, proportional printing etc.

– Rik – 2013-10-21T11:10:13.643

14,85cm / 2,54 (cm/inch) = 5,84 * 20 character = 116 characters max per line. If this is too small you could also select 15cpi (Esc g). This would be 87 characters per line. (or 70 if you choose 12cpi Esc M) – Rik – 2013-10-21T11:15:12.840

thanks for your big support. Its really very useful i will check it with printer after that i will mark it answer.... and thank you very much for your support. – Suresh – 2013-10-21T11:18:06.880

BTW if you also need the files to be accessible via an editor it is best to not include the #15 in the file and write the small.txt yourself in C# because some editors can't handle character below #32. Otherwise just include then in front of your original file. – Rik – 2013-10-21T11:18:49.463

its worked.thank you very much.I set Esc g Its Increased to 70+.Is it possible to increase more... and how to increase size of font for specific word... – Suresh – 2013-10-23T03:21:49.547

Yes, you can do #27P#15 for 100 characters and #27M#15 for 116 characters. I added some info to my answer on how to change a word during printing (bigger, bold etc). With this info you could almost write a "html to printer" in C#. Your base file could be with <b> etc and while reading it you could print it with these codes. (There are probably already some of these utilities :) – Rik – 2013-10-23T07:34:28.680

0

First, you need to find the printer language the printer is using. Then, look up and send the condensed print command before the job. Many dot matrix type devices used an escape code sequence so you'd send the esc character sometimes seen as 027 hex and then a sequence of characters. This sequence tells the printer to change fonts, line spacing, font size... Note that it is particular to the printer. There wasn't a truly universal language.

Blackbeagle

Posted 2013-10-21T08:59:02.700

Reputation: 6 424