You are viewing limited content. For full access, please sign in.

Question

Question

Can I take an XML file and make Redactions to a TIF?

asked on December 1, 2017

Can I take an XML file and use the coordinates in the file to make Redactions to a TIF image?

0 0

Answer

SELECTED ANSWER
replied on December 4, 2017

Corey,

As Aaron shares you will need to script this in Workflow or use the SDK to build a standalone utility or client integration to make this happen.  If you are using Workflow you can make this happen with the SDK Script activity.  You will need to write code to open your XML file and parse out at a minimum the entryID, pageNumber, x and y coordinates, and the width and height of the redaction.

Here is a code snippet that will take the supplied token values and apply a redaction to the specified page;

        Protected Overrides Sub Execute()

            'Try/Catch for any errors...
            Try
                Dim entryId As Integer = Me.GetTokenValue("entryId")
                Dim pageNumber As Integer = Me.GetTokenValue("pageNumber")

                'Make sure the entry supplied is a document...
                If Entry.GetEntryInfo(entryId, Me.RASession).EntryType = EntryType.Document Then

                    'Get all of the necessary token values...
                    Dim x As Integer = Me.GetTokenValue("x")
                    Dim y As Integer = Me.GetTokenValue("y")
                    Dim width As Integer = Me.GetTokenValue("width")
                    Dim height As Integer = Me.GetTokenValue("height")

                    'Instantiate the redaction and rectangle objects...
                    Dim redaction As RedactionAnnotation = New RedactionAnnotation()
                    Dim imageRectangles As List(Of Laserfiche.RepositoryAccess.Common.LfRectangle) = New List(Of Laserfiche.RepositoryAccess.Common.LfRectangle)()
                    Dim newRectangle As Laserfiche.RepositoryAccess.Common.LfRectangle = New Laserfiche.RepositoryAccess.Common.LfRectangle(x, y, width, height)

                    'Get a reference to the page to apply the redaction to...
                    Dim pInfo As PageInfo = Document.GetPageInfo(entryId, pageNumber, Me.RASession)

                    'Add the new rectangle to the collection...
                    imageRectangles.Add(newRectangle)
                    redaction.ImageRectangles = imageRectangles

                    'Add the new redaction to the page...
                    pInfo.AddAnnotation(redaction)

                End If

            'Report any errors to thw workflow instance...
            Catch ex As Exception
                Me.WorkflowApi.TrackError(ex.Message)

            End Try

        End Sub

 

1 0

Replies

replied on December 3, 2017

I don't believe this is possible without the use of custom scripting. The only way to dynamically add redactions that I know of is during the quickfields process and you cant lookup external documents to retrieve redaction positioning.

Probably the best you could do would be to load the xml redaction data into a sql data table, then use quickfields to query the database and apply the redactions. Not particularly elegant but that's about the best I can think of atm.

It would be nice to see the ability to add redactions from workflows added in the future.

1 0
replied on December 4, 2017

Both of these responses were extremely helpful.

 

Thank you!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.