# Library Class

> Used to create a new instance of a library object or change properties.

- Product: Adobe PDF Library 18
- Language: Java
- Version: APDFL18.0.5PlusP2e
- HTML page: https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Library
- Version index: https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/llms.txt

```java
class Library
```

**Namespace:** `com::datalogics::PDFL`

## Description

Used to create a new instance of a library object or change properties. A Library object can be used to create a new instance of a library or change the properties of an existing library.

**Uses types:** [`LogParams`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/LogParams.md)

## Constructors

### Library

```java
com.datalogics.PDFL.Library.Library()
```

*constructor*

Initialize the PDF Library on this thread. Note that each thread needs its own instance of the library.

Multiple Library objects can be created on a thread, but they all refer to the same underlying instantiation of the library.

### Library

```java
com.datalogics.PDFL.Library.Library(java.util.EnumSet< LibraryFlags > flags)
```

*constructor*

**Parameters**

- `flags` (`java.util.EnumSet< LibraryFlags >`): PDF Library initialization flags, optional

Initialize the PDF Library on this thread. Note that each thread needs its own instance of the library.

Multiple Library objects can be created on a thread, but they all refer to the same underlying instantiation of the library.

### Library

```java
com.datalogics.PDFL.Library.Library(java.util.List< String > fontPaths)
```

*constructor*

**Parameters**

- `fontPaths` (`java.util.List< String >`): list of directories to search for fonts

Initialize the PDF Library on this thread. Note that each thread needs its own instance of the library.

Multiple Library objects can be created on a thread, but they all refer to the same underlying instantiation of the library.

### Library

```java
com.datalogics.PDFL.Library.Library(java.util.List< String > fontPaths, java.util.EnumSet< LibraryFlags > flags)
```

*constructor*

**Parameters**

- `fontPaths` (`java.util.List< String >`): list of directories to search for fonts
- `flags` (`java.util.EnumSet< LibraryFlags >`): PDF Library initialization flags, optional

Initialize the PDF Library on this thread. Note that each thread needs its own instance of the library.

Multiple Library objects can be created on a thread, but they all refer to the same underlying instantiation of the library.

### Library

```java
com.datalogics.PDFL.Library.Library(java.util.List< String > fontPaths, String CMapPath, String UnicodePath, java.util.EnumSet< LibraryFlags > flags)
```

*constructor*

**Parameters**

- `fontPaths` (`java.util.List< String >`): list of directories to search for fonts
- `CMapPath` (`String`): directory to search for CMap files (pass an empty string to use the default)
- `UnicodePath` (`String`): directory to search for Unicode mapping files (pass an empty string to use the default)
- `flags` (`java.util.EnumSet< LibraryFlags >`): PDF Library initialization flags, optional

Initialize the PDF Library on this thread. Note that each thread needs its own instance of the library.

Multiple Library objects can be created on a thread, but they all refer to the same underlying instantiation of the library.

### Library

```java
com.datalogics.PDFL.Library.Library(java.util.List< String > fontPaths, String CMapPath, String UnicodePath, String ColorProfilePath, java.util.EnumSet< LibraryFlags > flags)
```

*constructor*

**Parameters**

- `fontPaths` (`java.util.List< String >`): list of directories to search for fonts
- `CMapPath` (`String`): directory to search for CMap files (pass an empty string to use the default)
- `UnicodePath` (`String`): directory to search for Unicode mapping files (pass an empty string to use the default)
- `ColorProfilePath` (`String`): directory to search for Color Profile files (pass an empty string to use the default)
- `flags` (`java.util.EnumSet< LibraryFlags >`): PDF Library initialization flags, optional

Initialize the PDF Library on this thread. Note that each thread needs its own instance of the library.

Multiple Library objects can be created on a thread, but they all refer to the same underlying instantiation of the library.

### Library

```java
com.datalogics.PDFL.Library.Library(String[] fontPaths)
```

*constructor*

**Parameters**

- `fontPaths` (`String[]`): list of directories to search for fonts

Initialize the PDF Library on this thread. Note that each thread needs its own instance of the library.

Multiple Library objects can be created on a thread, but they all refer to the same underlying instantiation of the library.

### Library

```java
com.datalogics.PDFL.Library.Library(String[] fontPaths, java.util.EnumSet< LibraryFlags > flags)
```

*constructor*

**Parameters**

- `fontPaths` (`String[]`): list of directories to search for fonts
- `flags` (`java.util.EnumSet< LibraryFlags >`): PDF Library initialization flags, optional

Initialize the PDF Library on this thread. Note that each thread needs its own instance of the library.

