Board index » delphi » Help..(TPW Printing )

Help..(TPW Printing )

Quote
>I'm using Turbo Pascal for windows 1.5.
>I've been trying to find some examples
>on how to print in windows1.5.
>I want to print the report my program generate.
>Although I know how to do it in
>turbo pascal 7. But my program is  for windows.

>Can anyone assist me on this please?

>shaf...@singnet.com.sg

function CreateDC( drivername, devicename, output : PChar; InitData pointer ) :
HDC;

drivername - asciiz string of device driver name without .drv extension

devicename - asciiz string that lists one of the devices supported by the
driver

output - asciiz string that represents the output port e.g. 'prn:', 'com1:',...

initdata - pointer to a TDevMode record, may be used to select specific
features, to use default settings pass NIL

Use the returned HDC to print text and graphics by calling any GDI routine just
like you would to display data to the screen

You can use the Escape function to check for error codes

const
  testTxt ='a line of text';
var
  PrnDC : hdc;
  errCode : integer;

begin
  PrnDC := createdc( 'EPSON9', 'Epson 9 pin', 'LPT1:', nil );
  if PrnDC <> 0 then begin
    errCode := Escape( PrnDC, startdoc, 4, pchar('test'), nil );
    if errCode > 0 then begin
      TextOut( PrnDC, 10, 10, testTxt, StrLen( testTxt ) );
      errCode  := Escape( PrnDC, NewFrame, 0, nil, nil );
      end;
    if errCode > 0 then Escape( PrnDC, EndDoc, 0, nil, nil );
    DeleteDC( PrnDC );
    end;
end;

I haven't tested this, hope this helps

James

 

Re:Help..(TPW Printing )


Hi,
I'm using Turbo Pascal for windows 1.5.
I've been trying to find some examples
on how to print in windows1.5.
I want to print the report my program generate.
Although I know how to do it in
turbo pascal 7. But my program is  for windows.

Can anyone assist me on this please?

shaf...@singnet.com.sg

Other Threads