How do I convert PDF to a PNG without writing to disk?

Q: How do I render PDF to a PNG without writing to disk using PDFNet
( I can see that PDFDraw has Export()
method [e.g. as in],
however I would prefer to serialize PNG to memory instead of writing
it to a temporary file.

You could do so along the following lines:

public static byte[] GeneratePNGFFromPDF(byte[] pdfdata, int
      PDFNet.Initialize(); // really should be called only once in
App initialize.
      PDFDraw draw = new PDFDraw();
      PDFDoc doc = new PDFDoc(pdfdata, pdfdata.Length);
      Page pg = doc.GetPage(pPageNumber);
      Bitmap bitmap = draw.GetBitmap(pg);
      MemoryStream lStream = new MemoryStream();
      bitmap.Save(lStream, ImageFormat.Png);
      byte[] lResult = lStream.ToArray();
      return lResult;