PdfDocumentProcessor.CreateSvgImage(Int32, PdfPageRenderingParameters) Method
In This Article
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 |
---|---|---|
page |
Int32 | The page number. |
parameters | Pdf |
An object that contains page rendering parameters. |
#Returns
Type | Description |
---|---|
DXSvg |
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