Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embed SVG into PDF programmatically in .NET C#

Tags:

c#

.net

pdf

svg

Does anyone know how to create a pdf with C# and add a SVG document inside of this PDF ?

itextsharp can't do it.

I convert SVG into image thanks to this library (http://svg.codeplex.com/) but I need to keep vectorial graphic because image is pixelised.

Anyone know a library to do it ?

Thanks,

like image 421
Dragouf Avatar asked Jul 01 '11 13:07

Dragouf


3 Answers

PrinceXML does a very good job of handling SVG, however, it is not completely free, meaning that the free version puts a small logo on the output PDF. You can find out more here: http://www.princexml.com/doc/7.0/svg/

PDFJet will allow you to create lines, circles, polygons, and other primitive drawing tools. You could create a class to parse your SVG and then draw the appropriate circles, arcs, lines, etc and use PDFJet to make the PDF. PDFJet can be downloaded here: http://pdfjet.com/os/edition.html

Other then that, I don't think there are many other options for what you are looking to do.

like image 128
Icemanind Avatar answered Nov 17 '22 11:11

Icemanind


PDFKit.NET3 can insert the SVG document into PDF, while preserving vectors.

like image 35
zavolokas Avatar answered Nov 17 '22 11:11

zavolokas


webSupergoo ABCpdf is also a good commercial option, a bit less pricey (ABCpdf Std costs $329, and ABCpdf Pro cost $479 if you want rendering or x64 support). Version 7 did a terrible job when handling SVG files (it could only load a small subset, often with issues), but I understand (haven't test it first hand) that version 8 (and now 9) greatly improved its SVG support by switching to the Gecko engine.

like image 1
Gabriel Garza Avatar answered Nov 17 '22 11:11

Gabriel Garza