## TPrintPreview

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.

### TPrintPreview

hi!
The TPrintPreview is fine! Tiny and usefull.
Can I scalled on the Paper some TPanel with all controls within? I try to do it but application seen to be fault if panel consist more then one control within... I use PaintWinControl. Thanks for any advices
BAPBAP
Member

Posts: 1
Joined: April 26th, 2003, 12:18 pm
Location: Russia

Hi,

To fix the bug, please look for the following line

Code: Select all
WinControl.PaintTo(Bitmap.Canvas.Handle, 0, 0);

in the PaintWinControlEX method of TPrintPreview (Line No. 1381) and replace it with this one

Code: Select all
WinControl.PaintTo(Bitmap.Canvas, 0, 0);

Thanks,
Kambiz

Kambiz

Posts: 2424
Joined: March 7th, 2003, 7:10 pm

Is this still valid? I noticed this change was not in the later releases?
rgesswein
Member

Posts: 2
Joined: May 21st, 2003, 8:58 pm

You are right. The above code is only valid for Delphi 6 or later.

Kambiz

Posts: 2424
Joined: March 7th, 2003, 7:10 pm

### Problem when print and fastprint=false

Hi Kambiz, I have two problem with TPrintPreview.
1. After release 4.17 when I change the printer resolution, change the size of font in the preview

2. In the new release when fastprint=false, generate an exception.

thank you Alex

excuse me for my bad english.
Alex
Member

Posts: 4
Joined: September 4th, 2003, 8:31 am

Hi Alex,

1. The PixelPerInch property of the font depends on resolution of the device. In the older versions of TPrintPreview this dependency was not considered.

Code: Select all
procedure TFont.SetSize(Value: Integer);begin  Height := -MulDiv(Value, FPixelsPerInch, 72);end;

2. Can you please save the preview in a file and post it here. Having it will be helpful to figure out the problem. Of course, I do suggest instead of setting the FastPrint property to False, to use PaintGraphic or PaintGraphicEx methods to draw images and leave the FastPrint property as True. In this way, not only the print process is faster but also it will prevent out of resource problem that may occur on Windows 98 for high resolution prints.

Cheers,
Kambiz

Kambiz

Posts: 2424
Joined: March 7th, 2003, 7:10 pm

### TPrintPreview

Thank you so much Kambiz,
I post the file "PrintPreview.doc" but it save with TPrintPreview. The real name id PrintPreview.ppv.

Cheers
Alex
Alex
Member

Posts: 4
Joined: September 4th, 2003, 8:31 am

I couldn't downlaod the file, because with .doc extension the mime type of file set to word document.

Can you upload the file with .ppv extension? I added this extension to the list allowed extensions.

Kambiz

Kambiz

Posts: 2424
Joined: March 7th, 2003, 7:10 pm

### PrintPreview

Sorry i can't upload with ppv extension!!!
You are sure to enabled ppv extension? I upload with txt extension.
try again to download this file doing right click of the mouse on the attach file, and select "save target as...".

Alex
Alex
Member

Posts: 4
Joined: September 4th, 2003, 8:31 am

Because you didn't use any image in your report, you don't need to set FastPrint to False. As I already mentioned, it this way the print process is faster and the font qualility is also much better.

When you set the FastPrint property to False, TPrintPreview convert Metafile image of the page to device independent bitmap, and send this bitmap to the printer.

Probably you are using a high resolution printer on Windows 98, and because of that the DIB Bitmap size is bigger than what Windows 98 supports.

By the way, I removed you second attachment and changed the extension of the first one to ppv.

Regards,
Kambiz

Kambiz

Posts: 2424
Joined: March 7th, 2003, 7:10 pm

### TPRintPreview

Ok Kambiz, thank you for your attention.
Your component are the best component for delphi.

Regards
Alex
Alex
Member

Posts: 4
Joined: September 4th, 2003, 8:31 am

Thank you.
This is so kind of you.

Kambiz