PDF generator: cancel saving

How can I close and free a TTMSFNCPDFLib without saving it?

Let's say I am starting creating a pdf, but it takes a lot and I want to cancel without saving it.
If I call EndDocument the pdf is saved, if I don't call EndDocument I get a memory leak.

Lazarus 1.6.4 fpc 3.0.2

Hi, 


You can add an empty string as filename, and return the PDF file as a memory stream with EndDocument.

Got it. Thanks!