Rasterize to Image using MemoryStream

How do I convert PDF pages to images using memorystream, without touching the file system

PDFs can be loading from MemoryStream. ( How-Tos | API Reference)

To export PDF pages as images, first use  PdfDocument.ToBitMap() to get an array of .NET bitmaps.

using IronPdf;
using System.Drawing; 

//Example rendering PDF documents to Images or Thumbnails
using var pdf = PdfDocument.FromFile("Example.pdf");

// or make one using Chrome Renderer
System.Drawing.Bitmap[] pageImages = pdf.ToBitmap();

foreach (var bitmap in pageImages)
    using (MemoryStream memoryStream = new MemoryStream())
        // save to PNG
        bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Png);

        // use memoryStream

Helpful Stack Overflow article.