Note: You must be registered in order to post a reply. To register, click here. Registration is FREE!
T O P I C R E V I E W
jrpcguru
Posted - Feb 20 2022 : 14:40:53 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.
2 L A T E S T R E P L I E S (Newest First)
jrpcguru
Posted - Mar 24 2022 : 14:33:08 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.
xequte
Posted - Feb 20 2022 : 15:43:58 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;