Class ImageEnumerable
Inheritance
Namespace: PdfToSvg
Assembly: IronPdf.dll
Syntax
public class ImageEnumerable : Object
Extracting rasterized images from a PDF-to-SVG conversion pipeline becomes straightforward with ImageEnumerable, the lazy sequence that delivers Image objects one at a time or all at once. Rather than forcing every image into memory upfront, the class gives callers two consumption paths suited to different workloads.
GetEnumerator returns an IEnumerator<Image> so the sequence fits naturally into a foreach loop or any LINQ chain. This path is ideal when processing images one by one, for example writing each frame to disk as it arrives, without waiting for the full set to resolve. ToListAsync collects every Image into a List<Image> asynchronously, accepting an optional CancellationToken so long-running extractions can be cancelled cleanly. Use ToListAsync when downstream code needs random access to the full result, such as sorting pages by size or passing the collection to a batch renderer.
Because ImageEnumerable sits inside the PdfToSvg namespace, it integrates directly with the SVG-oriented extraction workflow that IronPDF exposes. The two members cover the two most common consumption patterns: streaming iteration and async bulk collection. Choosing between them depends on whether the caller needs early results or a complete, addressable list.
using IronPdf;
var pdf = PdfDocument.FromFile("report.pdf");
ImageEnumerable images = pdf.ToSvg().GetImages();
List<Image> allImages = await images.ToListAsync();
foreach (var img in allImages)
img.Save($"page_{allImages.IndexOf(img)}.png");For broader context on image and SVG extraction, see the IronPDF how-to guides and the PDF to SVG examples.
Methods
GetEnumerator()
Declaration
public IEnumerator<Image> GetEnumerator()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerator<Image> |
ToListAsync(CancellationToken)
Declaration
public Task<List<Image>> ToListAsync(CancellationToken cancellationToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Threading.CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.Collections.Generic.List<Image>> |