LoadOptions

Inheritance: java.lang.Object

public class LoadOptions

Allows to specify additional options (such as password) when opening a document to sign.

Constructors

Constructor Description
LoadOptions() Initializes a new instance of LoadOptions class.
LoadOptions(FileType fileType) Initializes a new instance of LoadOptions class with a specified file type.

Methods

Method Description
getPassword() Gets or sets password to open a protected document.
setPassword(String value) Gets or sets password to open a protected document.
getSkipExternalResources() Gets or sets a flag that tells whether resources stored outside the document are skipped when it is loaded.
setSkipExternalResources(boolean value) Gets or sets a flag that tells whether resources stored outside the document are skipped when it is loaded.
getWhitelistedResources() Gets or sets parts of addresses of external resources that may be loaded while
#getSkipExternalResources().getSkipExternalResources() is true.
setWhitelistedResources(List value) Gets or sets parts of addresses of external resources that may be loaded while
#getSkipExternalResources().getSkipExternalResources() is true.
getPermissions() The PDF document permissions such as printing, modification and data extraction.
setPermissions(Integer value) Internal setter, used by document load processors to record permissions parsed from the file.
getFileType() Gets the file type of the document.
setFileType(FileType value) Sets the file type of the document, so it is not detected from the document content.

LoadOptions()

public LoadOptions()

Initializes a new instance of LoadOptions class.

LoadOptions(FileType fileType)

public LoadOptions(FileType fileType)

Initializes a new instance of LoadOptions class with a specified file type.

Parameters:

Parameter Type Description
fileType FileType The file type of the document, see #setFileType(FileType).setFileType(FileType).

getPassword()

public final String getPassword()

Gets or sets password to open a protected document. It will be also used to save signed document as protected.

Returns: java.lang.String

setPassword(String value)

public final void setPassword(String value)

Gets or sets password to open a protected document. It will be also used to save signed document as protected.

Parameters:

Parameter Type Description
value java.lang.String

getSkipExternalResources()

public final boolean getSkipExternalResources()

Gets or sets a flag that tells whether resources stored outside the document are skipped when it is loaded. The default value is true.

A document can refer to resources outside it: linked images and INCLUDEPICTURE fields in word processing documents, linked pictures in presentations and spreadsheets, images and style sheets an SVG image refers to. Loading such a resource means requesting the address written in the document. On a server that processes documents from other people that is a server-side request forgery risk, and on an offline installation the request fails or waits for a time-out.

When true, external resources are not loaded, except those whose address contains one of #getWhitelistedResources().getWhitelistedResources(). Skipped resources are not drawn in page previews or in documents saved as images, and image, barcode and QR-code search does not see them. Embedded images are not affected, and hyperlinks are never followed. The setting also applies to documents inside archives.

Returns: boolean

setSkipExternalResources(boolean value)

public final void setSkipExternalResources(boolean value)

Gets or sets a flag that tells whether resources stored outside the document are skipped when it is loaded. The default value is true. See #getSkipExternalResources().getSkipExternalResources().

Parameters:

Parameter Type Description
value boolean

getWhitelistedResources()

public final List<String> getWhitelistedResources()

Gets or sets parts of addresses of external resources that may be loaded while #getSkipExternalResources().getSkipExternalResources() is true. An address is loaded when it contains one of them, ignoring case. Empty values are ignored. The default is an empty list; setting null clears it.

Returns: java.util.List<java.lang.String>

setWhitelistedResources(List value)

public final void setWhitelistedResources(List<String> value)

Gets or sets parts of addresses of external resources that may be loaded while #getSkipExternalResources().getSkipExternalResources() is true. See #getWhitelistedResources().getWhitelistedResources().

Parameters:

Parameter Type Description
value java.util.List<java.lang.String>

getPermissions()

public final Integer getPermissions()

The PDF document permissions such as printing, modification and data extraction. Only for PDF documents. Read-only \u2014 populated automatically while loading the document. The value is a flags combination from Permissions.

Returns: java.lang.Integer

setPermissions(Integer value)

public final void setPermissions(Integer value)

Internal setter, used by document load processors to record permissions parsed from the file.

Parameters:

Parameter Type Description
value java.lang.Integer

getFileType()

public final FileType getFileType()

Gets the file type of the document. When it is FileType.Unknown (the default), the file type is detected from the document content.

Returns: FileType

setFileType(FileType value)

public final void setFileType(FileType value)

Sets the file type of the document, so it is not detected from the document content. FileType.Unknown (the default) or null detects it.

Parameters:

Parameter Type Description
value FileType