1

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.

4
  • 1
    Is it actually MS-DOS? Or the Windows CMD prompt?
    – Alan B
    Oct 21, 2013 at 9:24
  • 1
    its CMD Prompt in Windows 7
    – Suresh
    Oct 21, 2013 at 9:27
  • What's the make and model of the printer?
    – Rik
    Oct 21, 2013 at 10:24
  • TVS MSP 250 Star Dot Matrix Printer
    – Suresh
    Oct 21, 2013 at 10:26

2 Answers 2

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)

10
  • 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
    Oct 21, 2013 at 10:54
  • 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
    Oct 21, 2013 at 10:57
  • How many characters it will print per line?
    – Suresh
    Oct 21, 2013 at 11:03
  • 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
    Oct 21, 2013 at 11:06
  • Added a link to the ESC/P manual from Epson. You can find more handy codes like draft, proportional printing etc.
    – Rik
    Oct 21, 2013 at 11:10
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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .