Board index » delphi » Printing Multiple Copies

Printing Multiple Copies

How do you print multiple copies under windows? I have tried
numerous methods of trying to do multiple printing of my
QuickReport but to no avail. Even a simple Delphi print like the
one below won't print, even though the Orientation and FontSize
properties are obeyed. I'm not sure whether it makes any
difference to windows printing but I am on a Novell network
(Netware 5.1).

Can anyone help me?

procedure TForm1.Button1Click(Sender: TObject);
begin
  with Printer do
  begin
    Copies := 2;
    Orientation := poLandscape;
    BeginDoc;
    Canvas.Font.Size := 12;
    Canvas.TextOut(20, 20, 'Hello World!');
    EndDoc;
  end;
end;

 

Re:Printing Multiple Copies


Quote
In article <3d2d007c$1_2@dnews>, SteveX wrote:
> How do you print multiple copies under windows? I have tried
> numerous methods of trying to do multiple printing of my
> QuickReport but to no avail. Even a simple Delphi print like the
> one below won't print, even though the Orientation and FontSize
> properties are obeyed.

Your printer or driver may not support mutiple copies. You are supposed
to check whether it does with a call to DeviceCapabilities and if you
get a negative reply simply repeat the print job as often as the user
requested.

uses printers, winspool;

Function GetPrinterCopies: Integer;
Var
  Device, Driver, Port: Array [0..255] of Char;
  hDevMode: THandle;
Begin
  Printer.GetPrinter(Device, Driver, Port, hDevmode);
  Result :=
    WinSpool.DeviceCapabilities( Device, Port, DC_COPIES, Nil, Nil );
End;

You get back the number of copies the printer can handle in its own,
usually 9999 if there is no practical limit. If you get 0 or 1 you have
to emulate this feature.

--
Peter Below (TeamB)  
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be

Re:Printing Multiple Copies


Quote
>Your printer or driver may not support mutiple copies. You are supposed
>to check whether it does with a call to DeviceCapabilities and if you
>get a negative reply simply repeat the print job as often as the user
>requested.

I think I understand it now. Thanks. My Driver didn't support
multiple copies but another one I tried did. I will try using
that.

Btw, is there any difference between a return value of 0 and 1?
One of my print drivers (the one I had been using) returned 0,
the next one returned 1 and the last one returned 32767.

Thanks again.
Regards,
Steve.

Re:Printing Multiple Copies


Quote
In article <3d2dfded$1_1@dnews>, SteveX wrote:
> Btw, is there any difference between a return value of 0 and 1?

There seems to be no clearly defined value a driver is supposed to return
when it does not support copies directly. I would just treat anything <= 1
as indication of "no copy support".

--
Peter Below (TeamB)  
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be

Other Threads