Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 2556

Summary: Patterns and image backgrounds not exported to pdf
Product: VCL TeeChart Reporter: yeray alonso <yeray>
Component: ExportAssignee: Steema Issue Manager <issuemanager>
Status: CONFIRMED ---    
Severity: enhancement CC: yeray
Priority: ---    
Version: 35.220329   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
URL: https://www.steema.com/support/viewtopic.php?f=3&t=17736
Chart Series: --- Delphi / C++ Builder RAD IDE Version:

Description yeray alonso 2022-09-27 02:22:13 EDT
When you have a pattern or an image as a background, ie for a TSeriesBandTool, that background isn't exported to the pdf.

Examples:

uses TeePDFCanvas;

// Pattern:

  Chart1.AddSeries(TLineSeries).FillSampleValues;
  Chart1.AddSeries(TLineSeries).FillSampleValues;

  with TSeriesBandTool(Chart1.Tools.Add(TSeriesBandTool)) do
  begin
    Series:=Chart1[0];
    Series2:=Chart1[1];
    Brush.BackColor:=clRed;
    Brush.HatchStyle:=hsVertical;
  end;

  TeeSaveToPDFFile(Chart1, 'pattern.pdf');


// Image:

  Chart1.AddSeries(TLineSeries).FillSampleValues;
  Chart1.AddSeries(TLineSeries).FillSampleValues;

  with TSeriesBandTool(Chart1.Tools.Add(TSeriesBandTool)) do
  begin
    Series:=Chart1[0];
    Series2:=Chart1[1];
    Brush.Image.LoadFromFile('steema_logo_32.png');
  end;

  TeeSaveToPDFFile(Chart1, 'image.pdf');}
Comment 1 yeray alonso 2023-11-02 04:20:20 EDT
A workaround is to create the pdf document "manually" (with TPDFCanvas), export the TChart to TBitmap with TeeCreateBitmap, and add that bitmap to the pdf document. Ie: 

procedure TForm1.ExportChartToPdf;
var c : TPDFCanvas;
    b : TBitmap;
const PDF='C:\tmp\chart1.pdf';
begin
  c:=TPDFCanvas.Create;
  try
    b:=Chart1.TeeCreateBitmap;
    try
      c.Draw(0,0,b);
    finally
      b.Free;
    end;

    c.SaveToFile(PDF);
  finally
    c.Free;
  end;
end;