Multiple Library objects can be created on a thread, but they all refer to the same underlying instantiation of the library.

## Methods

### changeWorkingSpaceCMYK

```java
void com.datalogics.PDFL.Library.changeWorkingSpaceCMYK(ColorProfile colorProfile)
```

**Parameters**

- `colorProfile` (`ColorProfile`): The Color Profile to be used.

**Returns:** `void`

Sets the current CMYK working space to the specified ICC profile.

### changeWorkingSpaceCMYK

```java
void com.datalogics.PDFL.Library.changeWorkingSpaceCMYK(String profilePath)
```

**Parameters**

- `profilePath` (`String`): The path on disk of the Color Profile to be used.

**Returns:** `void`

Sets the current CMYK working space to the specified ICC profile.

### changeWorkingSpaceGray

```java
void com.datalogics.PDFL.Library.changeWorkingSpaceGray(ColorProfile colorProfile)
```

**Parameters**

- `colorProfile` (`ColorProfile`): The Color Profile to be used.

**Returns:** `void`

Sets the current Gray working space to the specified ICC profile.

### changeWorkingSpaceGray

```java
void com.datalogics.PDFL.Library.changeWorkingSpaceGray(String profilePath)
```

**Parameters**

- `profilePath` (`String`): The path on disk of the Color Profile to be used.

**Returns:** `void`

Sets the current Gray working space to the specified ICC profile.

### changeWorkingSpaceRGB

```java
void com.datalogics.PDFL.Library.changeWorkingSpaceRGB(ColorProfile colorProfile)
```

**Parameters**

- `colorProfile` (`ColorProfile`): The Color Profile to be used.

**Returns:** `void`

Sets the current RGB working space to the specified ICC profile.

### changeWorkingSpaceRGB

```java
void com.datalogics.PDFL.Library.changeWorkingSpaceRGB(String profilePath)
```

**Parameters**

- `profilePath` (`String`): The path on disk of the Color Profile to be used.

**Returns:** `void`

Sets the current RGB working space to the specified ICC profile.

### delete

```java
synchronized void com.datalogics.PDFL.Library.delete(Boolean disposing)
```

*protected*

**Parameters**

- `disposing` (`Boolean`)

**Returns:** `synchronized void`

### delete

```java
synchronized void com.datalogics.PDFL.Library.delete()
```

**Returns:** `synchronized void`

Destroy this handle to the PDF Library. Also terminate the library if this is the last Library object on this thread.

### enableLicensedBehavior

```java
static boolean com.datalogics.PDFL.Library.enableLicensedBehavior(String arg0)
```

*static*

**Parameters**

- `arg0` (`String`): A base64-encoded string containing the encrypted license key.

**Returns:** `boolean`

true if the licensed behavior has been successfully enabled.

This is used to turn on licensed behaviors in DLE. The function parameter is a base64-encoded string containing the encrypted licensed key.

### finalize

```java
void com.datalogics.PDFL.Library.finalize()
```

*protected*

**Returns:** `void`

Destroy this handle to the PDF Library. Also terminate the library if this is the last Library object on this thread.

### getAPDFLVersion

```java
static String com.datalogics.PDFL.Library.getAPDFLVersion()
```

*static*

**Returns:** `String`

The version of the C/C++ SDK, as reported in legacy versions of APDFL.

E.g., 18.0.5P1a

### getAllowOpeningXFA

```java
boolean com.datalogics.PDFL.Library.getAllowOpeningXFA()
```

**Returns:** `boolean`

Allow opening PDF files that contain XFA forms. By default, an exception will be raised when attempting to open this type of document.

### getAllowRelaxedSyntax

```java
boolean com.datalogics.PDFL.Library.getAllowRelaxedSyntax()
```

**Returns:** `boolean`

true if these minor errors are ignored.

Check to see if minor parsing errors are ignored while opening PDF files.

### getDLEVersion

```java
static String com.datalogics.PDFL.Library.getDLEVersion()
```

*static*

**Returns:** `String`

The version of the .NET/Java SDK, as reported in legacy versions of APDFL.

E.g., 18.0.5.0

### getDefaultTempPath

```java
String com.datalogics.PDFL.Library.getDefaultTempPath()
```

**Returns:** `String`

string with current default directory for temporary files, or null if none was set by the user.

Gets the default temporary directory.

### getDefaultTempStore

```java
TempStoreType com.datalogics.PDFL.Library.getDefaultTempStore()
```

**Returns:** `TempStoreType`

current temporary storage type.

Gets default temporary storage.PDFL uses Disk storage type by default.

### getDefaultTempStoreMemLimit

