Search code examples
c++c++builderteechart

Is there a way to export a TeeChart to PDF?


I've created a TeeChart in RAD Studio XE8 C++ Builder. I know you can use Print or PrintPartial to output to a printer. I'm wondering if there's a way to output this TeeChart to a PDF?

edit: This feature is included in the "pro" version. For now, I'm using the TeeChart Draw function to draw to a bitmap, then use a separate utility to move that into a PDF.


Solution

  • You can use TeeSaveToPDFFile function to export a chart and create a pdf document with it. Ie:

    .h:

    #include <VCLTee.Series.hpp>
    #include <VCLTee.TeePDFCanvas.hpp>
    

    .cpp:

    void __fastcall TForm1::FormCreate(TObject *Sender)
    {
      TBarSeries *Series1 = new TBarSeries(Chart1);
      Chart1->AddSeries(Series1);
      Series1->FillSampleValues();
    
      TeeSaveToPDFFile(Chart1, "C://tmp//testCBuilder.pdf");
    }
    

    Another alternative is to use a virtual pdf printer and print the chart to it.