Docotic.Pdf Library Help > Getting Started

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.

Setting up your environment

  1. Download the latest MSI release of the Docotic.Pdf library from our site. The MSI file contains two versions of the library, one for .NET 2.0 and later frameworks and another one for .NET 4.0 and later frameworks.

  2. Run the downloaded MSI file to install the package. It will install to "C:\Program Files (x86)\Docotic.Pdf\" by default. The .NET 2.0 version of the library will be installed to .NET2 subfolder of the install location.

Note Note

You can also download Docotic.Pdf library on NuGet.

Running samples

  1. After install is completed, Docotic.Pdf Samples application will be opened by default. Also, you can open Docotic.Pdf Samples yourselves using:

    • shortcut installed on your desktop or
    • Search charm (in Windows 8 and later) or
      Search charm
    • Start Menu search box (in Windows 7 and earlier)
      Start Menu
  2. Please take a time to review 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. Start Visual Studio IDE (2005 and higher versions are supported). In this example I will use Visual Studio 2013. Create a new project or open existing one.

  2. Add a reference to BitMiracle.Docotic.Pdf.dll by opening the Add Reference dialog and selecting the BitMiracle.Docotic.Pdf assembly from the Extensions list.

    For .NET 2.0, .NET 3.0 and .NET 3.5 projects use BitMiracle.Docotic.Pdf for .NET 2.0 and later assembly from the Extensions list.

    Add reference dialog

    When used in console application, Docotic.Pdf library may also require a reference to the System.Drawing assembly to be added.

  3. To avoid typing full references to the dll, it is best to add following using statement to the already existing ones in your source file

    C#
    using BitMiracle.Docotic.Pdf;
    VB
    Imports BitMiracle.Docotic.Pdf
  4. Add the following method to your application source code

    C#
    private static void helloPdf()
    {
        // replace string.Empty with your license key
        BitMiracle.Docotic.LicenseManager.AddLicenseData(string.Empty);
    
        using (PdfDocument pdf = new PdfDocument())
        {
            // draws "Hello world" on the first page
            PdfPage firstPage = pdf.Pages[0];
            firstPage.Canvas.DrawString(20, 20, "Hello world!");
    
            string outputName = "hello.pdf";
            // in ASP.NET application please use following line instead:
            // string outputName = Server.MapPath("hello.pdf");
    
            pdf.Save(outputName);
        }
    
        // opens saved document in default PDF viewer
        System.Diagnostics.Process.Start(outputName);
    }
    VB
    Private Shared Sub helloPdf()
        ' replace string.Empty with your license key
        BitMiracle.Docotic.LicenseManager.AddLicenseData(String.Empty)
    
        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!")
    
            Dim outputName As String = "hello.pdf"
            ' in ASP.NET application please use following line instead:
            ' string outputName = Server.MapPath("hello.pdf");
    
            pdf.Save(outputName)
        End Using
    
        ' opens saved document in default PDF viewer
        System.Diagnostics.Process.Start(outputName)
    End Sub
  5. Call helloPdf() method from your code. This should produce hello.pdf file and open it in default PDF viewer.

    Hello, PDF!

Conclusion

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 .