# SkiaImageExportSettings

The [SkiaImageFormatProvider](https://www.telerik.com/document-processing-libraries/documentation/libraries/radpdfprocessing/formats-and-conversion/convert-to-image/using-image-format-provider) exports PDF pages ([RadFixedPage](https://www.telerik.com/document-processing-libraries/documentation/libraries/radpdfprocessing/model/radfixedpage) objects) to images. The `ExportSettings` property provides access to the `SkiaImageExportSettings` class, which allows you to control the output format, quality, scale, and antialiasing.

> important The `SkiaImageFormatProvider` works with PDF pages (`RadFixedPage`), not with a PDF document (`RadFixedDocument`). You can export detached pages that are not associated with a particular PDF document. In this case, any document-related [exception handling mechanism](https://www.telerik.com/document-processing-libraries/documentation/libraries/radpdfprocessing/features/handling-document-exceptions) is not triggered.

The following table lists the available settings:

| Setting         | Description                                                                                                                        |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `IsAntialiased` | Gets or sets a value indicating whether the image is antialiased.                                                                  |
| `ScaleFactor`   | Gets or sets the scale factor of the image.                                                                                        |
| `ImageFormat`   | Gets or sets the image format. The available options for `SkiaImageFormat` are `Jpeg`, `Png`, and `Webp`.                          |
| `Quality`       | Gets or sets the image quality. The value range is 1 (lowest quality) to 100 (highest quality) inclusive. The default value is 75. |

Starting with **Q3 2025**, `SkiaImageExportSettings` exposes the `DocumentUnhandledException` event, which allows you to handle exceptions while exporting a PDF page (`RadFixedPage`).

The following example demonstrates how to create a `SkiaImageExportSettings` object with custom settings and handle unexpected errors while exporting a PDF page (built from scratch) that is not associated with a document:

```C#
RadFixedPage page = new RadFixedPage();
TextFragment textFragment = page.Content.AddTextFragment("Document Processing Libraries");
SkiaImageFormatProvider imageProvider = new SkiaImageFormatProvider();
SkiaImageExportSettings settings = new SkiaImageExportSettings
{
    IsAntialiased = true,
    ScaleFactor = 2.0, // Adjust the scale factor as needed
    ImageFormat = SkiaImageFormat.Png, // Choose the desired image format
    Quality = 90 // Set the quality for lossy formats like JPEG
};
imageProvider.ExportSettings = settings;
settings.DocumentUnhandledException += (s, e) =>
{
    //Debug.WriteLine("The document is corrupted and cannot be exported: " + e.Exception.Message);
    e.Handled = true;
};
byte[] resultImage = imageProvider.Export(page, TimeSpan.FromSeconds(10));

File.WriteAllBytes("exportedPage.png", resultImage);
```

The next example shows how to import an existing PDF document, iterate all of its pages, and export each page to an image:

```C#
PdfFormatProvider pdfFormatProvider = new PdfFormatProvider();
RadFixedDocument fixedDocument = pdfFormatProvider.Import(File.ReadAllBytes("Sample.pdf"), TimeSpan.FromSeconds(10));
SkiaImageFormatProvider imageProvider = new SkiaImageFormatProvider();

imageProvider.ExportSettings.ImageFormat = SkiaImageFormat.Png;
imageProvider.ExportSettings.ScaleFactor = 0.5;
imageProvider.ExportSettings.Quality = 50;
imageProvider.ExportSettings.IsAntialiased = false;

int count = 1;
foreach (RadFixedPage page in fixedDocument.Pages)
{
    byte[] resultImage = imageProvider.Export(page, TimeSpan.FromSeconds(10));
    File.WriteAllBytes(@"C:\Temp\Page " + count++ + ".png", resultImage);
}
```

## See Also

* [SkiaImageFormatProvider](https://www.telerik.com/document-processing-libraries/documentation/libraries/radpdfprocessing/formats-and-conversion/convert-to-image/using-image-format-provider)
* [RadFixedPage](https://www.telerik.com/document-processing-libraries/documentation/libraries/radpdfprocessing/model/radfixedpage)