```java
int com.datalogics.PDFL.Library.getDefaultTempStoreMemLimit()
```

**Returns:** `int`

current memory limit. It returns zero value for cases when unlimited memory amount is used or when current storage type is Disk. Call DefaultTempStore to get the exact meaning of the zero value

Gets current memory limit.

### getFormsExtensionVersion

```java
static String com.datalogics.PDFL.Library.getFormsExtensionVersion()
```

*static*

**Returns:** `String`

The Forms Extension Version

Forms Extension Version

### getInstallLocation

```java
static String com.datalogics.PDFL.Library.getInstallLocation()
```

*static*

**Returns:** `String`

the installation location as a UTF-8 path.

The installation location.

This is inferred from the location of the native code and returned as a UTF-8 path.

### getLicenseKey

```java
static String com.datalogics.PDFL.Library.getLicenseKey()
```

*static*

**Returns:** `String`

A string containing a license key, as an alternative to using a license file. Only applicable to License-Managed versions.

### getLogParams

```java
LogParams com.datalogics.PDFL.Library.getLogParams()
```

**Returns:** [`LogParams`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/LogParams.md)

The LogParams object which contains currently used logging settings.

Gets LogParams object with preferences for logging.

### getResourceDirectory

```java
static String com.datalogics.PDFL.Library.getResourceDirectory()
```

*static*

**Returns:** `String`

the resource directory as a UTF-8 path

The resource directory.

### initialized

```java
static boolean com.datalogics.PDFL.Library.initialized()
```

*static*

**Returns:** `boolean`

true if the PDF Library is initialized on this thread

Check to see if the library is initialized

### isFormsExtensionAvailable

```java
boolean com.datalogics.PDFL.Library.isFormsExtensionAvailable()
```

**Returns:** `boolean`

true if the Forms Extension dependencies are present, and false if they are not.

Validate the Forms Extension dependencies are present. Indicates if all of the necessary dependencies are present for the Forms extension.

### setAllowOpeningXFA

```java
void com.datalogics.PDFL.Library.setAllowOpeningXFA(boolean xfaSetting)
```

**Parameters**

- `xfaSetting` (`boolean`)

**Returns:** `void`

Allow opening PDF files that contain XFA forms. By default, an exception will be raised when attempting to open this type of document.

### setAllowRelaxedSyntax

```java
void com.datalogics.PDFL.Library.setAllowRelaxedSyntax(boolean allowRelaxedSyntax)
```

**Parameters**

- `allowRelaxedSyntax` (`boolean`)

**Returns:** `void`

Ignore minor parsing errors while opening PDF files.By default, exceptions are raised when such errors occur.

### setDefaultTempPath

```java
void com.datalogics.PDFL.Library.setDefaultTempPath(String defTempPath)
```

**Parameters**

- `defTempPath` (`String`)

**Returns:** `void`

Sets the default temporary path to the directory indicated by the specified path name. Pass null as the path to use the system default temporary file directory.

### setDefaultTempStore

```java
void com.datalogics.PDFL.Library.setDefaultTempStore(TempStoreType tempStore)
```

**Parameters**

- `tempStore` (`TempStoreType`): temporary storage type.

**Returns:** `void`

Allows to switch between different types of temporary storages. Use Disk type to turn off in-memory file system usage. Use Memory type to turn on in-memory file system with unlimited RAM amount by default.

### setDefaultTempStoreMemLimit

```java
void com.datalogics.PDFL.Library.setDefaultTempStoreMemLimit(int memoryLimit)
```

**Parameters**

- `memoryLimit` (`int`)

**Returns:** `void`

Sets memory limit for Memory storage type. Accepts any positive integer to set threshold for using RAM in kilobytes. When occupied memory exceeds specified threshold, temporary files creation will be redirected to physical disk.

Throws an exception if current storage type is Disk. Throws an exception if input value less than 0;

### setLicenseKey

```java
static void com.datalogics.PDFL.Library.setLicenseKey(String licenses)
```

*static*

**Parameters**

- `licenses` (`String`)

**Returns:** `void`

A string containing a license, as an alternative to using a license file. Only applicable to License-Managed versions.

### setLogParams

```java
void com.datalogics.PDFL.Library.setLogParams(LogParams logParams)
```

**Parameters**

- `logParams` ([`LogParams`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/LogParams.md)): the new parameters for logging.

**Returns:** `void`

Sets LogParams object with preferences for logging.

### terminate

```java
void com.datalogics.PDFL.Library.terminate()
```

**Returns:** `void`

Terminate the library with regard to this handle. (Note that if there are other Library objects in this thread, they may keep the library initialized.
