188

Can you recomend any PDF API for C#. Free is the best, but I don't mind paying for it.

General Grievance
  • 4,555
  • 31
  • 31
  • 45
Sven
  • 1,935
  • 2
  • 13
  • 7
  • 4
    See [Creating pdf files at runtime in c#](http://stackoverflow.com/questions/465433/creating-pdf-files-at-runtime-in-c) – Matthew Flaschen May 30 '10 at 06:54
  • 2
    I would still suggest iText# only because even after paying you dont get nested tables and many features that iText# offers. – Akash Kava May 30 '10 at 07:01
  • For future references, you may want to check out [GemBox.Document](https://www.gemboxsoftware.com/document/overview) as well. It provides a simple and easy-to-use API, see the [document's content model](https://www.gemboxsoftware.com/document/help/html/Content_Model.htm). – Mario Z Jul 06 '17 at 07:30

3 Answers3

134

I used PdfSharp. It's free, open source and quite convenient to use, but I can't say whether it is the best or not, because I haven't really used anything else.

Community
  • 1
  • 1
n535
  • 4,983
  • 4
  • 23
  • 28
  • +1. This one has XML documentation, so I find it a lot easier to use than iTextSharp. However, I couldn't find an equivalent of iTextSharp's `PdfTextExtractor` in PdfSharp. – Sam Jun 20 '13 at 14:16
  • 28
    PdfSharp is a nice thing, it is licensed under MIT License. So you may use it for commercial purpose as well – Chris623 Feb 01 '14 at 10:01
  • 6
    Pdfsharp does to support right-to-left languages – EKanadily Sep 11 '15 at 17:34
  • is it crossplatform? anyone experienced on linux? – user557657 Apr 08 '20 at 15:26
  • 2
    https://github.com/empira/PDFsharp/issues/140 I'd like to use this library in a commercial capacity without modification, but am concerned that the presence of GPLv2 licenses in the SharpZipLib directory may annul the MIT license of this project. For example: https://github.com/empira/PDFsharp/blob/master/src/PdfSharp/SharpZipLib/SharpZipBaseException.cs – Alexander Egorov Mar 16 '21 at 08:52
  • @AlexanderEgorov Have you found out this? – Arie Mar 19 '21 at 22:00
  • @Arie Yes I am but may be this issue not actual any more – Alexander Egorov Mar 21 '21 at 05:08
  • @AlexanderEgorov so what was the status you find out free for commercial usage? – Arie Mar 22 '21 at 21:23
  • @Arie i dont know - i have no time to research now you can follow links provided and find it out – Alexander Egorov Mar 23 '21 at 12:58
  • I just switched to PDFSharp from iTextSharp and seen a 60-70% speed increase (what I was looking for.) It did take a bit more work tha iTextSharp to get the result I was looking for, but I can see how fine-grained the PDFSharp library is. – Ryan Brown Apr 11 '22 at 19:45
52

Update:

I'm not sure when or if the license changed for the iText# library, but it is licensed under AGPL which means it must be licensed if included with a closed-source product. The question does not (currently) require free or open-source libraries. One should always investigate the license type of any library used in a project.


I have used iText# with success in .NET C# 3.5; it is a port of the open source Java library for PDF generation and it's free.

There is a NuGet package available for iTextSharp version 5 and the official developer documentation, as well as C# examples, can be found at itextpdf.com

live2
  • 3,771
  • 2
  • 37
  • 46
JYelton
  • 35,664
  • 27
  • 132
  • 191
  • iTextSharp is really nice to work with. – Carles Company May 30 '10 at 07:44
  • 70
    Note that iText# is licensed under the AGPL. This means that if you include it in another program, that program must also be AGPL-licensed, __even if you offer it as a website/SaaS__. – shezi Jan 23 '13 at 15:47
  • 28
    You can still get the earlier LGPL version if you want to use the library commercially. It is available on NuGet - https://www.nuget.org/packages/iTextSharp-LGPL – Paul Hiles Sep 13 '13 at 14:30
  • 3
    iTextSharp requires a paid license if you intent to use it for anything useful, and also claims to have Java dependencies on their github page. – Kraang Prime Apr 05 '16 at 04:42
  • @shezi just wanted to thank you for your comment; Many folks tend to forget about this, and use it on comercial projects. This is a good point to keep in mind! Paul Hiles also made a really good suggestion. – Malavos Jun 21 '16 at 20:18
  • 4
    @shezi Woops. I made a question here on SO about iText, and as you can see, they answered me directly about the LGPL license, and how it can cause trouble on commercial projects. So, can't use that either. – Malavos Jun 24 '16 at 14:18
  • Not free anymore for closed projects. – DanKodi Aug 12 '17 at 01:32
  • As an alternative for iTextSharp for closed code projects you can try our [C# PDF Library IronPDF](https://ironpdf.com). It's not free, starting from $399 USD but will get you to an installed PDF solution very quickly and easily. – Stephanie Apr 26 '18 at 10:06
8

My work uses Winnovative's PDF generator (We've used it mainly to convert HTML to PDF, but you can generate it other ways as well)

Justin
  • 4,434
  • 4
  • 28
  • 37