Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

PdfDocumentProcessor.CreateSvgImage(Int32, PdfPageRenderingParameters) Method

Exports a PDF page as an SVG image.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Docs.v24.2.dll

NuGet Package: DevExpress.Document.Processor

#Declaration

public DXSvgImage CreateSvgImage(
    int pageNumber,
    PdfPageRenderingParameters parameters
)

#Parameters

Name Type Description
pageNumber Int32

The page number.

parameters PdfPageRenderingParameters

An object that contains page rendering parameters.

#Returns

Type Description
DXSvgImage

The converted page.

#Remarks

This CreateBitmap method overload allows you to specify a DPI for an exported SVG image. Call the PdfPageRenderingParameters.CreateWithResolution(Single) method to create a new PdfPageRenderingParameters instance with the specified image DPI and pass it as the CreateSvgImage method parameter.

The following code snippet exports each page in a PDF as SVG images:

using DevExpress.Drawing;
using DevExpress.Pdf;


using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
    // Load a document
    processor.LoadDocument(@"Docs//Document.pdf");

    for (int i = 1; i <= processor.Document.Pages.Count; i++)
    {
        PdfPageRenderingParameters renderingParameters = PdfPageRenderingParameters.CreateWithResolution(72f);
        // Export pages to SVGs
        DXImage image = processor.CreateSvgImage(i, renderingParameters);

        using (var fileStream = File.Create("..\\..\\MySvg" + i + ".svg"))
        {
            // Save the images
            image.Save(fileStream, DXImageFormat.Svg);
        }
    }
}
See Also