Gets the general information about the document - size, page count, etc.
Redactor(String filePath)
public Redactor(String filePath)
Initializes a new instance of Redactor class using file path.
Parameters:
Parameter
Type
Description
filePath
java.lang.String
Path to the file
The following example demonstrates how to open a document for redaction.
try (Redactor redactor = new Redactor("C:\\sample.pdf"))
{
// Here we can use document instance to perform redactions
}
``` |
### Redactor(InputStream document) {#Redactor-java.io.InputStream-}
public Redactor(InputStream document)
Initializes a new instance of Redactor class using stream.
**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| document | java.io.InputStream | Source stream of the document
The following example demonstrates how to open a document from stream.
try (InputStream stream = new FileInputStream(“C:\sample.pdf”))
{
try (Redactor redactor = new Redactor(stream))
{
// Here we can use document instance to perform redactions
}
}
public Redactor(String filePath, LoadOptions loadOptions)
Initializes a new instance of Redactor class for a password-protected document using its path.
**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| filePath | java.lang.String | Path to file. |
| loadOptions | [LoadOptions](../../com.groupdocs.redaction.options/loadoptions) | Options, including password. |
### Redactor(String filePath, LoadOptions loadOptions, RedactorSettings settings) {#Redactor-java.lang.String-com.groupdocs.redaction.options.LoadOptions-com.groupdocs.redaction.options.RedactorSettings-}
public Redactor(String filePath, LoadOptions loadOptions, RedactorSettings settings)
Initializes a new instance of Redactor class for a password-protected document using its path and settings.
**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| filePath | java.lang.String | Path to file. |
| loadOptions | [LoadOptions](../../com.groupdocs.redaction.options/loadoptions) | File-dependent options, including password. |
| settings | [RedactorSettings](../../com.groupdocs.redaction.options/redactorsettings) | Default settings for redaction process. |
### Redactor(InputStream document, LoadOptions loadOptions) {#Redactor-java.io.InputStream-com.groupdocs.redaction.options.LoadOptions-}
public Redactor(InputStream document, LoadOptions loadOptions)
Initializes a new instance of Redactor class for a password-protected document using stream.
**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| document | java.io.InputStream | Source input stream. |
| loadOptions | [LoadOptions](../../com.groupdocs.redaction.options/loadoptions) | Options, including password. |
### Redactor(InputStream document, LoadOptions loadOptions, RedactorSettings settings) {#Redactor-java.io.InputStream-com.groupdocs.redaction.options.LoadOptions-com.groupdocs.redaction.options.RedactorSettings-}
public Redactor(InputStream document, LoadOptions loadOptions, RedactorSettings settings)
Initializes a new instance of Redactor class for a password-protected document using stream and settings.
**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| document | java.io.InputStream | Source input stream. |
| loadOptions | [LoadOptions](../../com.groupdocs.redaction.options/loadoptions) | Options, including password. |
| settings | [RedactorSettings](../../com.groupdocs.redaction.options/redactorsettings) | Default settings for redaction process. |
### close() {#close--}
public final RedactorChangeLog apply(Redaction redaction)
Applies a redaction to the document.
**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| redaction | [Redaction](../../com.groupdocs.redaction/redaction) | An instance of Redaction to apply |
**Returns:**
[RedactorChangeLog](../../com.groupdocs.redaction/redactorchangelog) - Success or failure and error message in this case
### apply(Redaction[] redactions) {#apply-com.groupdocs.redaction.Redaction---}
public final RedactorChangeLog apply(Redaction[] redactions)
Applies a set of redactions to the document.
**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| redactions | [Redaction\[\]](../../com.groupdocs.redaction/redaction) | An array of redactions to apply |
**Returns:**
[RedactorChangeLog](../../com.groupdocs.redaction/redactorchangelog) - Success or failure and error message in this case
### apply(RedactionPolicy policy) {#apply-com.groupdocs.redaction.RedactionPolicy-}
public final RedactorChangeLog apply(RedactionPolicy policy)
Applies a redaction policy to the document.
**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| policy | [RedactionPolicy](../../com.groupdocs.redaction/redactionpolicy) | Redaction policy |
**Returns:**
[RedactorChangeLog](../../com.groupdocs.redaction/redactorchangelog) - Success or failure and error message in this case
### save() {#save--}
public final String save()
Saves the document to a file with the following options: AddSuffix = true, RasterizeToPDF = true.
**Returns:**
java.lang.String - Path to redacted document
### save(SaveOptions saveOptions) {#save-com.groupdocs.redaction.options.SaveOptions-}
public final String save(SaveOptions saveOptions)
Saves the document to a file.
**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| saveOptions | [SaveOptions](../../com.groupdocs.redaction.options/saveoptions) | Options to add suffix or rasterize |
**Returns:**
java.lang.String - Path to redacted document
### save(OutputStream document) {#save-java.io.OutputStream-}
public final void save(OutputStream document)
Saves the document to a stream.
**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| document | java.io.OutputStream | Target stream |
### save(OutputStream document, RasterizationOptions rasterizationOptions) {#save-java.io.OutputStream-com.groupdocs.redaction.options.RasterizationOptions-}
public final void save(OutputStream document, RasterizationOptions rasterizationOptions)
Saves the document to a stream, including custom location.
**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| document | java.io.OutputStream | Target stream |
| rasterizationOptions | [RasterizationOptions](../../com.groupdocs.redaction.options/rasterizationoptions) | Options to rasterize or not and to specify pages for rasterization |
### generatePreview(PreviewOptions previewOptions) {#generatePreview-com.groupdocs.redaction.options.PreviewOptions-}
public final void generatePreview(PreviewOptions previewOptions)
Generates preview images of specific pages in a given image format.
**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| previewOptions | [PreviewOptions](../../com.groupdocs.redaction.options/previewoptions) | Image properties and page range settings |
### getDocumentInfo() {#getDocumentInfo--}
public final IDocumentInfo getDocumentInfo()
Gets the general information about the document - size, page count, etc.
**Returns:**
[IDocumentInfo](../../com.groupdocs.redaction/idocumentinfo) - An instance of IDocumentInfo
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.