Link to home
Start Free TrialLog in
Avatar of formi
formiFlag for Switzerland

asked on

Images sometimes not printed

Hi

I have a strange problem: I'm printing with QuickReport. If I print a job with images on some printers randomly an image is not printed. I could see that:
- if I print it on a HP-printer the images are printed correctly
- if I print on an OKI the images are randomly not printed
- if I print directly to the printer (spooler off) the images are printed always

I replaced the procedure "StretchDraw" with the following code:
procedure PrintBitmap3(aCanvas: TCanvas; DestRect: TRect; bmp: TBitmap);
Var
  Info: PBitmapInfo;
  InfoSize: Cardinal;
  Image: Pointer;
  ImageSize: Cardinal;
  DIBWidth, DIBHeight: Longint;
begin
  GetDIBSizes(bmp.Handle, InfoSize, ImageSize);
  Info := AllocMem(InfoSize);
  Image := AllocMem(ImageSize);
  GetDIB(bmp.Handle, 0, Info^, Image^);
  with Info^.bmiHeader do
  begin
    DIBWidth := biWidth;
    DIBHeight := biHeight;
  end;
  With QRPrinter Do
    StretchDIBits(aCanvas.Handle, DestRect.Left, DestRect.Top, DestRect.Right-DestRect.Left, DestRect.Bottom-DestRect.Top,
                  0, 0, DIBWidth, DIBHeight, Image, Info^,
                  DIB_RGB_COLORS, SRCCOPY);
  FreeMem(Info, InfoSize);
  FreeMem(Image, ImageSize);
end;

Open in new window


It makes no difference. Any idea? Thanks for your help, Peter
Avatar of jimyX
jimyX

Did you try to preview the report before printing?
Do you see all the pictures when in preview and when printing (from the preview) are all the pictures visible?

Which Delphi and QR versions you are using?
Avatar of formi

ASKER

In preview always all pictures are visible, but not if I print from prewiev.

I use D7 QR 3.6.2, but same effect with D XE2.

I have QR 5.05 but I don't wan't to change it in this project (the risk of other problems is too big for me). Everything works fine except this issue with the images on some printers.
It is a rendering problem to the printer. If you have low resolution pictures this wouldn't happen, is that right?
Try this:
QuickRep1.Prepare;
QuickRep1.QRPrinter.Print;

Also try OnGenerateToPrinter = nil to force printing without rendering. At the event OnBeforePrint of your QR add this line:
QuickReport1.QRPrinter.OnGenerateToPrinter := nil;

It forces the QR to print without regenerating the report. The resulting print might be at lower resolution.
Avatar of formi

ASKER

unfortunatelly the Prepare-command doesn't help and there is no OnGenerateToPrinter method on quickrep1.qrprinter.
ASKER CERTIFIED SOLUTION
Avatar of formi
formi
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of formi

ASKER

Found the solution myself - other suggestions didn't help