Links
dtSearch Text Retrieval Engine Programmer's Reference 7.70
PDF hit-highlighting using lbvProt.dll
Highlighting hits in PDF files | Send Feedback

lbvProt.dll provides a way to highlight hits in PDF files using an Asynchronous Pluggable Protocol. This mechanism only works with an in-process WebBrowser control.

Remarks

The procedure to highlight hits in a local PDF file that was retrieved in a search is as follows: 

 

First, set up your project to use lbvProt.dll, which is a COM compoent. 

1. Register lbvProt.dll if it is not yet registered. To do this, open a Command Prompt window as Administrator and execute this command in the dtSearch BIN folder: regsvr32 lbvProt.dll 

2. In your .NET project, add a reference to "dtSearch lbvProt.dll Type Library" to your project (it will be in the COM tab of the Add Reference dialog box). 

 

Next, in the code that displays PDF files after a search, do the following to display the PDF file with hits highlighted:

  1. Create an lbvProt.LocalProtocol object (this should be done once per application instance, so the created object should be kept in calling application until the application exits).
  2. Call SearchResults.MakePdfWebHighlightFile to create the XML stream with the highlight information
  3. Call the LocalProtocol object's MakePdfUrl method with (a) the name of the PDF file, and (b) the highlight data. It will return a URL that can be used to open the PDF file with highlighting.
  4. Use the WebBrowser control's Navigate method to navigate to the URL.

In a .NET application, add a reference to the lbvProt.dll component to your project to access it using COM interop. 

C# Sample (using COM interop)  

if (pdfHighlighter == null)
    pdfHighlighter = new lbvProt.LocalProtocol();
String hl = searchResults.MakePdfWebHighlightFile();
String url = pdfHighlighter.MakePdfUrl(searchResults.DocName, hl);
webBrowser.Navigate(url);
URL Visibility

The URL returned by lbvProt.dll only works with an in-process WebBrowser control. Because lbvProt.dll is in the same process as the WebBrowser control, it can redirect the WebBrowser control to the correct location for the PDF file and XML highlight data. 

If you open a separate Internet Explorer window, it will not be able to use the the URL, because lbvProt.dll will not be running in the same process as the Internet Explorer instance.

64-Bit Applications

Because Adobe Reader does not currently run as a 64-bit application, PDF hit highlighting can only be done in 32-bit applications. A 64-bit application will not be able to invoke Adobe Reader except by launching it in a separate process.

Group
Links
You are here: Overviews > Highlighting Hits > Highlighting hits in PDF files > PDF hit-highlighting using lbvProt.dll
Copyright (c) 1995-2012 dtSearch Corp. All rights reserved.