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, Int32) 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,
    int largestEdgeLength
)

#Parameters

Name Type Description
pageNumber Int32

The page number.

largestEdgeLength Int32

The length of the image’s largest dimension in pixels.

#Returns

Type Description
DXSvgImage

The converted page.

#Remarks

The largestEdgeLength parameter determines the output image height for pages in the portrait orientation, and width for landscape pages. The page is proportionally scaled so that the largest edge of the converted SVG is equal to the largestEdgeLength value.

Passing a smaller largestEdgeLength value to the CreateSvgImage method can reduce the output image size and memory consumption.

#Example

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

using DevExpress.Drawing;
using DevExpress.Pdf;

int largestEdgeLength = 1000;

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

    for (int i = 1; i <= processor.Document.Pages.Count; i++)
    {

        // Export pages to SVGs
        DXImage image = processor.CreateSvgImage(i, largestEdgeLength);

        // Save the images
        image.Save("..\\..\\MySvg" + i + ".svg", DXImageFormat.Svg);
    }
}
See Also