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 ShowAllPages versus FindDialog
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

jrpcguru

USA
266 Posts

Posted - Feb 17 2022 :  17:03:53  Show Profile  Reply
When ShowAllPages is true, the FindDialog uses the PdfViewerDefaults.SelectionColor and as you click Next, the previously found text loses its highlight and returns to normal display.

If ShowAllPages = false, the FindDialog successfully searches and finds the desired text. But when you click Next, the previously found text turns opaque black or sometimes even shows some graphical artifact. In any case the previously found text is unreadable.

Is there a property that I haven't found that controls the color of the newly unselected text?

This is consistent if I use code to turn on ShowAllPages or use the icon in the PDFViewer autotoolbar.

I just noticed that the graphical artifacts that show up when I highlight some text is an image of the toolbar! This was obvious when I just tried to select some text and copy it to the clipboard.

Extra note: today I've been trying to find a crucial difference between the demo, which works correctly, and my program. No luck so far. But I've noticed that just a slight change in zoom fixes the artifacts left behind by clicking Next and text becomes readable again. Clicking Next again causes the same problem.

One possible difference is that my program shifts back and forth between PDFium and regular ImageEnView, as needed, but the demo is purely PDFium.

Additional note: I now find that a similar thing happens when selecting text but not images via:
ImageEnView1.MouseInteractGeneral := [ miPdfSelectText, miPdfSelectRgn]
The selection of text is a combination of graphical artifacts and black, and after copying to the clipboard via PdfViewer.CopyToClipboard()the selection is properly hi-lited. The actual clipboard copy works correctly.

It gets even crazier if I use the buttons on the toolbar. Selecting text works the same, but when I click the button to copy to the clipboard, the selection remains black. Until I change focus to another program.

J.R.

xequte

38608 Posts

Posted - Feb 18 2022 :  22:10:49  Show Profile  Reply
Hi JR

As you said, I cannot reproduce the issue in our demos. Clearly there is an issue erasing the previous selection rect, either the repaint is not occurring or the position is not valid. Unfortunately there is nothing in the code that looks amiss. Are you able to simplify your demo to something that we can debug?



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

jrpcguru

USA
266 Posts

Posted - Feb 20 2022 :  14:28:30  Show Profile  Reply
Your suggestion about painting has proven correct.


procedure TForm1.FindNextintextPDF1Click(Sender: TObject);
begin
if not ImageEnView1.PdfViewer.FindNext( false ) then         
    MessageDlg( 'The text could not be found', mtInformation, [ mbOK ], 0 )
else
  ImageEnView1.PdfViewer.Refresh;

end;

By refreshing the PDFViewer after each FindNext, the display is correct. This will require my own TFind since I can't refresh the display when searching using the toolbar.

Similarly, if I want to select text in a PDF the image is messed up with graphic artifacts from the document above the cursor location, but putting this code in the ImageEnView1.OnMouseUp works to fix things:

if (ImageEnView1.PdfViewer.Enabled) and ( ImageEnView1.PdfViewer.PageCount > 0 ) then
    begin
      if SelectPDFtext.Checked = true then
        ImageEnView1.PdfViewer.Refresh ;
    end;


Clearly I'm going to have to convert the demo to view both .JPG and .PDF using my code and see if I can pin down what is causing this!

J.R.
Go to Top of Page

xequte

38608 Posts

Posted - Feb 20 2022 :  15:45:16  Show Profile  Reply
Hi JR

I'd like to fix the issue on my end, so if you can narrow down the source of the issue it would be a great help.

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