How to Start Convert PDF Read PDF Edit PDF PDF Report Builder Work with PDF Modules PDF Document PDF Pages Text Image Graph & Path Annotation, Markup & Drawing Redaction Security Digital Signature Forms Watermark Bookmark Link File Attachment File Metadata Printing Work with Other SDKs Barcode read Barcode create OCR Twain

C# PDF SVG Converter Library
How to convert PDF to SVG files using C#.net in ASP.NET MVC, Windows Forms application


Use C# to render & convert PDF to SVG. Free C# open source examples.





In this C#.NET tutorial, you will learn how to convert, export PDF pages or whole document to Scalable Vector Graphics (SVG) files. using C# PDF library in .NET Windows, ASP.NET web applications.

  • PDF file to SVG files conversion
  • Convert single PDF page to SVG web files
  • Fully compatible with moden web browser with Web Open Font Format (WOFF) generated.

How to convert PDF file to SVG web files programmatically using C#

  1. Download XDoc.PDF SVG conversion C# library
  2. Install C# library to convert Adobe PDF to SVG files
  3. Step by Step Tutorial












  • Best C#.NET PDF converter control for converting adobe PDF to SVG file in Visual Studio .NET project
  • Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint
  • Written in managed Visual C# code and compatible with .NET Framework 2.0 or above
  • 100% clean .NET solution for PDF to SVG conversion using .NET-compliant C# language
  • Easily define a PDF page from multi-page PDF document and convert it to SVG file using C#
  • Instantly convert all PDF document pages to SVG image files in C#.NET class application
  • You may also need convert csv to pdf c#, convert text file to pdf using c#, convert jpg to pdf c#, convert pdf to tiff c# free, c# code to save word document as pdf, pdf to image converter using c#, c# convert pdf to jpg.
  • Perform high-fidelity PDF to SVG conversion in both ASP.NET web and WinForms applications
  • Support converting PDF document to SVG image within C#.NET project without quality loss
  • C# sample code for quick integration in .NET framework program for exporting PDF from SVG


In some situations, it is quite necessary to convert PDF document into SVG image format. Here is a brief introduction to SVG image. SVG, short for scalable vector graphics, is a XML-based file format used to depict two-dimensional vector graphics. As SVG images are defined in XML text lines, they can be easily searched, indexed, scripted, and supported by most of the up to date web browsers. Therefore, in C#.NET web document viewing applications, PDF is often rendered and converted to SVG image for high fidelity viewing.





How to convert PDF file to SVG web files using C#.NET code?


The steps below and C#.NET example source code show how to convert a PDF document to SVG web files in C# application.

  1. Create a new PDFDocument object and load an existing PDF file to it.
  2. Use PDFDocument.ConvertToVectorImages() method to convert PDF page to SVG files.
    One PDF page will produce one SVG file. And other web resource files will be generated under some folders, such as web fonts (.woff), image files



            String inputFilePath = @"W:\Projects\Test-Files\file1.pdf";
            String outputFilePath = @"W:\Projects\Test-Output\RasterEdge.com\pdf-convert-pdf-to-svg\";

            PDFDocument doc = new PDFDocument(inputFilePath);
            doc.ConvertToVectorImages(ContextType.SVG, outputFilePath, "file1-", RelativeType.SVG);






PDF to SVG Converter Options


You will utilize method "PDFDocument.ConvertToVectorImages()" or "PDFPage.ConvertToVectorImage()" to convert multi-pages PDF file into SVG web files using C#.

You can define the output SVG and other web resource files through method ConvertToVectorImages parameters.


  1. The 1st parameter of the method MUST BE ContextType.SVG.

  2. Valid RelativeType for converting a document to SVG file(s).
    SVG: Output SVG file in the standard format.
    ASP: Output SVG file is compatible with ASP application.
    SVGEMBED: Embed all resource files to the output SVG file.
    SVGEMBEDIMG: Embed all image resource files to the SVG file.
    SVGEMBEDFONT: Embed all font resource files to the SVG file.
    MOSS: Output SVG file is compatible with SharePoint application.

  3. All font resource files required by the output SVG files are put in a folder (with folder name "font") in the same directory of those SVG files.

  4. All image resource files required by the output SVG files are put in a folder (with folder name "image") in the same directory of those SVG files.









How to convert a PDF page to SVG web files using C# code?


The steps below and C# sample source code show how to convert a single PDF page to SVG web files in C# application.

  1. Initialize a new PDFDocument object and load an existing PDF file to it.
  2. Get the first page of pdf document object
  3. Use PDFPage.ConvertToVectorImage() method to convert PDF page to SVG files.
    One PDF page will produce one SVG file with other web resource files, such as web fonts (.woff), image files



            String inputFilePath = @"W:\Projects\Test-Files\file1.pdf";
            String outputFilePath = @"W:\Projects\Test-Output\RasterEdge.com\pdf-convert-pdf-to-svg\";

            PDFDocument doc = new PDFDocument(inputFilePath);
            int pageIdx = 0; //first page
            PDFPage page = (PDFPage)doc.GetPage(pageIdx);
            page.ConvertToVectorImage(ContextType.SVG, outputFilePath, "file1-", RelativeType.SVG);






C# convert two or multiple pdf files to svg (batch convert)


        #region pdf to svg (batch files and single tread)
        internal static void pdfFilesToSvg()
        {
            String inputDirectory = @"C:\input\";
            String outputDirectory = @"C:\output\";
            String[] files = Directory.GetFiles(inputDirectory, "*.pdf");
            foreach (String filePath in files)
            {
                int startIdx = filePath.LastIndexOf("\\");
                int endIdx = filePath.LastIndexOf(".");
                String docName = filePath.Substring(startIdx + 1, endIdx - startIdx - 1);
                PDFDocument doc = new PDFDocument(filePath);
                doc.ConvertToVectorImages(ContextType.SVG, outputDirectory, docName, RelativeType.SVG);
            }
        }
        #endregion