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

Question

Question

How can I delete the last page of a tiff document with workflow

asked on March 5, 2014

 

I need to delete the last page of a document that it is scanned and used as a separator. The Customer does not use quick field and do not want to use it.

 

So I need to remove the last document page and also the blank page, I found s scrript in the answer forum to remove blank page but I do not see how can I remove also the last page

0 0

Answer

SELECTED ANSWER
replied on March 5, 2014 Show version history

Rene,

 

Here are two code snippets to delete the last page of the document.  The first one is RA and the second one is LFSO. 

 

RA (Workflow 9.1)

            'Make sure we wrap the code in a Try Catch to catch errors...
            Try

                'Get a reference to starting entry...
                Dim docInfo As DocumentInfo = Me.BoundEntryInfo
          
                'Lock the document...
                docInfo.Lock(LockType.Exclusive)

                'Delete the page and persist the changes...
                'NOTE: The docInfo.PageCount parameter targets the last page
                'of the document...
                docInfo.DeletePage(docInfo.PageCount)
                docInfo.Save()

                'Unlock the target document...
                docInfo.Unlock()

                'Cleanup...
                docInfo.Dispose()

            Catch ex As Exception
                
                'Report any errors to workflow...
                WorkflowApi.TrackError(ex.message)

            End Try

  

 

LFSO (Workflow < 9.1)

        Try
            'Get a reference to the starting entry and its pages...
            Dim lfDoc As LFDocument = Me.Entry
            Dim lfDocPages As LFDocumentPages = lfDoc.Pages

            'Lock the document....
            lfDoc.LockObject(Lock_Type.LOCK_TYPE_WRITE)

            'Mark the last page of the document...
            lfDocPages.MarkPageByIndex(lfDocPages.Count)

            'Delete the marked page...
            lfDocPages.DeleteMarkedPages()

            'Persist the changes and unlock document...
            lfDocPages.Update()
            lfDoc.UnlockObject()

            'Cleanup...
            lfDoc.Dispose()

        Catch ex As Exception

            WorkflowApi.TrackError(ex.Message)

        End Try

 

Let me know if this helps...

3 0

Replies

replied on March 7, 2014 Show version history

For those that are shy about using the Script activities or would like some additional flexibility, I created a custom workflow activity to delete document pages.  Page delete options include all pages, first page, last page, page range or empty pages.  Empty page detection can be based on page image size or lack of page text.  The custom activity is available at http://www.qfiche.com

 

3 0
replied on March 6, 2014

Thanks that helped me

0 0
replied on March 7, 2014

Hi Cliff, Thanks again for the help you gave me, I took a look at your custom delete pages activity. and install it on a test server and I do not see where to put the page delete option. the only things I see is the name of the activity, description and the box to choose which entry to use.

 

I install it on a V9.0.2 workflow.

0 0
replied on March 7, 2014 Show version history

Ron - The activity should work on a 9.02 system.  If you have a bit of time can you provide your email address and I can PM you with some things to check?  If you can, could you check the error logs in the Workflow Admin console.  If the activity is causing an error while loading in the Designer there should be some entries in the activity errors log.

1 1
replied on March 7, 2014

Rene,

 

I brought up a test 9.02 system and can duplicate the issue.  If you look at the error pane in the designer you will see that the custom activity is trying to load Laserfiche.Project.dll and cannot locate it.  I verified that the dll does indeed exist on the test machine.  I applied the 9.02.618 hotfix and still got the error. 

 

I then upgraded that installation to 9.1.1.365 and the custom activity now loads without error.

 

I will reload the 9.02 system and see if I can get some feedback from tech support on the issue.

 

Thanks for taking the time to download and install the custom activity.

 

Take care!

0 0
replied on August 6, 2014

Cliff, did you get some feedback from tech support about this issue ? We get the same problem here.

 

Thank you

0 0
replied on August 6, 2014

This is not a Tech Support issue. Activities written for Workflow 9.1 have dependencies on files installed with WF 9.1 and can't run on lower versions.

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

Sign in to reply to this post.