Hello! We meet again! Revive from the confusion in overlays? Well, this
lesson is about printer and it is pretty short. Pascal provides a neat
feature to print out results. Of course I explain how to print. I also
explain the escape code for old dot-matrix printer, Epson LX-800 compliant.
No, I don't explain WYSIWYG here, it's too complicated since every printer
must be treated very differently. So, why don't we begin?
Pascal provides a neat feature to print texts. It was using printer unit. Just put uses printer in uses clause and you're on your business. :-) How to use it? This way:
uses printer; : : writeln(lst,'Hello, I can print out!');
Just adding lst into write or writeln clause, you can write out to printers! However, you cannot do the same into read or readln.
Epson LX-800 is a long history. However, it mostly adapted by nowadays printer. Although Epson was the printer standard at that times, the standard codes are eventually fade away. Recently, every brand of printer has its own way to print. Nevertheless, the traditional escape code is still adapted in many printer. The escape code is the code to set up printer to do things like bolding, underlining, or enlarge text. The escape code is very varied. We could do interesting things with it. We can corporate it inside our programs.
First of all I warn you that most of HP laser printer don't accept these escape codes. So, if you find the excerpt not working, don't continue.
Most of the escape code sequence is began with sending the character 27 (or Escape) to printer. Then, we could put additional code right after it. For example, selecting Roman font can be done by sending the character number 107, then character number 0. So, to select roman font you would write:
write(lst,#27+#107+#0);
Easy, right? Selecting Near Letter Quality (NLQ) mode, so that the print out has a better quality, is done through sending character number 120 then character number 1. We should write:
write(lst,#27+#120+#1);
To enable printer to print extended characters like the symbol of poundsterling, the lines, and so, you need to send character 116 then character 1. This is done by this:
write(lst,#27+#116+#1);
There are so many escape code routines. You can find it in Epson LX-800
reference manual. I don't have to mention all of them here. It would be
a waste. :-)
That's all folks! Very brief, right? However, the printer technology extends much farther than we've discussed. Most notably WYSIWYG feature that is currently employed by Windows. You need to learn more.
If there are any mistakes in my texts, please do inform me. Especially for infos that relate to printers. Shall we go to the quiz or the next lesson?
Back to main page
Back to Pascal Tutorial Lesson 2 contents
To the quiz
To Chapter 10 about low level programming concepts.
My page of programming link
Contact me here
By: Roby Joehanes, © 1997, 2000