
AI-Powered PDNob PDF Editor
Smarter, Faster, Easier PDF Editor Software
AI-Powered PDNob PDF Editor
Edit & enhance PDF with Al
I need to generate a PDF report in my C# application. Is PDFsharp a good choice for this?
If you're working with C# and need to create or modify PDF documents, you might have come across PDFsharp. This free, open-source .NET library is widely used for handling PDFs in C# applications. In this PDFsharp guide, we'll explore what PDFsharp is, how to install it, and how to use it to create and manipulate PDF files.
PDFsharp is a free, open-source .NET library written in C# for creating and processing PDF documents. It allows developers to generate PDFs from scratch, modify existing ones, and draw graphics, text, and images onto PDF pages. Whether you're building a report generator, an invoice system, or any application that requires PDF output, PDFsharp provides the necessary tools.
PDFsharp is licensed under the MIT License, which means you can use it freely in both personal and commercial projects without any licensing fees. This permissive license encourages wide adoption and contribution from the developer community.
Integrating PDFsharp into your C# project is straightforward, thanks to its availability via NuGet, the package manager for .NET.
Install-Package PDFsharp -Version 6.1.1
dotnet add package PDFsharp --version 6.1.1
After installation, you can start using PDFsharp by adding the necessary namespaces to your C# files:
using PDFsharp.PDF;
using PDFsharp.Drawing;
PDFsharp is compatible with various .NET versions, including:
This ensures that you can use PDFsharp in both modern .NET Core applications and older .NET Framework projects.
Depending on your application's requirements, you might choose between different builds of PDFsharp:
These builds provide tailored functionality to match the specific needs of different application types.
To create a PDF file in C#, we will use the PDFsharp library. Follow these steps to add a reference to the PDFsharp library in your project:
I need some help resolving an issue when converting an HTML invoice to PDF using PDFsharp and HtmlRenderer. The output PDF renders about 75% of the content correctly, but does not include the item lines (i.e., Description, Quantity, Unit Price, Extended), which are present in the original HTML invoice.
Please see the attached source HTML and output PDF for a visual comparison PDFsharp HTML to PDF.
PDFDocument PDF = PDFGenerator.GeneratePDF(html, PageSize.A4, 20, null, null, null);
PDF.Save(HttpContext.Current.Server.MapPath("~/export/" + _PDF_FILENAME_TO_CREATE));
While PDFsharp is a great tool for developers who want to create or edit PDFs through code, it may not be the best choice for everyday users or tasks that require manual adjustments. If you need to directly edit PDF content—like changing text, adding images, inserting watermarks, or converting files—then you'll benefit from using a dedicated PDF editor.
This is where Tenorshare PDNob becomes very useful. It's designed for all kinds of PDF tasks, offering over 100 editing tools. You can easily convert PDFs to Word, Excel, PowerPoint, and image formats.
Yes, it's free for both personal and commercial use under the MIT License.
Yes, starting from version 6.2.0. You can add digital PDFsharp signature to new or existing PDFs.
Yes, the Core build can be used on any OS supported by .NET, including web servers.
PDFsharp is developed by empira Software GmbH. It's open-source and accepts community contributions on GitHub.
It supports PDF versions 1.2 to 1.7 and 2.0. Most features of PDF 1.4 are fully supported, while some newer features are partially supported.
In this article, we explored what PDFsharp is and how to use it in C#. PDFsharp is a free and open-source library that makes it easy to create and manage PDF documents in .NET projects. You learned how to install PDFsharp, create PDFs from scratch, and even convert HTML to PDF using additional tools.
If you're looking for an easy way to edit and convert PDF documents outside of code, Tenorshare PDNob is a strong choice. It offers a full set of features for converting, editing, and protecting PDFs, all in a user-friendly interface.
PDNob PDF Editor Software- Smarter, Faster, Easier
I am PDNob.
Swift editing, efficiency first.
Make every second yours: Tackle any PDF task with ease.
As Leonardo da Vinci said, "Simplicity is the ultimate sophistication." That's why we built PDNob.
then write your review
Leave a Comment
Create your review for Tenorshare articles
By Jenefey Aaron
2025-05-27 / Knowledge