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: 28 ✭✭✭
    @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
    [email protected]
Sign In or Register to comment.