Class ImageResolver
Inheritance
Namespace: PdfToSvg
Assembly: IronPdf.dll
Syntax
public abstract class ImageResolver : Object
Controlling how embedded images are resolved during PDF-to-SVG conversion is the job ImageResolver handles. This abstract base class lets you decide whether raster images inside a PDF are written into the SVG output as inline data URLs or referenced by external paths, giving you precise control over file size and portability.
Two ready-made strategies ship as static properties. Default applies the library's standard resolution behavior, which is the right starting point for most conversions. DataUrl encodes every image as a Base64 data URL embedded directly in the SVG markup, producing a fully self-contained file that requires no external assets. When neither preset fits, you subclass ImageResolver via its protected constructor and override ResolveImageUrl, which receives an Image and a CancellationToken and must return the URL string to embed in the SVG element.
The CancellationToken parameter in ResolveImageUrl means long-running or network-backed resolvers can respond to cancellation cleanly, an important detail when converting large documents in a server context.
using IronPdf;
using PdfToSvg;
var pdf = PdfDocument.FromFile("report.pdf");
var options = new PdfToSvgOptions { ImageResolver = ImageResolver.DataUrl };
pdf.SaveAsSvg("report.svg", options);For a broader look at SVG export capabilities, see the IronPDF documentation and the PDF conversion how-to guides.
Constructors
ImageResolver()
Declaration
protected ImageResolver()
Properties
DataUrl
Declaration
public static ImageResolver DataUrl { get; }
Property Value
| Type | Description |
|---|---|
| ImageResolver |
Default
Declaration
public static ImageResolver Default { get; }
Property Value
| Type | Description |
|---|---|
| ImageResolver |
Methods
ResolveImageUrl(Image, CancellationToken)
Declaration
public abstract string ResolveImageUrl(Image image, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| Image | image | |
| System.Threading.CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| System.String |