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 |
---|---|---|
page |
Int32 | The page number. |
largest |
Int32 | The length of the image’s largest dimension in pixels. |
#Returns
Type | Description |
---|---|
DXSvg |
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);
}
}