473,412 Members | 3,471 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

Find Text on PDF

Hi

I am using a Web Browser control to display a pdf file and I would like to find a way to use the find functionality from the pdf viewer, using vba code, to find a tag inside of the pdf.

In detail (see screenshot): I have one continuos subform (subform1) with record selectors. Whenever I click on a record on the subform1, I would like to use vba to get the string LineID and make a search on the pdf viwer using the "Find" tool.



How can I pass the string "Line Id" from the subform to the web browser (pdf viwer) and automatically perform the search?
Attached Images
File Type: jpg FindPdf.jpg (38.4 KB, 582 views)
Nov 18 '11 #1
1 6344
ADezii
8,834 Expert 8TB
There appears to be no easy way to accomplish this, but I did arrive at a rather bizarre solution involving SendKeys, a Programmed Delay, and simulated Keystrokes. I have tested it and it does work, but it may be a little flaky.
  1. Declaration in a Standard Code Module
    Expand|Select|Wrap|Line Numbers
    1. Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
  2. Code to execute:
    Expand|Select|Wrap|Line Numbers
    1. 'If nothing to find, get out!
    2. If IsNull(Me![txtFind]) Then Exit Sub
    3.  
    4. Me![WebBrowser1].SetFocus           'Set Focus to the Web Browser Control (WebBrowser1)
    5.  
    6. SendKeys "^f", True                 'CTRL+F will place Cursor in Find Box, in Browser (WAIT)
    7.   Sleep 3000                        'Delay 3 Seconds
    8. SendKeys Me![txtFind], True         'Type in the Text in the Text Box txtFind on the Form (WAIT)
    9. SendKeys "{ENTER}"                  'Simulate pressing the ENTER Key
  3. Text indicated in [txtFind], if it exists in the *.pdf Document, will now be highlighted.
Nov 24 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Les Juby | last post by:
I have an excellent search script which provides the visitor with the searched for text highlighted and positioned within the context of the preceding and following 10 words. However, some of...
2
by: actarus | last post by:
I need a Regex that find just a text inside a string that has both text and tags html, for example : string str = "<table ....><tr><td>my table</td></tr></table> I want a Regex that return just...
2
by: Faz | last post by:
I am trying to extract text before a certain character appears in a string. This character is the letter "C". Here is some sample data - the field is called REFERENCE_2: REFERENCE_2...
2
by: clintonG | last post by:
I only ask this here because it so happens that Windows Search requires filters to enable it to be used to find text in file types such as .aspx, ..cs and so on and is supposed to support doing so...
6
by: rdi | last post by:
I've got a combo-box of the drop-down style (not drop-down-list). The first item is "NHPI-Forms". If I type "NHPI-Forms" into the combo-box that string is supposedly not listed in the combo-box. ...
2
karenRoss
by: karenRoss | last post by:
Hi! Okay, here's the issue: I have a nested repeater with this: <td width="125px"><input type="text" name="M<%# DataBinder.Eval(Container.DataItem, "combos_id") %>" size="10"...
5
by: Piotrekk | last post by:
Hi Having a keyword i need to search HTML file for keyword dismissing all the tags, and checking only plain text. Is there an easy way to do it in C#? Thanks PK
1
by: JR | last post by:
Hi, I need a routine/finction that finds a text, starting at the selected node, where a given text is in. say i have some nodes with 1 'sonday' and another with 'son' and I look for 'so' it...
1
by: =?Utf-8?B?Sg==?= | last post by:
Please advise: Find text in Document works sometimes and not others when doing a searh in a 75 page document. If I search for the name Larry, it may bring up 3 names then it freezes. If I search...
0
by: tonegawa | last post by:
When I use the "find" function, it fails to find words written inside AutoShapes. bool ret = vk_word_app.Selection.Find.Execute(ref vk_find, ref vk_false, ref vk_false, ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.