How do I serialize a PDFDoc to memory?

Q: Is it possible to serialize a PDFDoc to memory? I will want to
stream a PDF out via an HTTP Response stream.


A: 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);

Q: The VS class browser only shows save to file:
        public void Save(string path, SDFDoc.SaveOptions flags);

Oddly, the sample builds just fine even though the class browser knows
nothing about that method signature. I discovered the online user
guide, and that helped a lot. But it is
incomplete because it does not address PDF-level content (comments,
fields, etc.) I'll continue to paw through the examples for what I
need,
though.
------
A: Unfortunately VS IntelliSense is not very accurate and can't be
completely relied upon. You may find PDFNet API Reference more useful
then IntelliSense:

C++: http://www.pdftron.com/net/apiref.html
JAVA: http://www.pdftron.com/net/Javadoc

Under .NET you can also use 'Object Browser' to inspect the available
API. To open object 'Object Browser' simply double-click on PDFNet in
the 'Refereces' group of your project solution.