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 - Patterns and image backgrounds not exported to pdf
Summary: Patterns and image backgrounds not exported to pdf
Status: CONFIRMED
Alias: None
Product: VCL TeeChart
Classification: Unclassified
Component: Export (show other bugs)
Version: 35.220329
Hardware: PC Windows
: --- enhancement
Target Milestone: ---
Assignee: Steema Issue Manager
URL: https://www.steema.com/support/viewto...
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-27 02:22 EDT by yeray alonso
Modified: 2023-11-02 04:20 EDT (History)
1 user (show)

See Also:
Chart Series: ---
Delphi / C++ Builder RAD IDE Version:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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;