Getting Started

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 http://bitmiracle.com/pdf-library/.

  2. Run the downloaded MSI file to install the package. It will install to "C:\Program Files\Docotic.Pdf\" by default.

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
    • Start Menu search box
      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 (versions 2005-2010 are supported). In this example I will use Visual Studio 2005. 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 list of the .NET assemblies.

    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

    CopyC#
    using BitMiracle.Docotic.Pdf;
    CopyVB.NET
    Imports BitMiracle.Docotic.Pdf
  4. Add the following method to your application source code

    CopyC#
    private void helloPdf()
    {
        // replace string.Empty with your license key
        BitMiracle.Docotic.LicenseManager.AddLicenseData(string.Empty);
    
        PdfDocument doc = new PdfDocument();
    
        // draws "Hello world" on the first page
        PdfPage firstPage = doc.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");
    
        doc.Save(outputName);
    
        // opens saved document in default PDF viewer
        System.Diagnostics.Process.Start(outputName);
    }
    CopyVB.NET
    Private Sub helloPdf()
        ' replace string.Empty with your license key
        BitMiracle.Docotic.LicenseManager.AddLicenseData(String.Empty)
    
        Dim doc As New PdfDocument()
    
        ' draws "Hello world" on the first page
        Dim firstPage As PdfPage = doc.Pages(0)
        firstPage.Canvas.DrawString(20, 20, "Hello, world!")
    
        Dim outputName As String = "hello.pdf"
        ' in ASP.NET application please use following line instead:
        ' Dim outputName As String = Server.MapPath("hello.pdf")
    
    
        doc.Save(outputName)
    
        ' 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 .