Package com.inet.pdfc

Class PDFC


  • public class PDFC
    extends java.lang.Object
    Main entry point into i-net PDFC

    Example 1: "java -cp "java/inetcore.jar" com.inet.Start cmd c:\folder1 c:\folder2 -c c:\myconfig.xml"
    Compares all PDF files in the two folders which have the same name, using the configuration file to pre-configure PDFC.

    Example 2: "java -cp "java/inetcore.jar" com.inet.Start cmd c:\folder1\report1.pdf c:\folder2\report1.pdf"
    Compares the two PDF files, using the standard configuration settings.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      class  PDFC.ComparisonParameters
      This class gathers the configuration parameters to run a comparison, except the files to compare.
      protected static class  PDFC.PROP
      Enum of all known command line switches and options, along with their long and short for and info about their default value and whether they require a parameter
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected PDFC​(java.io.File original, java.io.File toCompare, java.util.Map<PDFC.PROP,​java.lang.String> props)
      Creates the command line executor
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static void activateLicense​(java.lang.String activationOrLicenseKey)
      This method activates an activation key or a license key.
      protected PDFComparer createComparer​(boolean setRetryFlag)
      Applies the parsed properties and creates the comparer
      static java.lang.String getVersion​(boolean appendBeta, boolean appendValidTime)
      Returns the current version of PDFC as a String in the format: MAJOR.MINOR.Build number
      static void main​(java.lang.String[] args)
      Starts i-net PDFC with the given arguments - either two folders or two files.
      static void requestAndSetTrialLicenseIfRequired()
      Deprecated.
      As of i-net PDFC 4.3, a trial license will automatically acquired if possible.
      protected void runComparison()
      Runs the comparison or executes the non-comparing command line arguments
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PDFC

        protected PDFC​(java.io.File original,
                       java.io.File toCompare,
                       java.util.Map<PDFC.PROP,​java.lang.String> props)
        Creates the command line executor
        Parameters:
        original - the original / first file to be compared, may be null
        toCompare - the new / second file to be compared, may be null
        props - the additional valid command line properties, may be null
        Since:
        3.5
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
                         throws java.util.InvalidPropertiesFormatException
        Starts i-net PDFC with the given arguments - either two folders or two files. Optionally you can set the location of the config.xml with "-c", if you does not use the default config.xml. With the argument "-i" you can specify, that an image with the differences will be created for each page of the PDF files. If the argument "-o" is specified, then an image for each compared page of the PDF files will be created. For request and activate a trial license is the argument -a. If missing a license it get an exit code 2.

        Example 1: new String[] { "c:\folder1", "c:\folder2", "-c c:\myconfig.xml" }
        Compares all PDF files in the two folders which have the same name, using the configuration file to pre-configure PDFC.

        Example 2: new String[] { "c:\folder1\report1.pdf", "c:\folder2\report1.pdf" }
        Compares the two PDF files, using the standard configuration settings.

        Parameters:
        args - arguments to start PDFC with - either two folders or two files, and optionally the "-c" and "-i" parameter.
        Throws:
        java.util.InvalidPropertiesFormatException - if the configuration file (config.xml) has a wrong format
        Since:
        1.0
      • runComparison

        protected void runComparison()
                              throws java.util.InvalidPropertiesFormatException
        Runs the comparison or executes the non-comparing command line arguments
        Throws:
        java.util.InvalidPropertiesFormatException - if the file is not a valid xml configuration file.
        Since:
        1.0
      • createComparer

        protected PDFComparer createComparer​(boolean setRetryFlag)
                                      throws java.lang.IllegalArgumentException,
                                             java.util.InvalidPropertiesFormatException
        Applies the parsed properties and creates the comparer
        Parameters:
        setRetryFlag - true to advice the comparer to set the ComparatorProperty.retryOnLowMemory flag
        Returns:
        the configured comparer
        Throws:
        java.lang.IllegalArgumentException - if the configuration file does not exist.
        java.util.InvalidPropertiesFormatException - if the file is not a valid xml configuration file.
        Since:
        1.0
      • getVersion

        public static java.lang.String getVersion​(boolean appendBeta,
                                                  boolean appendValidTime)
        Returns the current version of PDFC as a String in the format: MAJOR.MINOR.Build number
        Parameters:
        appendBeta - if true the word "BETA" will be appended in case of a beta version
        appendValidTime - if true, the expiration will be appended in case of a beta version
        Returns:
        the current version of PDFC
        Since:
        1.0
      • requestAndSetTrialLicenseIfRequired

        @Deprecated
        public static final void requestAndSetTrialLicenseIfRequired()
                                                              throws java.io.IOException,
                                                                     com.inet.pdfc.generator.InvalidLicenseException
        Deprecated.
        As of i-net PDFC 4.3, a trial license will automatically acquired if possible. If the automatic attempt is not successful, use activateLicense(String) to activate a license via API.
        This method will check for an valid, active license and request a trial license, if there is none. This request is blocking and will only return successfully if there was no trial license requested yet for this system and i-net PDFC version or, if the trial for this system and i-net PDFC version was requested within the last 30 days.
        NOTE: This method establishes a connection to the license server for i-net PDFC. It may block up until the HTTP connection timeout. Calling this method in a GUI thread is discouraged!
        Throws:
        java.io.IOException - thrown on connection or encryption errors
        com.inet.pdfc.generator.InvalidLicenseException - thrown in case there already is a purchased but expired license or, if a trial license was acquired but the trial period is expired
        Since:
        4.0
      • activateLicense

        public static final void activateLicense​(java.lang.String activationOrLicenseKey)
                                          throws java.io.IOException
        This method activates an activation key or a license key. The two types of key have a different purpose:
        • Activation key:
          Can be used on any system to set a license. The activation requires an active Internet connection and will bind the key to the current system.
        • License key
          A license key contains the license data and the system ID of the system it is valid for. So it does not require an Internet connection to activate, but it's only valid on one system.
        Please note that this method will block until it has finished.
        Parameters:
        activationOrLicenseKey - the activation or license key to be set
        Throws:
        java.io.IOException - thrown if an activation key was passed to the function but the connection to the license server could not be established
        com.inet.pdfc.generator.InvalidLicenseException - in case the activated license is invalid
        Since:
        4.0