1

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.

Daniel T
  • 88
  • 11

2 Answers2

2

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.

Yeray
  • 5,009
  • 1
  • 13
  • 25
1

I've exported charts (not from TeeChart, but similar) to PDF using Libharu. You can save your image as png (or bmp) to stream or file, and then load using Libharu and draw on the page.

Here is the documentation: Libharu Wiki

See functions in API: Document, for example HPDF_LoadPngImageFromFile()

If you need, I can write the code that loads the png image from hard drive and prints it on a PDF page.