Any sample to save PDFDoc to byte array

Q: Is there any sample project demonstrate how to output the PDFDoc
into byte array rather than saving to a physical file?

If no such example/method, output to a .NET output stream would also
be fine to me.
A: You may want to take a look at PDFDocMemory sample:

Basically PDFDoc constructor and Save methods can also accept a memory
buffer which you can pass instead of filename.