SkiaImageExportSettings
The SkiaImageFormatProvider offers the functionality to export PDF pages (RadFixedPage objects). The public ExportSettings property gives access to the SkiaImageExportSettings that gives you modification options and further fine-tuning.
Since the SkiaImageFormatProvider works with PDF pages (RadFixedPage), not a PDF document (RadFixedDocument), it is possible to export detached pages as well which are not associated with a particular PDF document. Hence, any document-related exception handling mechanism wouldn't be triggered in this case.
Setting | Description |
---|---|
IsAntialiased | Gets or sets a value indicating whether the image will be antialiased. |
ScaleFactor | Gets or sets a value indicating the scale factor of the image. |
ImageFormat | Gets or sets a value indicating the image format. The available options for the SkiaImageFormat are Jpeg, Png and Webp. |
Quality | Gets or sets a value indicating the image quality. The value range is 1 (lowest quality) to 100 (highest quality) inclusive. The default value is 75. |
As of Q3 2025 the SkiaImageExportSettings offers the DocumentUnhandledException event which allows you to handle exceptions while exporting a PDF page (RadFixedPage).
The example shows how you can create a SkiaImageExportSettings object with the desired settings and handle unexpected errors while exporting a PDF page (built from scratch) which is not associated with a document:
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:
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);
}