Example usage for com.itextpdf.text Version Version

List of usage examples for com.itextpdf.text Version Version

Introduction

In this page you can find the example usage for com.itextpdf.text Version Version.

Prototype

Version

Source Link

Usage

From source file:com.itextpdf.text.Version.java

public static Version getInstance()
/*     */ {//from w  w  w. j  av  a  2  s.  c om
    /*  94 */ if (version == null) {
        /*  95 */ version = new Version();
        /*     */ try {
            /*  97 */ Class klass = Class.forName("com.itextpdf.license.LicenseKey");
            /*  98 */ Method m = klass.getMethod("getLicenseeInfo", new Class[0]);
            /*  99 */ String[] info = (String[]) m.invoke(klass.newInstance(), new Object[0]);
            /* 100 */ if ((info[3] != null) && (info[3].trim().length() > 0)) {
                /* 101 */ version.key = info[3];
                /*     */ }
            /*     */ else {
                /* 104 */ version.key = "Trial version ";
                /* 105 */ if (info[5] == null) {
                    /* 106 */ version.key += "unauthorised";
                    /*     */ }
                /*     */ else {
                    /* 109 */ version.key += info[5];
                    /*     */ }
                /*     */ }
            /* 112 */ if ((info[4] != null) && (info[4].trim().length() > 0)) {
                /* 113 */ version.iTextVersion = info[4];
                /*     */ }
            /* 115 */ else if ((info[2] != null) && (info[2].trim().length() > 0))
            /*     */ {
                /*     */ Version tmp214_211 = version;
                tmp214_211.iTextVersion = (tmp214_211.iTextVersion + " (" + info[2]);
                /* 117 */ if (!version.key.toLowerCase().startsWith("trial")) {
                    /* 118 */ version.iTextVersion += "; licensed version)";
                    /*     */ }
                /*     */ else
                /*     */ {
                    /*     */ Version tmp296_293 = version;
                    tmp296_293.iTextVersion = (tmp296_293.iTextVersion + "; " + version.key + ")");
                    /*     */ }
                /*     */
                /*     */ }
            /* 125 */ else if ((info[0] != null) && (info[0].trim().length() > 0))
            /*     */ {
                /*     */ Version tmp359_356 = version;
                tmp359_356.iTextVersion = (tmp359_356.iTextVersion + " (" + info[0]);
                /* 127 */ if (!version.key.toLowerCase().startsWith("trial"))
                /*     */ {
                    /* 130 */ version.iTextVersion += "; licensed version)";
                    /*     */ }
                /*     */ else
                /*     */ {
                    /*     */ Version tmp441_438 = version;
                    tmp441_438.iTextVersion = (tmp441_438.iTextVersion + "; " + version.key + ")");
                    /*     */ }
                /*     */ }
            /*     */ else {
                /* 137 */ throw new Exception();
                /*     */ }
            /*     */ } catch (Exception e) {
            /* 140 */ version.iTextVersion += " (AGPL-version)";
            /*     */ }
        /*     */ }
    /* 143 */ return version;
    /*     */ }