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
 PDFium property to detect text base PDF
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

jrpcguru

USA
266 Posts

Posted - Feb 20 2022 :  14:40:53  Show Profile  Reply
After your updates last year, we now have a property to identify PDFs that are fill in the blank forms. I wonder if we can get a property to identify PDFs that are text based? I would like to enable/disable right click menu options for selecting text and searching text depending on the status of the PDF.

The help file recommends:
// Allow user to select images or text and copy to clipboard (automatically detecting selection based on what is under the cursor)
ImageEnView1.MouseInteractGeneral := [ miPdfSelectText, miPdfSelectRgn ];
ImageEnView1.PdfViewer.Enabled := True;

But that appears to be tricky for getting the mouse cursor at just the right place to select the desired text, or it selects as an image instead. Separating these options into two menu options and disabling the text options when appropriate would make the program easier to use and understand.

Presently, the best I can do is use CanCopyToClipboard to warn the user and then disable text options.

J.R.

xequte

38608 Posts

Posted - Feb 20 2022 :  15:43:58  Show Profile  Reply
Hi JR

Probably the easiest way is just to test whether the page contains text:

// Enable the "Export Text" button if page contains text
btnSaveText.Enabled := Length( ImageEnView1.PdfViewer.GetText( 0, 100 )) > 10;


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

jrpcguru

USA
266 Posts

Posted - Mar 24 2022 :  14:33:08  Show Profile  Reply
I forgot to subscribe to this topic so I missed your reply for awhile. I'm pleased to report that your suggestion for detecting a text based PDF worked well and my right click menus are now customized appropriately. Thanks!

J.R.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: