How do I take a PDFDoc and write the PDF that it represents to memory?

Q: I must be just missing it, but I can't find a version of the
PDFDoc.Save
method that just deals with memory. After I finish manipulating a
PDFDoc
instance, I just want to get the raw data file to save in a database.
I see
the save method signature that writes to a file (and sadly, I'm
currently
writing it to a temporary file, then reading the file, then deleting
it),
but I'm assuming you have a version to write to memory. I even see a
signature in the documentation that I have that I can't see in .NET
intellisense that seems to pass around buffers.

How do I just take a PDFDoc and write the PDF that it represents to
memory?
(a byte[])
----------------
A: Unfortunately intellisense sometimes does not work reliably.

You can use a version of pdfdoc.Save(...) method that can save to a
memory buffer. For a concrete example please take a look at
PDFDocMemory sample project (http://www.pdftron.com/pdfnet/
samplecode.html#PDFDocMemory).

You can serialize PDFDoc to memory as shown in PDFDocMemory sample
project (http://www.pdftron.com/net/samplecode.html#PDFDocMemory). For
example:

// In C#:
byte[] buf = new byte[1];
int buf_sz = 1;
doc.Save(ref buf, ref buf_sz,
pdftron.SDF.SDFDoc.SaveOptions.e_linearized);

// In JAVA
byte[] buf=doc.save(SDFDoc.e_linearized, null);

// In C++
const char* buf = 0;
size_t buf_sz;
doc.Save(buf, buf_sz, pdftron::SDF::SDFDoc::e_linearized, 0);