com.groupdocs.viewer

Class License



  • public class License
    extends Object

    Provides methods to license the component. Learn more about licensing <a href="https://purchase.groupdocs.com/faqs/licensing">here</a>.

    • Constructor Detail

      • License

        public License()
    • Method Detail

      • setLicense

        public final void setLicense(InputStream licenseStream)

        Licenses the component.

        Note:
        The following example demonstrates how to set a license passing InputStream of the license file.

        Example:

         FileInputStream licenseStream = new FileInputStream("LicenseFile.lic");
         License license = new License();
         license.setLicense(licenseStream);
         

        Parameters:
        licenseStream - The license stream.
      • setLicense

        public final void setLicense(String licensePath)

        Licenses the component.

        Example:
        The following example demonstrates how to set a license passing a path to the license file.

         String licensePath = "GroupDocs.Viewer.lic";
         License license = new License();
         license.setLicense(licensePath);
         

         string licensePath = "GroupDocs.Viewer.lic";
         GroupDocs.Viewer.License license = new GroupDocs.Viewer.License();
         lic.setLicense(licensePath);
         

        Parameters:
        licensePath - The license file path.
        Throws:
        IllegalArgumentException - licensePath is a zero-length string, contains only white space, or contains one or more invalid characters as defined by F:System.IO.Path.InvalidPathChars.
        IllegalArgumentException - licensePath is null.
        GroupDocsViewerException - The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.
        com.groupdocs.viewer.exception.FileNotFoundException - The specified path is invalid, (for example, it is on an unmapped drive). licensePath specified a directory.-or- The caller does not have the required permission.
        com.groupdocs.viewer.exception.FileNotFoundException - The file specified in licensePath was not found.
        UnsupportedOperationException - licensePath is in an invalid format.