Package com.pspdfkit

Object PSPDFKit

    • Constructor Detail

    • Method Detail

      • initialize

        @Synchronized() final static Unit initialize(Context context, String licenseKey)

        Helper for the main initialise method. Useful if you only want to initialise with a license key and want to leave other options as default.

        Parameters:
        context - Application context.
        licenseKey - A valid PSPDFKit license key.
      • initialize

        @Deprecated(message = "v2024.2: Will be removed in 2025.", replaceWith = @ReplaceWith(imports = {}, expression = "initialize(context, options: InitializationOptions?)"))@Synchronized() final static Unit initialize(Context context, String licenseKey, List<String> fontPaths, String hybridTechnology)

        Initializes PSPDFKit with a license key. This must be called before any other call to methods in this class.

        This method can safely be called multiple times and is not needed when using com.pspdfkit.ui.PdfFragment or com.pspdfkit.ui.PdfActivity.

        Parameters:
        context - Application context.
        licenseKey - PSPDFKit license key or null for trial.
        fontPaths - Additional paths to lookup fonts.
        hybridTechnology - Specifies the Hybrid technology where PSPDFKit is supposed to be working on, or null if PSPDFKit runs in a native Android project.
      • initialize

        @Deprecated(message = "v2024.2: Will be removed in 2025.", replaceWith = @ReplaceWith(imports = {}, expression = "initialize(context, options: InitializationOptions?)"))@Synchronized() final static Unit initialize(Context context, String licenseKey, List<String> fontPaths)

        Initializes PSPDFKit with a license key. This must be called before any other call to methods in this class.

        Parameters:
        context - Application context.
        licenseKey - PSPDFKit license key or null for trial.
        fontPaths - Additional paths to lookup fonts.
      • initialize

        @Deprecated(message = "v2024.2: Will be removed in 2025.", replaceWith = @ReplaceWith(imports = {}, expression = "initialize(context, options: InitializationOptions?)"))@Synchronized() final static Unit initialize(Context context, String licenseKey, ApplicationPolicy applicationPolicy)

        Initializes PSPDFKit with a license key and a specific application policy. This must be called before any other call to methods in this class.

        Parameters:
        context - Application context.
        licenseKey - PSPDFKit license key or nullfor trial.
        applicationPolicy - Application policy.
      • initialize

        @Deprecated(message = "v2024.2: Will be removed in 2025.", replaceWith = @ReplaceWith(imports = {}, expression = "initialize(context, options: InitializationOptions?)"))@Synchronized() final static Unit initialize(Context context, String licenseKey, ApplicationPolicy applicationPolicy, List<String> fontPaths)

        Initializes PSPDFKit with a license key and a specific application policy. This must be called before any other call to methods in this class.

        Parameters:
        context - Application context.
        licenseKey - PSPDFKit license key or null for trial.
        applicationPolicy - Application policy.
        fontPaths - Additional paths used to lookup fonts.
      • clearCaches

        @Deprecated(message = "v2024.2: Will be removed in a future release.", replaceWith = @ReplaceWith(imports = {"com.pspdfkit.PSPDFKit.clearCaches"}, expression = "clearCaches()")) final static Unit clearCaches(Context context, Boolean clearDiskCache)

        Clears pageBitmap memory cache to free memory.

        Parameters:
        context - Application context.
        clearDiskCache - Clear disk cache as well.
      • clearCaches

         final static Unit clearCaches()

        Clears pageBitmap memory cache to free memory.

      • release

        @Deprecated(message = "v2024.2: Will be removed in a future release.", replaceWith = @ReplaceWith(imports = {}, expression = "release()")) final static Unit release(Context context)

        Releases PSPDFKit library and all associated caches from memory.

      • isLocalFileUri

         final Boolean isLocalFileUri(Context context, Uri uri)

        Checks whether or not PSPDFKit can extract a local filesystem path from the uri. If this method returns true PSPDFKit can directly access the document on the filesystem, and can thus achieve faster loading speeds. If the method returns false, use .isOpenableUri to check whether PSPDFKit can still use the uri for document access.

        Parameters:
        context - Context for analyzing the uri.
        uri - Uri pointing to a PDF document.
        Returns:

        true if PSPDFKit can access the file directly, or false if it needs to use a content resolver for access.

      • isOpenableUri

         final static Boolean isOpenableUri(Context context, Uri uri)

        PSPDFKit can only open URIs from content providers that also provide size information. This determines if the document is openable directly from that URI. Note that this will not check if file actually exists.

        Parameters:
        context - Application context.
        uri - Android file URI.
        Returns:

        true if the document can be directly opened.

      • isInitialized

         final static Boolean isInitialized()

        Returns true if PSPDFKit is initialized and ready to use.

        Returns:

        true if PSPDFKit was initialized.

      • addAnalyticsClient

         final static Boolean addAnalyticsClient(AnalyticsClient client)

        Add a AnalyticsClient to receive analytics events from PSPDFKit. This method will return true if the client was successfully added, or false if it was not added. Usually this happens if the client has already been added previously.

        Parameters:
        client - An AnalyticsClient to add.
        Returns:

        true if the client was successfully added, otherwise false.

      • removeAnalyticsClient

         final Boolean removeAnalyticsClient(AnalyticsClient client)

        Remove a previously added AnalyticsClient from PSPDFKit. This method will return true if the client was successfully removed, or false if it was not removed. This usually happens if the client was not registered previously.

        Parameters:
        client - An AnalyticsClient to remove.
        Returns:

        true if the client was successfully removed, otherwise false.

      • setNativeCrashDumpPath

         final Unit setNativeCrashDumpPath(String path)

        Sets a directory into which native code minidumps will be stored for debugging of native crashes. T he minidumps are stored in Google Breakpad format.

        Parameters:
        path - Path for native crash dumps, must be writable.
      • setLocalizationListener

         final Unit setLocalizationListener(LocalizationListener localizationListener)

        Sets a new LocalizationListener to help with localizing SDK framework strings. WARNING: The localization listener is retained globally, so make sure it does not refer to any Activity context or it WILL leak memory.

        Parameters:
        localizationListener - new localization listener.
      • setApplicationPolicy

         final static Unit setApplicationPolicy(ApplicationPolicy applicationPolicy)

        Sets application policy for the loaded library. Make sure the library is initialized before calling this method.

        Parameters:
        applicationPolicy - New policy to be set.