Grooper 21.00.0082 is available as of 12-12-2023! Check the  Downloads Discussion  for the release notes and to get the latest version.
Grooper 23.1.0016 is available as of 03-15-2024! Check the  Downloads Discussion  for the release notes and to get the latest version.
Grooper 23.00.0042 is available as of 03-22-2024! Check the Downloads Discussion for the release notes and to get the latest version.

Conditional Blank Page Removal

I added a step to remove blank pages from inbound PDFs before data extraction so that page numbers in the exported data will line up with processing done in a parallel system.  Unfortunately, the other system does not remove blank pages when they are the first or second pages in the image.  Is there a way to configure a page removal step to check all pages except the first two, or can someone point me in the right direct to create an object library that can remove the blank pages?

Answers

  • BrianBrian Posts: 30 ✭✭✭
    @Sdurbin Hey Scott,
    I am unaware of a native method to handle your scenario; however, it can be accomplished via scripting as you implied.  In your object library, create a class that inherits from EventSeparator (reference Grooper.Capture.dll), and override the GetDisposition method.  When that method is invoked, and null (or Nothing) is returned, the separation decisions are ignored.  Essentially, you'll be checking whether Page.NodeIndex (0-based) is less than 2 to return null or continue with the result of the base class behavior.

    In C#, it should look something like this (below).  FYI, for grins, I added a property so you can set the number of pages to skip rather than having it hard-coded in your overridden method.

    using Grooper;
    using Grooper.Capture;
    using Grooper.Core;
    using System.ComponentModel;
    using System.Runtime.Serialization;

    namespace Sdurbin
    {
        [DataContract, DisplayName("Sdurbin Separation")]
        class Separation : EventSeparator
        {
            public Separation(ConnectedObject Owner) : base(Owner) { }

            [DataMember, Viewable, DV(1), DisplayName("Number of Pages to Skip")]
            public int PagesToSkip { get; set; }

            protected override SeparationDisposition GetDisposition(BatchPage Page, int Seq, object Context)
            {
                if (Page.NodeIndex < PagesToSkip) return null;
                return base.GetDisposition(Page, Seq, Context);
            }
        }
    }
    Brian Godwin
    Solutions Manager
    bgodwin@bisok.com
Sign In or Register to comment.