HiddenDataSanitizationOptions

Inheritance: java.lang.Object, com.aspose.pdf.security.HiddenDataSanitizationOptions

public final class HiddenDataSanitizationOptions extends Object

Represents the configuration options for sanitizing hidden data within a document.

Constructors

ConstructorDescription
HiddenDataSanitizationOptions

Methods

MethodDescription
allCreates a new instance of the {@link HiddenDataSanitizationOptions} class with all options set for sanitization. This includes enabling the removal of annotations, JavaScript, metadata, attachments, search index, private information, flattening of forms and layers, while disabling the option to convert pages to images. Optional configurations like {@code ImageCompressionOptions}({@link #getImageCompressionOptions}/{@link #setImageCompressionOptions}) or {@code ConvertPagesToImages}({@link #getConvertPagesToImages}/{@link #setConvertPagesToImages}) can be manually modified after obtaining the instance, as they are not active by default.
getConvertPagesToImagesGets the option to convert pages to images. If this option is enabled, the ImageCompressionOptions option will be ignored. The option must be enabled manually when using the {@code #All()} method if it is required. The conversion of pages to images will occur after clearing the main hidden data, which is controlled by other options.
getFlattenFormsGets a value indicating whether forms in the document should be flattened during the sanitization process. Flattening forms converts interactive form fields into static content, making them non-editable or fillable.
getFlattenLayersGets the option to flatten the layers in the PDF document. When enabled, all layers in the document are merged into a single layer, removing their separate structure. This option is useful for sanitizing documents by simplifying their content and ensuring no hidden data resides within layers.
getImageCompressionOptionsGets the document image conversion option. The option must be enabled manually when using the {@code #All()} method if it is required.
getImageDpiGets the option to resolve page images during conversion.
getRemoveAnnotationsGets a value indicating whether to remove annotations from the document. When enabled, all annotations present in the document will be removed during the sanitization process. Redact annotations will be applied.
getRemoveAttachmentsGets the option to remove all attached files from the document. When enabled, it ensures that any attachments within the PDF are eliminated during the sanitation process.
getRemoveJavaScriptsAndActionsGets a value indicating whether JavaScript and associated actions should be removed from the document. This option is useful to eliminate potential security vulnerabilities introduced by embedded scripts.
getRemoveMetadataGets an option to remove metadata from the document. If set to true, metadata such as document properties and additional embedded metadata information will be removed during sanitization.
getRemoveSearchIndexAndPrivateInfoGets a value indicating whether the search index and private information should be removed from the document. Enables the removal of embedded search indices and private data to enhance document security and privacy.
setConvertPagesToImagesSets the option to convert pages to images. If this option is enabled, the ImageCompressionOptions option will be ignored. The option must be enabled manually when using the {@code #All()} method if it is required. The conversion of pages to images will occur after clearing the main hidden data, which is controlled by other options.
setFlattenFormsSets a value indicating whether forms in the document should be flattened during the sanitization process. Flattening forms converts interactive form fields into static content, making them non-editable or fillable.
setFlattenLayersSets the option to flatten the layers in the PDF document. When enabled, all layers in the document are merged into a single layer, removing their separate structure. This option is useful for sanitizing documents by simplifying their content and ensuring no hidden data resides within layers.
setImageCompressionOptionsSets the document image conversion option. The option must be enabled manually when using the {@code #All()} method if it is required.
setImageDpiSets the option to resolve page images during conversion.
setRemoveAnnotationsSets a value indicating whether to remove annotations from the document. When enabled, all annotations present in the document will be removed during the sanitization process. Redact annotations will be applied.
setRemoveAttachmentsSets the option to remove all attached files from the document. When enabled, it ensures that any attachments within the PDF are eliminated during the sanitation process.
setRemoveJavaScriptsAndActionsSets a value indicating whether JavaScript and associated actions should be removed from the document. This option is useful to eliminate potential security vulnerabilities introduced by embedded scripts.
setRemoveMetadataSets an option to remove metadata from the document. If set to true, metadata such as document properties and additional embedded metadata information will be removed during sanitization.
setRemoveSearchIndexAndPrivateInfoSets a value indicating whether the search index and private information should be removed from the document. Enables the removal of embedded search indices and private data to enhance document security and privacy.

HiddenDataSanitizationOptions

public HiddenDataSanitizationOptions()

all

public static HiddenDataSanitizationOptions all()

Creates a new instance of the {@link HiddenDataSanitizationOptions} class with all options set for sanitization. This includes enabling the removal of annotations, JavaScript, metadata, attachments, search index, private information, flattening of forms and layers, while disabling the option to convert pages to images. Optional configurations like {@code ImageCompressionOptions}({@link #getImageCompressionOptions}/{@link #setImageCompressionOptions}) or {@code ConvertPagesToImages}({@link #getConvertPagesToImages}/{@link #setConvertPagesToImages}) can be manually modified after obtaining the instance, as they are not active by default.

Returns: A {@link HiddenDataSanitizationOptions} instance with all sanitization options preconfigured.

getConvertPagesToImages

public final boolean getConvertPagesToImages()

Gets the option to convert pages to images. If this option is enabled, the ImageCompressionOptions option will be ignored. The option must be enabled manually when using the {@code #All()} method if it is required. The conversion of pages to images will occur after clearing the main hidden data, which is controlled by other options.

Returns: the option to convert pages to images.

getFlattenForms

public final boolean getFlattenForms()

Gets a value indicating whether forms in the document should be flattened during the sanitization process. Flattening forms converts interactive form fields into static content, making them non-editable or fillable.

Returns: a value indicating whether forms in the document should be flattened during the sanitization process.

getFlattenLayers

public final boolean getFlattenLayers()

Gets the option to flatten the layers in the PDF document. When enabled, all layers in the document are merged into a single layer, removing their separate structure. This option is useful for sanitizing documents by simplifying their content and ensuring no hidden data resides within layers.

Returns: the option to flatten the layers in the PDF document.

getImageCompressionOptions

public final ImageCompressionOptions getImageCompressionOptions()

Gets the document image conversion option. The option must be enabled manually when using the {@code #All()} method if it is required.

Returns: the document image conversion option.

getImageDpi

public final int getImageDpi()

Gets the option to resolve page images during conversion.

Returns: the option to resolve page images during conversion.

getRemoveAnnotations

public final boolean getRemoveAnnotations()

Gets a value indicating whether to remove annotations from the document. When enabled, all annotations present in the document will be removed during the sanitization process. Redact annotations will be applied.

Returns: a value indicating whether to remove annotations from the document.

getRemoveAttachments

public final boolean getRemoveAttachments()

Gets the option to remove all attached files from the document. When enabled, it ensures that any attachments within the PDF are eliminated during the sanitation process.

Returns: the option to remove all attached files from the document.

getRemoveJavaScriptsAndActions

public final boolean getRemoveJavaScriptsAndActions()

Gets a value indicating whether JavaScript and associated actions should be removed from the document. This option is useful to eliminate potential security vulnerabilities introduced by embedded scripts.

Returns: a value indicating whether JavaScript and associated actions should be removed from the document.

getRemoveMetadata

public final boolean getRemoveMetadata()

Gets an option to remove metadata from the document. If set to true, metadata such as document properties and additional embedded metadata information will be removed during sanitization.

Returns: an option to remove metadata from the document.

getRemoveSearchIndexAndPrivateInfo

public final boolean getRemoveSearchIndexAndPrivateInfo()

Gets a value indicating whether the search index and private information should be removed from the document. Enables the removal of embedded search indices and private data to enhance document security and privacy.

Returns: a value indicating whether the search index and private information should be removed from the document.

setConvertPagesToImages

public final void setConvertPagesToImages(boolean value)

Sets the option to convert pages to images. If this option is enabled, the ImageCompressionOptions option will be ignored. The option must be enabled manually when using the {@code #All()} method if it is required. The conversion of pages to images will occur after clearing the main hidden data, which is controlled by other options.

Parameters:

ParameterTypeDescription
valuethe option to convert pages to images.

setFlattenForms

public final void setFlattenForms(boolean value)

Sets a value indicating whether forms in the document should be flattened during the sanitization process. Flattening forms converts interactive form fields into static content, making them non-editable or fillable.

Parameters:

ParameterTypeDescription
valuea value indicating whether forms in the document should be flattened during the sanitization process.

setFlattenLayers

public final void setFlattenLayers(boolean value)

Sets the option to flatten the layers in the PDF document. When enabled, all layers in the document are merged into a single layer, removing their separate structure. This option is useful for sanitizing documents by simplifying their content and ensuring no hidden data resides within layers.

Parameters:

ParameterTypeDescription
valuethe option to flatten the layers in the PDF document.

setImageCompressionOptions

Sets the document image conversion option. The option must be enabled manually when using the {@code #All()} method if it is required.

setImageDpi

public final void setImageDpi(int value)

Sets the option to resolve page images during conversion.

Parameters:

ParameterTypeDescription
valuethe option to resolve page images during conversion.

setRemoveAnnotations

public final void setRemoveAnnotations(boolean value)

Sets a value indicating whether to remove annotations from the document. When enabled, all annotations present in the document will be removed during the sanitization process. Redact annotations will be applied.

Parameters:

ParameterTypeDescription
valuea value indicating whether to remove annotations from the document.

setRemoveAttachments

public final void setRemoveAttachments(boolean value)

Sets the option to remove all attached files from the document. When enabled, it ensures that any attachments within the PDF are eliminated during the sanitation process.

Parameters:

ParameterTypeDescription
valuethe option to remove all attached files from the document.

setRemoveJavaScriptsAndActions

public final void setRemoveJavaScriptsAndActions(boolean value)

Sets a value indicating whether JavaScript and associated actions should be removed from the document. This option is useful to eliminate potential security vulnerabilities introduced by embedded scripts.

Parameters:

ParameterTypeDescription
valuea value indicating whether JavaScript and associated actions should be removed from the document.

setRemoveMetadata

public final void setRemoveMetadata(boolean value)

Sets an option to remove metadata from the document. If set to true, metadata such as document properties and additional embedded metadata information will be removed during sanitization.

Parameters:

ParameterTypeDescription
valuean option to remove metadata from the document.

setRemoveSearchIndexAndPrivateInfo

public final void setRemoveSearchIndexAndPrivateInfo(boolean value)

Sets a value indicating whether the search index and private information should be removed from the document. Enables the removal of embedded search indices and private data to enhance document security and privacy.

Parameters:

ParameterTypeDescription
valuea value indicating whether the search index and private information should be removed from the document.