---
title: "SvgReader Constructor (String, SvgReaderSettings)"
canonical: https://www.graphicsmill.com/docs/gm/C_Aurigma_GraphicsMill_Codecs_SvgReader_ctor_2_afa45dc1.htm
product: "Graphics Mill"
---

# SvgReader Constructor (String, SvgReaderSettings)
 
Initializes a new instance of the [SvgReader](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_SvgReader.htm.md) class for the specified file, using the specified settings.
 
**Namespace:** [Aurigma.GraphicsMill.Codecs](https://www.graphicsmill.com/docs/gm/N_Aurigma_GraphicsMill_Codecs.htm.md)
 **Assembly:** Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
 
## Syntax
  
```csharp
public SvgReader(string fileName,SvgReaderSettings settings
)
```
 
### Parameters
 
 - fileName
     - Type: System.String
The path to the SVG file.

 - settings
     - Type: [Aurigma.GraphicsMill.Codecs.SvgReaderSettings](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_SvgReaderSettings.htm.md)
The settings used to read the file.
 
## Remarks
  
The reader copies the settings. Changes to settings after this call do not affect the reader.
 
The images that the SVG file references are loaded in this constructor. If [ResolveImage](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_SvgReaderSettings_ResolveImage.htm.md) throws an exception, this constructor throws it.
 
## Examples
  
```csharp
const string assetsPrefix = "assets/";
const string assetsFolder = @"Images";

var settings = new SvgReaderSettings();

// The SVG file refers to images in the "assets" folder, which is stored somewhere else.
settings.ResolveImage = args =>
{
    if (args.Href.StartsWith(assetsPrefix, StringComparison.OrdinalIgnoreCase))
    {
        var fileName = System.IO.Path.Combine(assetsFolder, args.Href.Substring(assetsPrefix.Length));

        // The reader takes the image when the property is set, so you can dispose the bitmap right away.
        using (var bitmap = new Bitmap(fileName))
        {
            args.Image = bitmap;
        }
    }

    // If you set neither Image nor GraphicsContainer, the image is loaded from the folder of the SVG file.
};

using (var reader = new SvgReader(@"Images\SvgWithImage.svg", settings))
using (var writer = ImageWriter.Create(@"Images\Output\SvgWithImage.png"))
{
    Pipeline.Run(reader + writer);
}
```
 
The SVG file rendered with the image that the callback loads.
 ![The SVG file rendered with the image that the callback loads.](https://www.graphicsmill.com/docs/gm/SvgReaderResolveImage.png)
 
## Exceptions
  
|  Exception |  Condition |
| --- | --- |
 |  System.ArgumentNullException |  The file name or the settings are `null`. |
   
## See Also

### Reference

- [SvgReader Class](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_SvgReader.htm.md)
- [SvgReader Overload](https://www.graphicsmill.com/docs/gm/O_T_Aurigma_GraphicsMill_Codecs_SvgReader_ctor.htm.md)
- [Aurigma.GraphicsMill.Codecs Namespace](https://www.graphicsmill.com/docs/gm/N_Aurigma_GraphicsMill_Codecs.htm.md)
