Board index » delphi » Newbie needs help with code for Printing in tp 7.0

Newbie needs help with code for Printing in tp 7.0

I am very new at pascal and would like to know the code to allow a
program to print.  I am taking a class and if I get this program to
print it will help my grade.  I need all the help I can get.  I would
appreciate any help from anyone that has anything to offer.  Thanks.

 

Re:Newbie needs help with code for Printing in tp 7.0


emb...@pixi.com said:
( On Thu Dec 12 22:31:00 1996 )
( Msg-Id was: <58q1hk$...@rigel.pixi.com> )

Quote
>I am very new at pascal and would like to know the code to allow a program to
>print.  I am taking a class and if I get this program to print it will help
>my grade.  I need all the help I can get.  I would appreciate any help from
>anyone that has anything to offer.  Thanks.

Well... let me see...
1-) do you know what does WriteLn do???
2-) do you know some basic printing codes? (as ^L )
3-) do you know how to include units? (with uses)
4-) Then you've got  everything you need...

    Just do the following:
{========Printing.pas===============}
Program make_some_printing_output;
Uses
    printer, CRT;
Const
    Nxt_Pg = #12;

Var
    Sarasa : string;

begin
    Write ('What do you want to send to the printer?: ');
    ReadLn (sarasa);
    Wrtie (LST, sarasa);
    {in this case LST is our printer, defined in printer unit.}
    {but I think that you also can do a Write (PRN, sarasa), without unit
printer}
    {in pascal, that's the way to redirect the input and the output, you put
in the}
    {Writeln sentence 'where' you want to write, and what (for reading is the
same thing} end.
{========Printing.pas===============}

Hope it helps. IF you want to be a step ahead, start studying the conditional
structures, loop controls, etc (if, for, while, case, etc.) if you do
understand them, then you'll be a Hero for your girl-class-fellows (english
from dictionary...jejeje...), and you'll be a Nerd to your
male-class-fellows... (that's what happens to me... ;-(...  )

-\ >> andres mosto                                 apexe...@interactive.com.ar
--\ >>    team os/2                          xeuz international co. ltd. ---\

Quote
>>              buenos aires - argentina - south america

Re:Newbie needs help with code for Printing in tp 7.0


At the beginning :

Uses
  Printer ;

In the program :

Write (Lst, ...) ; Or
WriteLn (Lst, ...) ;

--
Greetings,
ASS-Ware.

           ,,,
          (o o)
 -----oOO--(_)--OOo-----
|       ASS-Ware        |
|    is watching you    |
 -----------------------

emb...@pixi.com wrote in article <58q1hk$...@rigel.pixi.com>...

Quote
> I am very new at pascal and would like to know the code to allow a
> program to print.  I am taking a class and if I get this program to
> print it will help my grade.  I need all the help I can get.  I would
> appreciate any help from anyone that has anything to offer.  Thanks.

Re:Newbie needs help with code for Printing in tp 7.0


Quote
> I am very new at pascal and would like to know the code to allow a
> program to print.  I am taking a class and if I get this program to

If you think of printing on the printer, the easiest way (but not always
working well under Windows 95) is to use printer unit.

It would be something like that:

program test;

uses printer;

const
  ff=#12;  {I might be wrong about this one}

begin
  writeln(lst,'This should go to the printer',ff);
end.

The lst file is automatically prepared for output by the printer unit.
It maps onto the lpt1: port. You can also use something like that:

program test2;

var
  lpt2:text;

const
  ff=#12;  {I might be wrong about this one}

begin
  assign(lpt2,'lpt2');
  rewrite(lpt2);
  writeln(lpt2,'This will go to lpt2',ff);
end.

Hope this helps. When it goes to printing graphics, the story gets
a little harder. You must either:
1. use some already developed library, whether commercial or freeware
2. use bgi drivers (I've never done that but a friend of mine did and it
worked)
3. write the graphic rasterizer yourself (a rather daunting task)

Jacob.

Other Threads