We've have demonstrated how to convert PDF page to SVG file format in the previous post. This guidance shows you how we can specify the width and height of output file using the latest version of Spire.PDF with C# and VB.NET.
Step 1: Load a sample PDF document to PdfDocument instance.
PdfDocument document = new PdfDocument(); document.LoadFromFile("pdf-sample.pdf");
Step 2: Specify the output file size through ConvertOptions.SetPdfToSvgOptions() method.
document.ConvertOptions.SetPdfToSvgOptions(800f, 1200f);
Step 3: Save PDF to SVG file format.
document.SaveToFile("result.svg", FileFormat.SVG);
Output:
Full Code:
[C#]
using Spire.Pdf; namespace ConvertPDFtoSVG { class Program { static void Main(string[] args) { PdfDocument document = new PdfDocument(); document.LoadFromFile("pdf-sample.pdf"); document.ConvertOptions.SetPdfToSvgOptions(800f, 1200f); document.SaveToFile("result.svg", FileFormat.SVG); } } }
[VB.NET]
Imports Spire.Pdf Namespace ConvertPDFtoSVG Class Program Private Shared Sub Main(args As String()) Dim document As New PdfDocument() document.LoadFromFile("pdf-sample.pdf") document.ConvertOptions.SetPdfToSvgOptions(800F, 1200F) document.SaveToFile("result.svg", FileFormat.SVG) End Sub End Class End Namespace