foxjazz / pdftosvg.net

Fully managed .NET library for converting PDF files to SVG.

Home Page:https://pdftosvg.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PdfToSvg.NET Logo

Tests NuGet License MIT

PdfToSvg.NET

Fully managed library for converting PDF files to SVG. Potential usage is seamlessly embedding PDFs on your site without the need of a PDF reader.

πŸš€ Test it online    🏠 Homepage    πŸ“¦ NuGet package    πŸ“œ Release notes

Features

  • Extracts text and images from PDF files into SVG.
  • Supports .NET 5, .NET Core 1.0, .NET Standard 1.6, .NET Framework 4.0 and later.
  • Focus on producing compact SVG markup ready for the web.
  • Almost dependency free.

State

There are PDF features not yet implemented by this library. Before using it, please do rigorous testing of PDFs from the PDF producer you intend to convert, to ensure it does not use any features not supported by PdfToSvg.NET.

πŸ“– Read more about limitations

⚠️ New versions of the library might include breaking changes to the public API until version 1.0 is released.

Quick start

Install the PdfToSvg.NET NuGet package.

PM> Install-Package PdfToSvg.NET

Open a PDF document by calling PdfDocument.Open. Call SaveAsSvg() on each page to convert it to an SVG file.

using (var doc = PdfDocument.Open("input.pdf"))
{
    var pageNo = 1;

    foreach (var page in doc.Pages)
    {
        page.SaveAsSvg($"output-{pageNo++}.svg");
    }
}

Note that if you parse the XML returned from PdfToSvg.NET, you need to preserve space and not add indentation. Otherwise text will not be rendered correctly in the modified markup.

Issues

Did the conversion fail? Before reporting an issue, please read the documentaton about current limitations. If you believe it is a bug, ensure the PDF file causing problems is attached in the issue.

About

Fully managed .NET library for converting PDF files to SVG.

https://pdftosvg.net

License:MIT License


Languages

Language:C# 100.0%