For the intial problem I suggested ...
You could calculate the width each character will use up depending on the size font you have used. That will give you the number of characters you could print across the page, then start printing your text at (maxchars - textlength) / 2 or pad it with that many spaces at the front. Same principle with the columns. Don't think you have many options other than "brute force" with dot-matrix printers.
From the OPs comment that seems to have worked, but we now have a new issue ...
Tegimus:
Okay I have done It the way you suggested. Now the problem is content length. I need to print the contents between header and footer. If it doesn't fit, put it in the next page between header and footer. How can I acheive this? Thank You
So ...
Same principle really ... just work out how much physical space your header and footer are going to take - subtract that from the overall length available. Work out how many lines of print you can get into that space given the font size you are using - remember to round down though.
Keep a line count of what you are printing, when you reach the limit print your footer, pagethrow, header and then start with the next line of detail.
Hint: This isn't the best way to do output, but in circumstances like a dot-matrix printer you often have no choice. Similar (width) problems exist for continuous printers for till receipts etc. Essentially this is a fixed-format print. I would still advise trying to parameterise the information as much as possible - i.e. a calculation on max line count based on physical paper size stored in configuration somewhere.