java.lang.Object | |
↳ | com.pspdfkit.PSPDFKit |
Main PSPDFKit entry point. Use initialize(Context, String)
to initialize the library if
you are not using the PdfActivity
or the PdfFragment
(which handle initialization
on their own).
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | VERSION | String version of PSPDFKit library. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
static boolean |
addAnalyticsClient(AnalyticsClient client)
Add a
AnalyticsClient to receive analytics events from PSPDFKit. | ||||||||||
static void |
clearCaches(Context context, boolean clearDiskCache)
Clears pageBitmap memory cache to free memory.
| ||||||||||
synchronized static void |
ensureInitialized()
Checks if PSPDFKit is initialized or throws
PSPDFKitNotInitializedException if not. | ||||||||||
static ApplicationPolicy |
getApplicationPolicy()
Returns application policy.
| ||||||||||
synchronized static EnumSet<LicenseFeature> |
getLicenseFeatures()
Gets all the
LicenseFeature that are enabled with the current license. | ||||||||||
synchronized static FontManager |
getSystemFontManager()
Returns The
FontManager giving you access to the system fonts. | ||||||||||
synchronized static void |
initialize(Context context, String licenseKey, ApplicationPolicy applicationPolicy)
Initializes PSPDFKit with a license key and a specific application policy.
| ||||||||||
synchronized static void |
initialize(Context context, String licenseKey, List<String> fontPaths)
Initializes PSPDFKit with a license key.
| ||||||||||
synchronized static void |
initialize(Context context, String licenseKey)
Initializes PSPDFKit with a license key.
| ||||||||||
synchronized static void |
initialize(Context context, String licenseKey, ApplicationPolicy applicationPolicy, List<String> fontPaths)
Initializes PSPDFKit with a license key and a specific application policy.
| ||||||||||
synchronized static void |
initialize(Context context, String licenseKey, List<String> fontPaths, String hybridTechnology)
Initializes PSPDFKit with a license key.
| ||||||||||
synchronized static boolean |
isInitialized()
Returns
true if PSPDFKit is initialized and ready to use. | ||||||||||
static boolean |
isLocalFileUri(Context context, Uri uri)
Checks whether or not PSPDFKit can extract a local filesystem path from the
uri . | ||||||||||
static boolean |
isOpenableUri(Context context, Uri uri)
PSPDFKit can only open URIs from content providers that also provide size information.
| ||||||||||
synchronized static void |
release(Context context)
Releases PSPDFKit library and all associated caches from memory.
| ||||||||||
static boolean |
removeAnalyticsClient(AnalyticsClient client)
Remove a previously added
AnalyticsClient from PSPDFKit. | ||||||||||
static void |
setApplicationPolicy(ApplicationPolicy applicationPolicy)
Sets application policy for the loaded library.
| ||||||||||
static void |
setLocalizationListener(LocalizationListener localizationListener)
Sets a new
LocalizationListener to help with localizing SDK framework strings. | ||||||||||
static void |
setNativeCrashDumpPath(String path)
Sets a directory into which native code minidumps will be stored for debugging of native
crashes.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
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.
client | An AnalyticsClient to add. |
---|
true
if the client was successfully added, otherwise false
.
Clears pageBitmap memory cache to free memory.
context | Application context. |
---|---|
clearDiskCache | Clear disk cache as well. |
Checks if PSPDFKit is initialized or throws PSPDFKitNotInitializedException
if not.
Returns application policy. If not set, defaults to DefaultApplicationPolicy
.
Gets all the LicenseFeature
that are enabled with the current license.
LicenseFeature
that are currently enabled or an empty set if
PSPDFKit was not initialized yet.
Returns The FontManager
giving you access to the system fonts.
Initializes PSPDFKit with a license key and a specific application policy. 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 PdfFragment
, PdfActivity
or PdfActivity
.
context | Application context. |
---|---|
licenseKey | PSPDFKit license key or null for trial. |
applicationPolicy | Application policy. |
InvalidPSPDFKitLicenseException | If license is not valid for this app. |
---|---|
PSPDFKitInitializationFailedException | If current device isn't compatible with PSPDFKit (e.g. Android < 5.0 or wrong ABI) or if some other error occurred. |
MissingDependencyException | If RxAndroid or RxJava dependencies are missing in the containing app. |
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 PdfFragment
, PdfActivity
or PdfActivity
.
context | Application context. |
---|---|
licenseKey | PSPDFKit license key or null for trial. |
fontPaths | Additional paths to lookup fonts. |
InvalidPSPDFKitLicenseException | If license is not valid for this app. |
---|---|
PSPDFKitInitializationFailedException | If current device isn't compatible with PSPDFKit (e.g. Android < 5.0 or wrong ABI) or if some other error occurred. |
MissingDependencyException | If RxAndroid or RxJava dependencies are missing in the containing app. |
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 PdfFragment
, PdfActivity
or PdfActivity
.
context | Application context. |
---|---|
licenseKey | PSPDFKit license key or null for trial. |
InvalidPSPDFKitLicenseException | If license is not valid for this app. |
---|---|
PSPDFKitInitializationFailedException | If current device isn't compatible with PSPDFKit (e.g. Android < 5.0 or wrong ABI) or if some other error occurred. |
MissingDependencyException | If RxAndroid or RxJava dependencies are missing in the containing app. |
Initializes PSPDFKit with a license key and a specific application policy. 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 PdfFragment
, PdfActivity
or PdfActivity
.
context | Application context. |
---|---|
licenseKey | PSPDFKit license key or null for trial. |
applicationPolicy | Application policy. |
fontPaths | Additional paths used to lookup fonts. |
InvalidPSPDFKitLicenseException | If license is not valid for this app. |
---|---|
PSPDFKitInitializationFailedException | If current device isn't compatible with PSPDFKit (e.g. Android < 5.0 or wrong ABI) or if some other error occurred. |
MissingDependencyException | If RxAndroid or RxJava dependencies are missing in the containing app. |
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 PdfFragment
, PdfActivity
or PdfActivity
.
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. |
InvalidPSPDFKitLicenseException | If license is not valid for this app. |
---|---|
PSPDFKitInitializationFailedException | If current device isn't compatible with PSPDFKit (e.g. Android < 5.0 or wrong ABI) or if some other error occurred. |
MissingDependencyException | If RxAndroid or RxJava dependencies are missing in the containing app. |
Returns true
if PSPDFKit is initialized and ready to use.
true
if PSPDFKit was initialized.
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(Context, Uri)
to check whether PSPDFKit can still use the uri
for
document access.
context | Context for analyzing the uri. |
---|---|
uri | Uri pointing to a PDF document. |
true
if PSPDFKit can access the file directly, or false
if it needs
to use a content resolver for access.
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.
context | Application context. |
---|---|
uri | Android file URI. |
true
if the document can be directly opened.
Releases PSPDFKit library and all associated caches from memory.
BE WARNED: After this call all existing PdfDocument
instances WILL be
invalid and calling methods on them will result in a crash.
context | Application context. |
---|
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.
client | An AnalyticsClient to remove. |
---|
true
if the client was successfully removed, otherwise false
.
Sets application policy for the loaded library. Make sure the library is initialized before calling this method.
applicationPolicy | New policy to be set. |
---|
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.
localizationListener | new localization listener. |
---|
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.
path | Path for native crash dumps, must be writable. |
---|