Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Qreports - Printers

213 views
Skip to first unread message

Ken

unread,
Aug 28, 2003, 2:16:52 PM8/28/03
to

Hey, Guys, Gals, I really need your help on this one. I'm using
Quick Reports and I need certain documents to print on
different printers. I have a Trackor Feed Printer printing
information filling in the Bill Of Lading form. Then the
packing list gets printed on a laser printer. Now right now
i have the program setup to show the printer dialog box to the
user which they select the printer to print on.


The problem is qrepots prints uses the printer driver that you
selected in the dialog box and prints it to the default
printer. So it prints garabage files on that printer. Yuck!
Is there a fix to this? I also want to hard code it so the
documents print automaticlly to the right printer to rid of
Humans "errors".

Well I'm trying to find humor in this!

Thanks
Ken

Timo

unread,
Aug 29, 2003, 2:41:46 AM8/29/03
to
Hi Ken,

when using the printer setup, make sure that you are using
QuickRep.PrinterSetup, not the standard TPrinterSetupDialog (selecting a
printer here will be ignored by QR).
If you want to select a printer by code, use the
TQuickRep.PrinterSettings.PrinterIndex runtime property. It is an index
into Delphi's Printer.Printers stringlist of printer names.

Regards
Timo

On 28 Aug 2003 11:16:52 -0700, Ken wrote:

> ...

Ken

unread,
Aug 29, 2003, 8:40:20 AM8/29/03
to

The you for the reply, I am using the QR.PrinterSetup, its selects the right driver but prints using the defualt! grrr.
I'll try to figure out the printer index stuff, but It would be very helpful to see a example code in real world how to do that. This is the first time coding printers for me. I'm just a newbe programmer.

Thxs
Ken

Timo

unread,
Aug 31, 2003, 6:13:39 AM8/31/03
to
Ken,

here is an example for setting Quickreport's printer index by printer name:

PrinterName:='HP LaserJet 6L';
For I:=1 to Printers.Printer.Printers.Count Do
If UpperCase(Printers.Printer.Printers[I-1])=UpperCase(PrinterName) Then
begin
QuickRep1.PrinterSettings.PrinterIndex := I-1;
Break;
end;

regards
Timo

Knut Eriksen

unread,
Sep 2, 2003, 2:07:33 AM9/2/03
to
Hi Timo
Your answer was of great value. Have you also an example where you can
choose an output bin, and where is the help text for theese smart solutions
?

Regards

Knut

"Timo" <no_publ...@gmx.de> skrev i melding
news:jzingdu1v6fq$.11r191ii718wg.dlg@40tude.net...

Timo

unread,
Sep 2, 2003, 2:54:30 PM9/2/03
to
Hi Knut,

> Have you also an example where you can choose an output bin, ...

the TQuickRep component has the PrinterSettings.OutputBin (and also in
3.6.2 there is PrinterSettings.CustomBinCode) property for this. Doesn't
this work for you (I currently only have a printer with a single bin
available, so I can't try)?

Regards, Timo

--
Timo.Hartmann at http://www.thsd.de
Home of QR PowerPack and QRDesign (QuickReport end user report editor)

Knut Eriksen

unread,
Sep 3, 2003, 5:54:28 AM9/3/03
to
Hi Timo
I have made a system for a client where he wanted to fill out preprinted
dokuments from a certain bin.
His HP printer have other properties for this than in Quick Report. On their
home page, qusoft.com, Questions an Answers, they admitted that this was a
problem that they are working with.

My solution was to install an extra printer, set the property to the correct
bin here and send the report to this printer. I also found that printer
names in f.x. Windows Me have port ( on LPT :) added to their names in the
configuration (in contrast to Windows XP). Therefore I have a small table
for each report where the user kan enter margins and choose printer from a
listbox where I display awailable printers.

Regards
Knut


"Timo" <no.e...@spamhole.com> skrev i melding
news:1ekulzhttoxb1.y0gpiltalmh6$.dlg@40tude.net...

Hippolyt Kay

unread,
Sep 8, 2003, 2:19:47 PM9/8/03
to
Hi Knut

> Hi Timo
> I have made a system for a client where he wanted to fill out preprinted
> dokuments from a certain bin.
> His HP printer have other properties for this than in Quick Report. On their
> home page, qusoft.com, Questions an Answers, they admitted that this was a
> problem that they are working with.


Maybe this pice of code can solve your problem. The individual bins
for a printer are stored in a memtable and can be used f.e. in a
lookup. Wonder if this works with your printer.

procedure TQRPrinterFrm.GetPaperBins(APrinterIdx: Integer);

type
TBinName = array [0..23] of Char;
TBinNameArray = array [1..High(Integer) div SizeOf(TBinName)] of
TBinName;
PBinnameArray = ^TBinNameArray;
TBinArray = array [1..High(Integer) div SizeOf(Word)] of Word;
PBinArray = ^TBinArray;

var
Device, Driver, Port: array [0..255] of Char;
hDevMode: THandle;
i, numBinNames, numBins, temp: Integer;
pBinNames: PBinnameArray;
pBins: PBinArray;

begin
Printer.PrinterIndex := APrinterIdx;
Printer.GetPrinter(Device, Driver, Port, hDevmode);
numBinNames := WinSpool.DeviceCapabilities(Device, Port,
DC_BINNAMES, nil, nil);
numBins := WinSpool.DeviceCapabilities(Device, Port, DC_BINS,
nil, nil);

with memBin do begin
Close;
Open;
end;

if numBins <> numBinNames then
begin
raise Exception.Create('DeviceCapabilities reports different
number of bins and bin names!');
end;
if numBinNames > 0 then
begin
pBins := nil;
GetMem(pBinNames, numBinNames * SizeOf(TBinname));
GetMem(pBins, numBins * SizeOf(Word));
try
WinSpool.DeviceCapabilities(Device, Port, DC_BINNAMES,
PChar(pBinNames), nil);
WinSpool.DeviceCapabilities(Device, Port, DC_BINS, PChar(pBins),
nil);
with memBin do begin
for i := 1 to numBinNames do begin
Append;
FieldByName('Bin').AsInteger := pBins^[i];
FieldByName('BinName').AsString :=
IntToSTr(FieldByName('Bin').AsInteger) + ' - ' + pBinNames^[i];
end;
end;
finally
FreeMem(pBinNames);
if pBins <> nil then begin
FreeMem(pBins);
end;
end;
end;
end;

Knut Eriksen

unread,
Sep 11, 2003, 5:08:54 AM9/11/03
to
Thanks Hyppolyt !

I will try this one.

Regards
Knut

"Hippolyt Kay" <hippol...@gmx.net> skrev i melding
news:8e16262f.03090...@posting.google.com...

0 new messages