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.

C# PDF Library

The library supports .NET 8, .NET 7, .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.

Regression tests 14,760 passed Total NuGet downloads 4,415,970

Docotic.Pdf comes with free and paid licenses. To try it, download zip 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 and its free Layout add-on to generate PDF documents in .NET Framework and .NET Core applications.

You can add page headers and footers, tables, paragraphs. Layout add-on will automatically split content to pages.

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.

    .Generate("table.pdf", doc => doc.Pages(page =>
        page.Content().Table(t =>
            t.Columns(c =>

            t.Header(h =>

            t.Cell().Text("Docotic.Pdf.Layout add-on");
            t.Cell().Text("Generate PDF");
            t.Cell().Text("Docotic.Pdf.HtmlToPdf add-on");
            t.Cell().Text("HTML to PDF");

        page.Footer().AlignCenter().Text(t => t.CurrentPageNumber());
Read more

After many years of working with an older PDF component it was time for an upgrade. We researched carefully to choose a new one. Eventually we settled on Docotic.pdf by BitMiracle. We use the BitMiracle Docotic.pdf component for producing and working with PDF documents in our products. This is a high quality, robust component. The component is well thought through and memory efficient. Performance is important to us as our apps are web-based.

Sergey and Vitaliy provide us with an excellent level of support. They are proactive in developing and supporting their product, and are always polite and professional. The BitMiracle GitHub repository contains a large library of examples to get you up and running quickly.

The component is very reasonably priced. I highly recommend this component. We have been able to fully replace the older Pdf component we were using with Docotic.pdf

Read more