PDF library for C# and VB.NET

Docotic.Pdf is a high-performance C# PDF library for .NET. You can use it to create, read, and edit PDF documents in .NET Core, ASP.NET, Windows Forms, WPF, Xamarin, Blazor, Unity, and HoloLense applications.

The library supports .NET 6, .NET 5, .NET Standard / .NET Core, and .NET 4.x frameworks. You can use the library in .NET on Windows, Linux, macOS, Android, iOS, or in a cloud environment.

Docotic.Pdf provides an easy-to-use API. There is a large set of C# and VB.NET samples to help you integrate the SDK in your project quickly. Contact us to get a comprehensive answer within a few hours. You'll get the answer directly from developers.

Since the first release in 2010, we constantly improve quality of Docotic.Pdf and increase its feature set. The library is fast and its memory consumption is low even for large PDF documents. Our C# code is 100% managed without unsafe blocks, and has no external dependencies. To prevent regressions, we check each build of our PDF SDK with thousands of automatic tests. This allows us to provide you with production-quality builds as soon as the new build with fixes and improvements is ready.

Docotic.Pdf comes with free and paid licenses. To try it, download dll or install from NuGet.

Get free time-limited license

Enter your Name and Email address below to get a free license that removes the evaluation mode restrictions for 30 days.

Extract text from PDF document in C#

Use Docotic.Pdf library to convert PDF documents to text in .NET. You can extract formatted text to parse structured data like tables.

You can also read PDF text with detailed information (position, font, color) about every text chunk. That allows you to search text in PDF documents and highlight found phrases.

Docotic.Pdf supports right-to-left and bidirectional text. You can use it to extract Arabic, Hebrew, and Persian text from PDF documents in .NET.

using BitMiracle.Docotic.Pdf;

using (var pdf = new PdfDocument("your_document.pdf"))
    var options = new PdfTextExtractionOptions
        SkipInvisibleText = true,
        WithFormatting = true
    string formattedText = pdf.GetText(options);
Read more

Edit PDF documents in C#

Docotic.Pdf is a powerful .NET PDF editor. You can compress PDF documents. It is possible to remove content. For example, potentially insecure content like actions, attachments, controls.

You can also edit page objects - replace images, change colors, remove or replace text in PDF.

Docotic.Pdf SDK allows you to split and merge PDF documents in just a few lines of code. And you can remove or reorder pages. With help of the library it's possible to impose PDF pages.

using (var merged = new PdfDocument("first.pdf"))
    // copy third and first pages to a new PDF document
    using (PdfDocument splitted = pdf.CopyPages(new[] { 2, 0 }))

Convert PDF to images in C#

Our .NET PDF library allows you to save PDF pages as images. You can convert PDF pages to full size or thumbnail images in PNG, TIFF, and JPEG formats.

Or you can save PDF documents as multipage TIFF files. The library can produce bitonal and grayscale TIFF images.

It is also possible to print PDF documents in C# and VB.NET using Docotic.Pdf.

When needed, you can extract images from PDF documents.

using (var pdf = new PdfDocument(@"your_document.pdf"))
    PdfDrawOptions options = PdfDrawOptions.Create();
    options.BackgroundColor = new PdfRgbColor(255, 255, 255);
    options.HorizontalResolution = 300;
    options.VerticalResolution = 300;

    // save one page
    pdf.Pages[0].Save("page0.png", options);

    // save the whole document as multipage bitonal TIFF
    options.Compression = ImageCompressionOptions.CreateBitonalTiff();
    pdf.SaveAsTiff("your_document.tiff", options);
Read more

Convert HTML to PDF in C#

Generate PDF from HTML using the free HTML to PDF add-on for Docotic.Pdf library.

The add-on uses Chromium during conversion, so the web standards compliance is great. You can produce PDF documents from the most complex HTML documents with scripts and styles.

For produced PDFs, it is possible to set up page size, margins, and orientation. The conversion can be delayed if needed. It is possible to convert password-protected HTML documents and documents with SSL errors.

using (var converter = await HtmlConverter.CreateAsync())
    var options = new HtmlConversionOptions();

    options.Page.SetSize(PdfPaperSize.A5, isLandscape: true);
    options.Page.MarginTop = 50;
    options.Page.MarginBottom = 50;

    options.Start.SetStartAfterDelay(10 * 1000);

    options.Authentication.SetCredentials("name", "password");

    options.CustomUserAgent = "A user agent of your app";

    using (var pdf = await converter.CreatePdfAsync(url, options))
Read more

Fill PDF forms in C#

Docotic.Pdf provides friendly API to read, edit, and fill PDF forms in .NET applications.

You can also flatten PDF form fields.

And you can annotate PDF documents using our C# PDF library.

using (var pdf = new PdfDocument("form.pdf"))
    PdfControl field = pdf.GetControl("app_types");
    if (field?.Type == PdfWidgetType.TextBox)
        PdfTextBox tb = (PdfTextBox)field;
        tb.Text = "WinForms, WPF, ASP.NET Core, Blazor, Xamarin";

Related group of samples

Create PDF documents in C#

Use Docotic.Pdf to generate PDF documents in .NET Framework and .NET Core applications.

Add text, images, and vector graphics to your PDF files. You can also convert images to PDF documents.

Create interactive PDF documents with forms, annotations, bookmarks, and layers.

You can also sign PDF documents in C# and protect generated PDF files.

using (var pdf = new PdfDocument())
    PdfPage page = pdf.Pages[0];

    PdfCanvas canvas = page.Canvas;
    canvas.Font = pdf.AddFont(PdfBuiltInFont.TimesRoman);
    canvas.FontSize = 14;
    canvas.DrawString(10, 60, "Type:");

    PdfTextBox type = page.AddTextBox("type", 55, 60, 90, 20);
    type.Text = "C# PDF library";

    PdfImage image = pdf.AddImage("csharp.jpg");
    canvas.DrawImage(image, 10, 80);


I've used a lot of PDF libraries, but Docotic.Pdf gives me the best impression. I was surprised by his rich API and simple calling method, and even more surprised by his professionalism in detail. Yes, Docotic.Pdf has deep research on some details and stands out from many PDF libraries with similar functions.

At the same time, the support team is also very good. They can communicate directly with developers from a very professional perspective, which is very helpful to solve problems.

Read more