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

Question

Question

Can workflow determine the DPI of the starting entry?

asked on July 31, 2015

I'm trying to add a date "stamp" to a document. On 300x300 DPI, the position is where I'd like it to be; on 600x600, the textbox is sized and positioned incorrectly. 

0 0

Replies

replied on August 5, 2015

There are no built-in activities for it. You would have to use an SDK script to retrieve the first page of the document and read the image resolution.

2 0
replied on December 22, 2016 Show version history

Here is an SDK Script that will read the pages of a document and return the highest resolution and page number as tokens.  (Depending on how they are onboarded LF document pages can have different resolutions so returning the resolution of the first page might not be entirely accurate).

        Protected Overrides Sub Execute()
            Dim pageNumber As Integer = 0
            Dim resolution As Integer = 0

            Try

                'Check to see if the bound entry is a document...
                If Me.BoundEntryInfo.EntryType <> EntryType.Document Then

                    Throw New Exception("Bound entry must be a document.")

                Else

                    Using docInfo As DocumentInfo = DirectCast(Me.BoundEntryInfo, DocumentInfo)
                        Dim reader As PageInfoReader = docInfo.GetPageInfos

                        For Each page As PageInfo In reader
                            If (page.ImageXResolution > resolution) Then
                                resolution = page.ImageXResolution
                                pageNumber = page.PageNumber
                            End If
                        Next

                        reader.Close

                    End Using

                End If

            Catch ex as Exception
                Me.WorkflowApi.TrackError(ex.message)

            End Try

            Me.SetTokenValue("Resolution", resolution)
            Me.SetTokenValue("PageNumber", pageNumber)

        End Sub

 

4 0
replied on July 23, 2018

I would like to request this as a feature in the future. When adding a textbox or stamp it would be nice to either:

  1. Have the ability to know the DPI of the first page so we can apply an appropriately sized annotation
  2. Have the annotations have an option for percentage, like QuickFields does for zone OCR, so that the DPI does not matter
2 0
You are not allowed to follow up in this post.

Sign in to reply to this post.