Board index » delphi » Print wrapping problem

Print wrapping problem

I'm having problems with what should be a very simple print routine. I
want to print a flat text file to a printer. The code I'm using (with
Delphi 3, btw) is below.

With an 80 column text file going to a normal 8.5" wide printer/paper,
this works fine. However, when printing a 132 column report to a wide
carriage printer, each line of text gets wrapped at 8.5"/80 columns,
just as though it wasn't on a wide carriage printer.

The routine below is about as simple and straightforward as I can make
it - it pretty much just reads a line of text from the flat file and
dumps it out to the printer device.

How can I keep it from wrapping at 8.5" on a wide carriage printer?

Any help gratefully appreciated!

---
procedure TFM_Main.DoPrint;
var
  PF : System.Text; // printer device
  TF : TextFile;    // text file device
  sLine : String;   // line container
begin
  AssignFile (TF, PrintFileName);
  AssignPrn (PF);
  try
    Rewrite(PF);
    Printer.Canvas.Font.Assign(op_Font);
    {$I-} Reset (TF); {$I+}
    if IOResult <> 0 then
    begin
      MessageDlg('Printing error.', mtError, [mbOk], 0);
      Halt;
    end;
    while not EOF(TF) do
    begin
      Readln (TF, sLine);
      Writeln(PF, sLine);
    end;
  finally // try
    System.Close (PF);
    CloseFile (TF);
    Halt;
  end; // try .. finally loop
end;

--
Kobayashi Software - Chicago, Illinois
www.kobayashi.com - e...@kobayashi.com

 

Re:Print wrapping problem


Eric Schreiber <e...@kobayashi.com> wrote in article
<35e211dc.10585...@nntp.enteract.com>...

Quote
> I'm having problems with what should be a very simple print routine. I
> want to print a flat text file to a printer. The code I'm using (with
> Delphi 3, btw) is below.

> With an 80 column text file going to a normal 8.5" wide printer/paper,
> this works fine. However, when printing a 132 column report to a wide
> carriage printer, each line of text gets wrapped at 8.5"/80 columns,
> just as though it wasn't on a wide carriage printer.

> The routine below is about as simple and straightforward as I can make
> it - it pretty much just reads a line of text from the flat file and
> dumps it out to the printer device.

> How can I keep it from wrapping at 8.5" on a wide carriage printer?

> Any help gratefully appreciated!

> ---

I do not know how you have got your printers set up but have you tried
changing the paper size from 8.5" to the size of your wide paper?

Alex.

Re:Print wrapping problem


Copy the source file to the printer from a dos window first to make
sure your source file is not causing the problem.
If that prints ok, try writing your output to another file, view it
with an editor capable of showing control chars - a hex editor would
be ideal, and make sure you don't have any line feeds/ carriage
returns in there.

If neither of those work, then I don't know.

Martin Clarke.

Re:Print wrapping problem


Quote
mar...@dealernet.com.au (Martin) wrote:
>Copy the source file to the printer from a dos window first to make
>sure your source file is not causing the problem.

I'm ashamed that I didn't think of this test. This would certainly
indicate if the problem was outside the control of my program!

Quote
>If that prints ok, try writing your output to another file, view it
>with an editor capable of showing control chars

Grrr. Another one I didn't think of. :-)

I'l try both of your suggestions. Thanks!
--
Kobayashi Software - Chicago, Illinois
www.kobayashi.com - e...@kobayashi.com

Other Threads