public final class Redactor extends Object implements Closeable
Represents a main class that controls document redaction process, allowing to open, redact and save documents.
Constructor and Description |
---|
Redactor(InputStream document)
Initializes a new instance of
Redactor class using stream. |
Redactor(InputStream document,
LoadOptions loadOptions)
Initializes a new instance of
Redactor class for a password-protected document using stream. |
Redactor(String filePath)
Initializes a new instance of
Redactor class using file path. |
Redactor(String filePath,
LoadOptions loadOptions)
Initializes a new instance of
Redactor class for a password-protected document using its path. |
Modifier and Type | Method and Description |
---|---|
RedactorChangeLog |
apply(Redaction redaction)
Applies a redaction to the document.
|
RedactorChangeLog |
apply(Redaction[] redactions)
Applies a set of redactions to the document.
|
RedactorChangeLog |
apply(RedactionPolicy policy)
Applies a redaction policy to the document.
|
void |
close()
Releases resources.
|
void |
generatePreview(PreviewOptions previewOptions)
Generates preview images of specific pages in a given image format.
|
IDocumentInfo |
getDocumentInfo()
Gets the general information about the document - size, page count, etc.
|
static IRedactionCallback |
getRedactionCallback()
Gets an instance of a class, implementing
IRedactionCallback . |
static boolean |
isRedactionAccepted(RedactionDescription description)
Checks for
IRedactionCallback implementation and invokes it, if specified. |
String |
save()
Saves the document to a file with the following options: AddSuffix = true, RasterizeToPDF = true.
|
void |
save(OutputStream document,
RasterizationOptions rasterizationOptions)
Saves the document to a stream, including custom location.
|
String |
save(SaveOptions saveOptions)
Saves the document to a file.
|
static void |
setRedactionCallback(IRedactionCallback value)
Sets an instance of a class, implementing
IRedactionCallback . |
public Redactor(String filePath) throws Exception
Initializes a new instance of Redactor
class using file path.
filePath
- Path to the fileException
public Redactor(InputStream document) throws Exception
Initializes a new instance of Redactor
class using stream.
document
- Source stream of the documentException
public Redactor(String filePath, LoadOptions loadOptions) throws Exception
Initializes a new instance of Redactor
class for a password-protected document using its path.
filePath
- Path to file.loadOptions
- Options, including password.Exception
public Redactor(InputStream document, LoadOptions loadOptions) throws Exception
Initializes a new instance of Redactor
class for a password-protected document using stream.
document
- Source input stream.loadOptions
- Options, including password.Exception
public static IRedactionCallback getRedactionCallback()
Gets an instance of a class, implementing IRedactionCallback
.
IRedactionCallback
.public static void setRedactionCallback(IRedactionCallback value)
Sets an instance of a class, implementing IRedactionCallback
.
value
- An instance of a class, implementing IRedactionCallback
.public final void close()
Releases resources.
close
in interface Closeable
close
in interface AutoCloseable
public static boolean isRedactionAccepted(RedactionDescription description)
Checks for IRedactionCallback
implementation and invokes it, if specified.
description
- Redaction descriptionpublic final RedactorChangeLog apply(Redaction redaction)
Applies a redaction to the document.
redaction
- An instance of Redaction
to applypublic final RedactorChangeLog apply(Redaction[] redactions)
Applies a set of redactions to the document.
redactions
- An array of redactions to applypublic final RedactorChangeLog apply(RedactionPolicy policy)
Applies a redaction policy to the document.
policy
- Redaction policypublic final String save() throws Exception
Saves the document to a file with the following options: AddSuffix = true, RasterizeToPDF = true.
Exception
public final String save(SaveOptions saveOptions) throws Exception
Saves the document to a file.
saveOptions
- Options to add suffix or rasterizeException
public final void save(OutputStream document, RasterizationOptions rasterizationOptions) throws Exception
Saves the document to a stream, including custom location.
document
- Target streamrasterizationOptions
- Options to rasterize or not and to specify pages for rasterizationException
public final void generatePreview(PreviewOptions previewOptions) throws Exception
Generates preview images of specific pages in a given image format.
previewOptions
- Image properties and page range settingsException
public final IDocumentInfo getDocumentInfo() throws Exception
Gets the general information about the document - size, page count, etc.
Exception
Copyright © 2019. All rights reserved.