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
- 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.
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
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.
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.