Xceed PDF Library for .NET Documentation v1.0
Welcome to the Xceed PDF Library for .NET v1.0 / Getting Started / Licensing
In This Topic
    Licensing
    In This Topic

    In order to use the controls provided by this component in your application, the LicenseKey property of the Licenser class must be set with a valid license key, before any other method of the component is called. If you use an invalid or expired license key, fail to license the control altogether, or license it in the wrong place in your code, an exception will be thrown at run time (see the License Exception section below).

    A valid license key can be a registered license key, which is provided to you when you purchase the product(s), or a non-expired trial license key, if you are evaluating the component.


    Setting the LicenseKey Property

    We recommend that you set the LicenseKey property in the main entry point of the application. For example, C# users can set the LicenseKey property in the static main function. VB.NET users can set the LicenseKey property in the constructor of the main form or in the "Sub Main" procedure.

    Note that the key begins with "PDF" for PDF Library for .NET.

    C#
    Copy Code
    static void Main( string[] args )
    {
      Xceed.PdfLibrary.NET.Licenser.LicenseKey = "PDFXX-XXXXX-XXXXX-XXXX";
    
      PdfDocument pdfDocument = PdfDocument.Create( "MyPdf.pdf" );
      /* ... */
    }


    License Exception

    If an invalid or expired license key is used or if the LicenseKey property is omitted or set in the wrong place, an exception will be thrown at run time; however, depending on the Visual Studio exception debugging settings and the browser in which the application is run, it may be displayed in different ways.

    If something goes wrong, the first thing to verify is whether the LicenseKey property has been set to a valid license key.

    See Also