ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Determine if all even pages of PDF are Blank
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Sidney Egnew

USA
55 Posts

Posted - Nov 15 2024 :  02:48:16  Show Profile  Reply
How can I determine if the even numbered pages (backs) of a PDF file are blank?

Here is my code:

procedure TfmMain.ProcessDocument(const p_FileName: String);
var
  v_ImageView: TImageEnView;
  v_Index: Integer;
begin
  v_ImageView := TImageEnView.Create(nil);
  try
    try
      v_Index := 1;
      repeat
        v_ImageView.ClearAll;
        v_ImageView.IO.Params.FileName := p_FileName;
        v_ImageView.IO.Params.ImageIndex := v_Index;
        v_ImageView.IO.LoadFromFilePDF(p_FileName);
        LogMessage(p_FileName+' Page='+IntToStr(v_Index));
        // DETERMINE IF PAGE IS BLANK
        v_Index := v_Index+2;
      until v_Index >= V_ImageView.IO.Params.ImageCount;
    except
      on E: Exception do
        LogMessage(p_FileName+': Error '+E.Message);
    end;
  finally
    v_ImageView.Free;
  end;
end;

Sidney Egnew

USA
55 Posts

Posted - Nov 15 2024 :  14:52:17  Show Profile  Reply
I was able to get this to work using:

v_ColorPercent := v_ImageView.Proc.GetDominantColor(v_RGB);
if v_ColorPercent > 99.9 then
  // Blank Page

All blank pages had a percentage > 99.9.

I posted the question because I found relevant messages and help content unclear on exactly how to use GetDominantColor. I needed to include the following to get it to work:

uses
  hyiedefs;
var
  v_ColorPercent: Double;
  v_RGB: TRGB;

Thanks
Go to Top of Page

xequte

38619 Posts

Posted - Nov 15 2024 :  17:15:50  Show Profile  Reply
Hi Sidney

Thanks for letting us know. We have improved the documentation.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: