Hi Manfredt,
1) I think you should free the "mem" object holding the stream, but this depends on the implementation of the qryGetDocumentImage.CreateBlobStream method. If that method only gives you a pointer to an internally created blob stream then you would not want to destroy it.
2) You should also set TRtcDataServer(Sender).Response.ContentType to the content type you are sending out. That goes for PDF files as well as other content type you are sending out like images, text, binary files or HTML.
Here is a Wiki page listing most known content types:
http://en.wikipedia.org/wiki/Internet_media_typeBest Regards,
Danijel Tkalcec