View PDF from SQL

Q: I am currently using the below code to read a local file for
testing and save it to memory buffer from your example. However I am
not sure how to view the pdf from memory without saving to a local
file. view.Show() is looking for a fileName.

FileStream fileStream1 = new FileStream(input_path + "7158630.pdf",
FileMode.Open);
BinaryReader reader1 = new BinaryReader(fileStream1);
byte[] file_buff =reader1.ReadBytes((int)reader1.BaseStream.Length);
PDFDoc doc = new PDFDoc(file_buff, file_buff.Length);
doc.InitSecurityHandler();

PDFViewForm view = new PDFViewForm(this);
view.Show();
---------------------
A:

In your code you initialize PDFDoc from a memory buffer. To view the
file in PDFViewCtrl you only need to associate PDFDoc with the viewer
control (using PDFViewCtrl.SetDoc(doc)).

This is shown in PDFViewSimple sample:
  http://www.pdftron.com/pdfnet/samplecode.html#PDFVIewSimple

For a code sample showing how to read and write PDFDoc to/from memory
buffer please see PDFDocMemory sample project:

byte[] buf = new byte[1];
int buf_sz = 1;
doc.Save(ref buf, ref buf_sz, SDFDoc.SaveOptions.e_remove_unused);