Hi!
I use TRVReportHelper in my project and when I insert an image into a header or footer, the size of image is about 5 times smaller then original size. On the printer the size is correct, the problem is only in print preview.
The example of my problem is in the project here: http://pogocki.waw.pl/smaller_footer_images.zip
Where is the problem - in my source code, or in RV?
Thanx in advance
JP
Why TRVReportHelper wrongly resizes images on print preview?
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
The following things must be changed:
1) Add PrnCanvas: TCanvas to the form's private variables.
2) Change these procedures to use PrnCanvas:
3) In TForm1.RVPrint1PagePrepaint, use PrnCanvas as the first parameter of rvhHeader.Init and rvhFooter.Init.
1) Add PrnCanvas: TCanvas to the form's private variables.
2) Change these procedures to use PrnCanvas:
Code: Select all
{ Menu: Print preview }
procedure TForm1.Preview1Click(Sender: TObject);
var DC: HDC;
begin
DC := RV_GetPrinterDC; // from PtblRV unit
PrnCanvas := TCanvas.Create;
try
PrnCanvas.Handle := DC;
PrnCanvas.Font.PixelsPerInch := GetDeviceCaps(DC, LOGPIXELSY);
FormatDoc(PrnCanvas);
Preview(PrnCanvas);
finally
PrnCanvas.Handle := 0;
DeleteDC(DC);
end;
end;
{ Menu: Print }
procedure TForm1.Print1Click(Sender: TObject);
var DC: HDC;
begin
DC := RV_GetPrinterDC; // from PtblRV unit
PrnCanvas := TCanvas.Create;
try
PrnCanvas.Handle := DC;
PrnCanvas.Font.PixelsPerInch := GetDeviceCaps(DC, LOGPIXELSY);
FormatDoc(PrnCanvas);
Print;
finally
PrnCanvas.Handle := 0;
DeleteDC(DC);
end;
end;