public class RedactionUtil
extends java.lang.Object
Constructor and Description |
---|
RedactionUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
addRedactions(java.lang.String ticket,
java.lang.String objectId,
EnhancedCompleteObject redactedECO,
java.lang.Boolean newVersion,
java.lang.Boolean majorVersion)
Updates the document represented by objectId with the redactedECO
|
static com.aspose.pdf.Document |
applyRedactionRectangles(EnhancedObjectContent unRedactedPdf,
java.lang.String ticket,
java.lang.String objectId,
Redaction[] redactions,
java.util.List<Redaction> failedRedactions,
java.lang.String redactionFont)
Function that both burns in redaction rectangles and scrubs the text behind said rectangles
|
static java.lang.String |
checkForPreviousRedaction(java.lang.String ticket,
java.lang.String objectId,
RedactionConfig redactionConfig)
Helper-method that determines whether or not the passed in objectId has any previous redactions associated
with it
|
static EnhancedCompleteObject |
createRedactedECO(java.io.ByteArrayOutputStream baos)
Helper-method that returns an object representing our redacted content
|
static Redaction[] |
createRedactionsFromAnnotations(Annotation[] annotations)
Helper method for creation redaction objects from annotation objects
|
static void |
drawRedaction(java.awt.image.BufferedImage buffImg,
Redaction redaction,
com.itextpdf.text.Rectangle pageRect,
float widthScale,
float heightScale,
int rotation)
Helper-method that draws a redactions onto a buffered image.
|
static com.aspose.pdf.Document |
drawTextRedact(com.aspose.pdf.TextFragmentCollection textFragmentCollection,
java.lang.String replacement,
com.aspose.pdf.Document pdfDocument)
Helper that redacts a textFragment from a PDF
|
static java.lang.String |
getReplacementString(java.lang.String toRedact)
Helper takes an input string and returns an estimated equal redaction string of asterisks
|
static java.lang.String |
processPermanentRedaction(java.lang.String ticket,
java.lang.String redactedDocumentId,
java.io.ByteArrayOutputStream baos,
java.lang.Boolean newVersion,
java.lang.Boolean majorVersion)
Redacts in-place the document passed in
|
static java.lang.String |
processRedactedAsCopy(java.lang.String ticket,
java.lang.String objectId,
java.lang.String parentId,
java.io.ByteArrayOutputStream baos,
RedactionConfig redactionConfig,
java.lang.Boolean newVersion,
java.lang.Boolean majorVersion)
Returns a string that represents the object that was redacted.
|
static java.lang.String |
processUnredactedAsCopy(java.lang.String ticket,
java.lang.String objectId,
java.lang.String parentId,
java.io.ByteArrayOutputStream baos,
RedactionConfig redactionConfig,
java.lang.Boolean newVersion,
java.lang.Boolean majorVersion)
Returns a string that represents the object that was redacted.
|
public static Redaction[] createRedactionsFromAnnotations(Annotation[] annotations)
annotations
- an array of annotation objectspublic static java.lang.String processUnredactedAsCopy(java.lang.String ticket, java.lang.String objectId, java.lang.String parentId, java.io.ByteArrayOutputStream baos, RedactionConfig redactionConfig, java.lang.Boolean newVersion, java.lang.Boolean majorVersion)
ticket
- A valid OC ticket.objectId
- The objectId of the PDF object to create redactions for.parentId
- The objectId of the parent of the PDF object to create redactions for.baos
- The ByteArrayOutputStream representing the PDF object containing our redactions.redactionConfig
- The redactionConfig providing the configuration options for redaction.newVersion
- true if the update will be saved to a new version, otherwise false.majorVersion
- true if the update will be saved to a major version, otherwise false.public static java.lang.String processRedactedAsCopy(java.lang.String ticket, java.lang.String objectId, java.lang.String parentId, java.io.ByteArrayOutputStream baos, RedactionConfig redactionConfig, java.lang.Boolean newVersion, java.lang.Boolean majorVersion)
ticket
- A valid OC ticket.objectId
- The objectId of the PDF object to create redactions for.parentId
- The objectId of the parent of the PDF object to create redactions for.baos
- The ByteArrayOutputStream representing the PDF object containing our redactions.redactionConfig
- The redactionConfig providing the configuration options for redaction.newVersion
- true if the update will be saved to a new version, otherwise false.majorVersion
- true if the update will be saved to a major version, otherwise false.public static java.lang.String processPermanentRedaction(java.lang.String ticket, java.lang.String redactedDocumentId, java.io.ByteArrayOutputStream baos, java.lang.Boolean newVersion, java.lang.Boolean majorVersion)
ticket
- A valid OC ticket.redactedDocumentId
- The objectId associated with the document being redacted.baos
- The ByteArrayOutputStream representing the PDF object containing our redactions.newVersion
- true if the update will be saved to a new version, otherwise false.majorVersion
- true if the update will be saved to a major version, otherwise false.public static java.lang.String addRedactions(java.lang.String ticket, java.lang.String objectId, EnhancedCompleteObject redactedECO, java.lang.Boolean newVersion, java.lang.Boolean majorVersion)
ticket
- A valid OC ticket.objectId
- The objectId of the PDF object that is being updated with redactions.redactedECO
- The EnhancedCompleteObject representing our redacted content.newVersion
- true if the update will be saved to a new version, otherwise false.majorVersion
- true if the update will be saved to a major version, otherwise false.public static EnhancedCompleteObject createRedactedECO(java.io.ByteArrayOutputStream baos)
baos
- The ByteArrayOutputStream representing the PDF object containing our redactions.public static void drawRedaction(java.awt.image.BufferedImage buffImg, Redaction redaction, com.itextpdf.text.Rectangle pageRect, float widthScale, float heightScale, int rotation)
buffImg
- - The image to be written on toredaction
- - An Annotation object representing the redaction to be drawnpageRect
- - The rectangle representing the area of the pagewidthScale
- - Factor by which to scale the final image's widthheightScale
- - Factor by which to scale the final image's heightrotation
- - the rotation of the document from its original orientationpublic static java.lang.String checkForPreviousRedaction(java.lang.String ticket, java.lang.String objectId, RedactionConfig redactionConfig)
ticket
- A valid OC ticket.objectId
- The objectId of the PDF object to create redactions for.redactionConfig
- The redactionConfig providing the configuration options for redaction.public static com.aspose.pdf.Document drawTextRedact(com.aspose.pdf.TextFragmentCollection textFragmentCollection, java.lang.String replacement, com.aspose.pdf.Document pdfDocument)
textFragmentCollection
- - the collection of textFragments that we will redact from the pdfDocumentreplacement
- - the String replacement that will be used to replace the textFragmentpdfDocument
- - the Document that will be redactedpublic static com.aspose.pdf.Document applyRedactionRectangles(EnhancedObjectContent unRedactedPdf, java.lang.String ticket, java.lang.String objectId, Redaction[] redactions, java.util.List<Redaction> failedRedactions, java.lang.String redactionFont)
unRedactedPdf
- - EnhancedObjectContent of unredacted PDFticket
- - a valid OC ticketobjectId
- - the objectId of the document being redactedredactions
- - an array of redactions that will be iterated over and burned inredaction
- font - font to use for redactionpublic static java.lang.String getReplacementString(java.lang.String toRedact)
toRedact
- - the string that will be replaced by asterisks