Getting started

This article explains some basics to get you up and running to process PDF files in your .NET Core, ASP.NET, Windows Forms, WPF, Xamarin, Blazor, Unity, and HoloLense applications with Docotic.Pdf library.

Getting started with Docotic.Pdf

Installing the Docotic.Pdf library

Installing from NuGet

The easiest way to get started is to install the BitMiracle.Docotic.Pdf package from NuGet.

Please refer to this quickstart article if you are new to NuGet Manager.

Docotic.Pdf library 9.3.16887-dev Regression tests 14,635 passed Total NuGet downloads 4,075,269

Installing manually

Download the latest release of the Docotic.Pdf library from our site. We distribute the library as a ZIP package. The package contains the Docotic.Pdf library, all sample code projects, library add-ons, and license agreements.

Extract the downloaded ZIP package to a location of your choice.

In Visual Studio, open the Add Reference dialog, browse to the location where you extracted the ZIP package and pick the DLL from there. Adding Docotic.Pdf using the Add Reference

Running sample code

Code samples for Docotic.Pdf is in the Samples folder of the ZIP package. Open SamplesCSharp solution file if you want to use sample code written in C# language. For a VB.NET version, please open the SamplesVB.NET solution file.

You can clone or download the same code samples from our sample code repository on GitHub.

Please take a time to review the code samples. It should help you to add PDF processing features to your application.

Using Docotic.Pdf in your .NET project

To avoid typing fully qualified names of the types provided by the library, it is best to add the following using directive to your C# source file:

using BitMiracle.Docotic.Pdf;

In VB.NET use this:

Imports BitMiracle.Docotic.Pdf

In a C# project, add the following method to your application source code:

private static void helloPdf()
    // replace string.Empty with your license key

    string outputName = "hello.pdf";
    // in ASP.NET application please use following line instead:
    // string outputName = Server.MapPath("hello.pdf");

    using (PdfDocument pdf = new PdfDocument())
        // draws "Hello world" on the first page
        PdfPage firstPage = pdf.Pages[0];
        firstPage.Canvas.DrawString(20, 20, "Hello world!");


    // opens saved document in default PDF viewer
    System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo() {
        FileName = outputName,
        UseShellExecute = true,

In a VB.NET project, use the following code:

Private Shared Sub helloPdf()
    ' replace string.Empty with your license key

    Dim outputName As String = "hello.pdf"
    ' in ASP.NET application please use the following line instead:
    ' Dim outputName As String = Server.MapPath("hello.pdf")

    Using pdf As New PdfDocument()
        ' draws "Hello world" on the first page
        Dim firstPage As PdfPage = pdf.Pages(0)
        firstPage.Canvas.DrawString(20, 20, "Hello world!")

    End Using

    ' opens saved document in the default PDF viewer
        New ProcessStartInfo() With {
            .FileName = outputName,
            .UseShellExecute = True
End Sub

Call helloPdf method from your code. This should produce hello.pdf file and open it in your default PDF viewer.

hello.pdf in a default PDF viewer


You can extend the core functionality with free add-ons.

HtmlToPdf add-on

HTML to PDF add-on 9.3.16887-dev

Allows you to convert HTML to PDF (or SVG/WEBP to PDF). You can install the BitMiracle.Docotic.Pdf.HtmlToPdf package from NuGet. Or manually add references to the following DLLs from the ZIP package:

  • BitMiracle.Docotic.Pdf.dll
  • HtmlToPdf add-on/BitMiracle.Docotic.Pdf.HtmlToPdf.dll
  • HtmlToPdf add-on/Microsoft.Bcl.AsyncInterfaces.dll

Layout add-on

Layout add-on 9.3.16887-dev

Use the add-on to generate PDF documents from a design defined in code. Use building blocks like pages, containers, images, paragraphs of text and the like to create PDFs of any complexity.

The layout add-on automatically splits content to pages and provides support for page headers and footers, tables, and paragraphs. Install the BitMiracle.Docotic.Pdf.Layout package from NuGet. Or manually add references to the following DLLs from the ZIP package:

  • BitMiracle.Docotic.Pdf.dll
  • Layout add-on/BitMiracle.Docotic.Pdf.Layout.dll

Gdi add-on

GDI add-on 9.3.16887-dev

Allows you to print PDF documents or draw PDF on System.Drawing.Graphics. You can install the BitMiracle.Docotic.Pdf.Gdi package from NuGet. Or manually add references to the following DLLs from the ZIP package:

  • BitMiracle.Docotic.Pdf.dll
  • Gdi add-on/BitMiracle.Docotic.Pdf.Gdi.dll

Logging add-on

Logging add-on 9.3.16887-dev

You can use it to log information about internal structure of PDF documents. Install the BitMiracle.Docotic.Pdf.Logging package from NuGet. Or manually add references to the following DLLs from the ZIP package:

  • BitMiracle.Docotic.Pdf.dll
  • Logging add-on/BitMiracle.Docotic.Pdf.Logging.dll
  • Logging add-on/Microsoft.Extensions.Logging.Abstractions.dll


Now you should be able to develop PDF-related features in your applications using Docotic.Pdf library. This is only the beginning, however. We encourage you to read about the features of the library and review code samples. You might also want to check out the Bit Miracle blog.