Export as PDF to Stream

Hello,

Is it possible to export a report as PDF but to a stream not to a file?

For example if I want to export a report to a stream in it's native format I do something like this :

TMemoryStream* pMem = new TMemoryStream();
Report->PreviewPages->SaveToStream(pMem);
//........etc

At the moment my code looks like this:

TMemoryStream* pMem = new TMemoryStream();
PDFExport->FileName = "tempfile.pdf";
Report->PreviewPages->Export(PDFExport);
pMem->LoadFromFile(PDFExport->FileName);
DeleteFile(PDFExport->FileName);
//........etc

So I have to use a temporary file...

Thanks,
Vasile

Leave a Comment