TChart3D printing does not work

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
niotronic
Newbie
Newbie
Posts: 14
Joined: Mon Jul 15, 2013 12:00 am

TChart3D printing does not work

Post by niotronic » Thu Jul 10, 2014 12:31 pm

Hi,

I've been trying to print a TChart3D using either TChart3D.Printlandscape, PrintPortrait, or PrintPartialcanvas, but unfortunately the printed page is always empty. I tried a few different printers (Kyocera FS1370DN, some pdf printers including adobe's and the microsoft XPS printer). Saving the chart to a bitmap file, or copying to the clipboard however is working fine...


Code: Select all

Chart3D.PrintLandscape
or by printing to the printer.canvas manually:

Code: Select all

Printer.BeginDoc;
Printer.Canvas.TextOut(50, 50, 'printing test text');
Chart3D.PrintPartialCanvas(Printer.Canvas, Rect(100, 100, 2000, 2000));
Printer.EndDoc;

In the above example the "printing test text" line is printed as expected - but no chart in either of the two examples...

Do I have to prepare the chart for printing ?
Furthermore the call of any of the TChard3D's printing methods erases the chart3d's client area - it shows up as a completely white area - a full redraw has to be performed to show the Tchart as it was showign before calling any of the printing methods ?

Best regards,

Klaus

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

Re: TChart3D printing does not work

Post by Narcís » Thu Jul 10, 2014 1:39 pm

Hi Klaus,
Do I have to prepare the chart for printing ?
No, this looks like a bug to me. I have added it to the bug list (ID838). The only way I found it works (as a standard chart, non-TChart3D) is opening the chart editor and going through the print preview in the editor for printing the chart. Using StretchDraw doesn't work either:

Code: Select all

uses Printers;

procedure TForm1.Button1Click(Sender: TObject);
var meta : TMetafile;
begin
   Chart3D1.BevelOuter := bvNone;
   Meta := Chart3D1.TeeCreateMetafile(True, Chart3D1.ClientRect);
   try
      Printer.Orientation := poPortrait;
      Printer.BeginDoc;
      try
         Printer.Canvas.StretchDraw(Rect(1,1,Printer.PageWidth - 1,
         Printer.PageHeight - 1),Meta);
      finally
         Printer.EndDoc;
      end;
   finally
      Meta.Free;
      Chart3D1.BevelOuter := bvRaised;
   end;
end;
Furthermore the call of any of the TChard3D's printing methods erases the chart3d's client area - it shows up as a completely white area - a full redraw has to be performed to show the Tchart as it was showign before calling any of the printing methods ?
No, I could reproduce it also.

BTW, feel free to sign up at bugzilla and add yourself to the CC List to receive automatic issue notifications.
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

PI Master
Newbie
Newbie
Posts: 1
Joined: Fri Jul 19, 2019 12:00 am

Re: TChart3D printing does not work

Post by PI Master » Sun Jul 28, 2019 2:25 am

The work around is very simple. Copy the TChart3D canvas to another canvas that does work, and print the copied canvas. I used a TImage canvas in my example. I had to include the zero length line draw as a workaround to get the TImage canvas to print, so the example has two workarounds to get TDraw3D to print. Taken together, the TDraw3D print process does work.

Code: Select all

                        Draw3D1->CopyToClipboardBitmap();
			Image3D->Visible = true;
			Image3D->Align = alClient;
			Image3D->Picture->Assign(Clipboard());

                        Printer()->Title = "Picture 3D";
			Printer()->BeginDoc(); 
			Printer()->Canvas->Pen->Width = 1;
			Printer()->Canvas->Pen->Color = clWhite;
			Printer()->Canvas->MoveTo(0,0); Printer()->Canvas->LineTo(0,0);        //Need this as a bug work-around
			Printer()->Canvas->CopyRect(
                                     Rect(0, 0, Printer()->PageWidth, Printer()->PageHeight), 
                                     Image3D->Canvas, 
                                     Rect(0, 0, Image3D->Width, Image3D->Height));

			Printer()->EndDoc();
			Image3D->Visible = false;
			Image3D->Align = alNone;

Marc
Site Admin
Site Admin
Posts: 1271
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: TChart3D printing does not work

Post by Marc » Mon Aug 12, 2019 7:18 am

Thanks for the input.

Regards,
Marc
Steema Support

Post Reply