Solved Access Webbrowser Control and PDF (1 Viewer)

asadkhan

Registered User.
Local time
Today, 09:06
Joined
Oct 26, 2019
Messages
52
Hello everyone
I have been trying to search the contents of PDF which is displayed in webbrowser control, form has a text box pre populated with some text when it is clicked the focus is shifted to the webbrowser control and with some delay it opens find replace dialog box which is fine, and does copies the text in the box as well. Now the problem is, or rather I want it to search contents in PDF but apparently it doesn’t invoke the find option of PDF reader instead access find replace dialog box comes up which doesn’t seems to find phrase in pdf. Below is the code I have found from utter access website from Adezil

Code:
Private Sub txtFind_Click()

If IsNull(Me![ txtFind]) Then Exit Sub

Me.WebBrowser0.SetFocus         'Set Focus to the Web Browser Control (WebBrowser1)

SendKeys "^f", True                 'CTRL+F will place Cursor in Find Box, in Browser (WAIT)

Sleep 3000

 

SendKeys Me![ txtFind], True         'Type in the Text in the Text Box txtFind on the Form (WAIT)

SendKeys "{ENTER}"                  'Simulate pressing the ENTER Key

 

End Sub
regards
 
Last edited:

theDBguy

I’m here to help
Staff member
Local time
Today, 01:06
Joined
Oct 29, 2018
Messages
21,473
Can you post a demo db? If you do it manually, are you able to search the PDF?
 

asadkhan

Registered User.
Local time
Today, 09:06
Joined
Oct 26, 2019
Messages
52
Can you post a demo db? If you do it manually, are you able to search the PDF?
Hi thanks for taking this up. Yes it does allow to search manually with ctrl F and copying search term in PDF find dialog. I am afraiad I can’t post dB here as I work for Health Service.
it also works fine for webpages takes search term and highlights it. I am using 365 and latest version of Acrobat Reader.
thanks and regards
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:06
Joined
Oct 29, 2018
Messages
21,473
Hi thanks for taking this up. Yes it does allow to search manually with ctrl F and copying search term in PDF find dialog. I am afraiad I can’t post dB here as I work for Health Service.
it also works fine for webpages takes search term and highlights it. I am using 365 and latest version of Acrobat Reader.
thanks and regards
Could you sanitize the db, so there are no sensitive data? In any case, SendKeys should basically be doing the same thing as if you did it manually, I think.
 

asadkhan

Registered User.
Local time
Today, 09:06
Joined
Oct 26, 2019
Messages
52
Could you sanitize the db, so there are no sensitive data? In any case, SendKeys should basically be doing the same thing as if you did it manually, I think.
Hi
The dB is on work machine it is not possible to get it copy
I can explain it….
There is a form in which there is a bound text box which have a unique number when I click that number it copies the number and with some delay it opens up find and replace which not the of adobe reader and then says not found. I cans do that manually but not with Sendkeys. Which is basically the desired outcome. PDFs are letters.
 
Last edited:

asadkhan

Registered User.
Local time
Today, 09:06
Joined
Oct 26, 2019
Messages
52
Hi
The dB is on work machine it is not possible to get it copy
I can explain it….
There is a form in which there is a bound text box which have a unique number when I click that number it copies the number and with some delay it opens up find and replace which not the of adobe reader and then says not found. I cans do that manually but not with Sendkeys. Which is basically the desired outcome. PDFs are letters.
Hi Mr dB Guy
Thank you for your help
I was looking at the example of Mr Arnel GP where he has displayed documents in the webbrowser control. I noticed he has used the probably tab form which doesn’t pop up I have forgotten what term is used for that type anyhow I was using pop up form that is why sendkeys were not working as soon as I changed the form layout to tab one it started working. I am very thankful to you and Mr GP. By the way I have changed my way of referencing the control to Mr Arnel’s browse method. And of course big thanks to Adezil of Utter Access for the SendKeys Code.
happy days.
 
Last edited:

theDBguy

I’m here to help
Staff member
Local time
Today, 01:06
Joined
Oct 29, 2018
Messages
21,473
Hi Mr dB Guy
Thank you for your help
I was looking at the example of Mr Arnel GP where he has displayed documents in the webbrowser control. I noticed he has used the probably tab form which doesn’t pop up I have forgotten what term is used for that type anyhow I was using pop up form that is why sendkeys were not working as soon as I changed the form layout to tab one it started working. I am very thankful to you and Mr GP. By the way I have changed my way of referencing the control to Mr Arnel’s browse method. And of course big thanks to Adezil of Utter Access for the SendKeys Code.
happy days.
Congratulations! Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Top Bottom