Printing bug for Annotation and Rectangle objects

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Kitry
Newbie
Newbie
Posts: 16
Joined: Tue May 16, 2006 12:00 am
Location: France

Printing bug for Annotation and Rectangle objects

Post by Kitry » Wed Feb 28, 2007 4:35 pm

Hi all,

I found a very annoying printing issue for the Rectangles and Annotations object in TeeChart VCL. It seems that their position is changing between the print preview and the final paper printing. As it was quite hard to send you my paper print, I made some print with my virtual PDF printer : it creates PDF instead of sending the chart to the real printer. Anyway the result is the same in both case (PDF or paper) : there's a discrepancy between the print preview and the print.


Print preview screenshot will all margins set to 10%:
Image

PDF screenshot of the printing with all margins set to 10%:
Image



With further investigations, I found out that the only case where this bug does not occur is when all margins are set to zero.

Print preview screenshot with all margins set to zero:
Image

PDF Screenshot of the printing with all margins set to zero:
Image

Regards,
Kitry
TeeChart Pro VCL/CLX V7.07 - Delphi 6 US Entreprise Edition with Update Pack 2 + RTL2 + RTL3 - W2k Pro SP2 French Version

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Mar 02, 2007 11:48 am

Hi Kitry,

You should print using StretchDraw as told in this message.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Kitry
Newbie
Newbie
Posts: 16
Joined: Tue May 16, 2006 12:00 am
Location: France

Post by Kitry » Mon Mar 05, 2007 10:04 am

in this post, I found the following code :

Code: Select all

procedure TForm1.BitBtn1Click(Sender: TObject); 
var meta : TMetafile; 
begin 
   Chart1.BevelOuter := bvNone; 
   Meta := Chart1.TeeCreateMetafile(True, Chart1.ClientRect); 
   try 
      [b]Printer[/b].Orientation := [b]poPortrait[/b]; 
      Printer.BeginDoc; 
      try 
         Printer.Canvas.StretchDraw(Rect(1,1,Printer.PageWidth - 1, 
         Printer.PageHeight - 1),Meta); 
      finally 
         Printer.EndDoc; 
      end; 
   finally 
      Meta.Free; 
      Chart1.BevelOuter := bvRaised; 
   end; 
end; 
But if I include this in my application, it raises the following error :

"Undeclared identifier : Printer"
"Undeclared identifier : poPortrait"
TeeChart Pro VCL/CLX V7.07 - Delphi 6 US Entreprise Edition with Update Pack 2 + RTL2 + RTL3 - W2k Pro SP2 French Version

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Mar 05, 2007 10:12 am

Hi Kitry,

You need to add Printers unit in your form's uses section.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Kitry
Newbie
Newbie
Posts: 16
Joined: Tue May 16, 2006 12:00 am
Location: France

Post by Kitry » Mon Mar 05, 2007 10:24 am

Hi Narcís,

Thanks. I just found it and already made some tests.

Well, this method is not really better. Depending on the printer you're using, the result is for the best only stretched and for the worst mostly unreadable.

Image

I'm sorry but this is really not satisfying for end users. I'm already hearing them complaining about the bad quality of the printing.

Wouldn't it be more accurate to solve the initial print problem that I raised in the beginning of this post ? It doesn't sound unrealistic to me ?

Cheers,
Kitry
TeeChart Pro VCL/CLX V7.07 - Delphi 6 US Entreprise Edition with Update Pack 2 + RTL2 + RTL3 - W2k Pro SP2 French Version

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Mar 05, 2007 2:10 pm

Hi Kitry,

this problem has been fixed for the next TeeChart Pro v8 (which we're working).
In meantime another solution is to set the correct position based on the paper rect before the Chart is printed, plesae see the code below :

Code: Select all

procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
  if printed then
  begin
    printed := false;
    charttool1.Left:=oldleft;
    charttool1.top:=oldTop;
  end;
end;

procedure TForm1.Chart1BeforePrint(Sender: TCustomTeePanel; Canvas: TCanvas;
  var R: TRect);
begin
  oldleft:=charttool1.Left;
  oldtop:=charttool1.Top;
  ChartTool1.Left:=R.Left+ChartTool1.Left;
  ChartTool1.Top:=R.Top+ChartTool1.Top;
  printed:=true;
end;

Post Reply