Home Devices
New Blog Posts: Merging Reports - Part 1 and Part 2

Print to PDF prints same picture for each record.

edited June 2005 in Devices
When writing to a PDF file, the program prints the picture for the first
record for all succeeding records that have a picture
but prints the correct picture when DeviceType is dtScreen or dtPrinter.
Any ideas on what I can look at to find the problem?

Using Delphi 2005 with ReportBuilder vers 9.02

Printing to pdf file prints same picture for every record that has a
picture. The picture is obtained from a separate file on
ppDetailBand1BeforePrint
rtn.
Printing to display, or to printer, or to printer using a pdf driver prints
correctly.

Code includes:

rbPictListM1.PassSetting: psTwoPass

uses ...ppPDFdevice,
...
if PrtDsp = 'D' then rbPictListM1.DeviceType := dtScreen else
// << Above prints correct picture
if PrtDsp = 'P' then rbPictListM1.DeviceType := dtPrinter else
// << Above prints correct picture
if PrtDsp = 'F' then begin
rbPictListM1.DeviceType := 'PDF';
rbPictListM1.TextFileName :=
formCommon.MainDir+'\Prtfiles\SelPList1.PDF';
rbPictListM1.AllowPrintToFile := True;
// << The above prints the first picture found for every record that has
a picture
end;
rbPictListM1.Print;
...
procedure TformPictListM1.ppDetailBand1BeforePrint(Sender: TObject);
begin // Find the picture to be printed,if any.
tblMemPict.SetKey;
tblMemPictMemno.AsString := tblMembMemno.AsString;
// << debug shows the following works correctly, finds the right picture
record each time,
// or turns off the picture display field if not found.
if tblMemPict.GotoKey
then rbMembPicture.Visible := True
else rbMembPicture.Visible := False;
end;

Two fields are printed from the tblMemPict file, Memno & the blob picture.
Even when the wrong picture prints, the correct Memno prints.

Comments

This discussion has been closed.