Board index » delphi » How to print line by line with delphi

How to print line by line with delphi

Delphi! Delphi! = Problem!
I'm searching for some ideas how to print logged data line by line. Til
now i'm able to print one line and then a formfeed follows. How to
suppress this newpage command?
I use the TPrinter Class in Delphi.
Thanks a lot !

 

Re:How to print line by line with delphi


Quote
Manfred Schmickler wrote:

> Delphi! Delphi! = Problem!
> I'm searching for some ideas how to print logged data line by line. Til
> now i'm able to print one line and then a formfeed follows. How to
> suppress this newpage command?
> I use the TPrinter Class in Delphi.
> Thanks a lot !

Could you post the *relevant* (please not all of your code !!!) part of
code you're using to write to the printer (or mail it to me) ?

Rudi

Re:How to print line by line with delphi


I have been struggling with this problem also, and asking any suggestions
also from Borland newsgroups, with no luck. I have a matrix printer with
continuous form, and about 10 cm high labels on it to print one by one.
This seems to be almost impossible task with Windows and it's mandatory
form feed after every printout.

So, I have not found any Windows printing system based solution. Only when
you forget everything from the fancy windows printing, and go down to old
good DOS stylish printing, you get the work done also from Delphi/Win.

var
 Prt:TextFile;
begin
  AssignFile(Prt,'LPT1');
  Rewrite(Prt);
  Writeln(Prt,'Hello again');
  CloseFile(Prt);

The code looks harsh, doesn't it, but it works. Not tested with network
printers or NT4.0 though... If someone knows more like Windows printing
based solution, I'm extremely willing to hear.

Markku Nevalainen

Quote
Manfred Schmickler wrote:

> Delphi! Delphi! = Problem!
> I'm searching for some ideas how to print logged data line by line. Til
> now i'm able to print one line and then a formfeed follows. How to
> suppress this newpage command?
> I use the TPrinter Class in Delphi.
> Thanks a lot !

Re:How to print line by line with delphi


Quote
Frank Mokry wrote:

> Try this:

> - Select a Windows printer driver that allows user-defined paper sizes
> - Use ExtDeviceMode from the Win API to read the current paper size
> - Set the paper size you need and send it back to the printer driver
> via ExtDeviceMode

> Now when the FF gets sent at the end of the print job the paper will
> only feed the size you specified in the ExtDeviceMode call.

> The above applies to Win 3.1x, don't know about Win 95.

I believe this will work for some printers. The problem seems to be, that if
you want the routine to be a general solution for many different (often old)
matrix printers a FormFeed is a Formfeed to many of these printers.
They don't know they should stop at 10 cm, but feed out the whole A4 height
form.

Markku Nevalainen

Re:How to print line by line with delphi


Quote
The Graphical Gnome wrote:

> From: Peter van Lonkhuyzen <pet...@lin01.global.co.za>

> > I've tried to write a D1 or D2 program that will print only one line at a
> time to a printer (any type), exit the program but NOT eject the page,
> so that the next time I run the program and it prints a line, it prints on the
> very next line, etc.

This RawPrinter code might be a ready made answer for D2, but it does not
get compiled under D1.   I spent over an hour trying to make the changes
for D1, but both the RawPrinter and the Example still need modifications.
  For example: SetAbortProc(dc2, AbortProc);  -->This just does not
                                                 get thru D1.
So, if anybody converts this to D1, please post me one copy also.

Markku Nevalainen

Other Threads