This article explains some of the basics to get you up and running to process PDF files in your WinForms, console or ASP.NET applications with Docotic.Pdf library.

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.

Installing manually

  1. Download the latest release of the Docotic.Pdf library from our site. The library is distributed as a ZIP package.
    The ZIP package contains two versions of the library:
    • version for .NET 4.0 and later frameworks
    • version for .NET Standard 2.0 and later frameworks.

    The ZIP package also contains all sample projects, and the file with the license agreement.

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

Running samples

Docotic.Pdf samples are located 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.

The same sample code can be cloned or downloaded from our samples repository on GitHub.

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

Using Docotic.Pdf in your WinForms, console, or ASP.NET application

  1. Open Visual Studio IDE. Create a new project or open existing one.

  2. Open the Add Reference dialog and add a reference to BitMiracle.Docotic.Pdf.dll.

    • The Extensions list will contain the BitMiracle.Docotic.Pdf assembly if you did add the library to GAC
    • Alternatively, you can browse to the location where you extracted the ZIP package and pick the DLL from there.

Adding Docotic.Pdf using the Add Reference dialog

Please note that you can add a NuGet reference to BitMiracle.Docotic.Pdf instead of referencing its DLL manually.

To access methods and properties that provide interoperability with types from the System.Drawing namespace and GDI+ you would need to add a reference to the BitMiracle.Docotic.Pdf.Gdi extension DLL. You can find the DLL in the ZIP package or install BitMiracle.Docotic.Pdf.Gdi package from NuGet.

To convert HTML to PDF (or SVG to PDF) you would need to add a reference to the BitMiracle.Docotic.Pdf.HtmlToPdf extension DLL. The DLL is also in the ZIP package but we recommend to install the BitMiracle.Docotic.Pdf.HtmlToPdf package from NuGet instead of adding the DLL manually.

To create PDF documents using the layout engine, add the reference to the BitMiracle.Docotic.Pdf.Layout extension DLL. The engine automatically splits content to pages and provides support for page headers and footers, tables, and paragraphs. You can find the DLL in the ZIP package but we recommend to install the BitMiracle.Docotic.Pdf.Layout package from NuGet instead of adding the DLL manually.

  1. To avoid typing full references to the dll, it is best to add the following using statement to the already existing ones in your source file in C#
    using BitMiracle.Docotic.Pdf;

    In VB.NET use this:

    Imports BitMiracle.Docotic.Pdf
  2. 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,

For a VB.NET project use this

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
  1. 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


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 through the documentation accompanying the library and review samples. You might also want to check out the Bit Miracle blog.