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

dts_svr.exe provides a way to highlight hits in PDF files using a local-only HTTP server

Remarks

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

  1. Call SearchResults.MakePdfWebHighlightFile to create the XML stream with the highlight information
  2. Create a dts_svr.Application object (this should be done once per application instance, so the created object should be kept in calling application until the application exits).
  3. Call the dts_svr 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.

Visual Basic Sample (from the vbsearch sample application)

Dim highlightInfo As String
highlightInfo = Results.MakePdfWebHighlightFile
If Not MadePdfHighlighter Then
    Set PdfHighlighter = New dts_svr.Application
    MadePdfHighlighter = True
End If
Dim PdfUrl As String
PdfUrl = PdfHighlighter.MakePdfUrl(fn, highlightInfo)
htmlViewer.Navigate (PdfUrl)

C++ Example 

In C++, use the MFC class wizard to make a C++ class for the type library in dts_svr.exe. In the calling application, make a dts_svr object, which should be kept until the program exits. Call MakePdfWebHighlightFile to make the xml stream, and then call MakePdfUrl to make a URL to use for CHtmlView::Navigate2(). 

 

if (!m_pPdfHighlighter) {
     COleException error;
     m_pPdfHighlighter = new Cdts_svr;
     m_pPdfHighlighter->CreateDispatch(_T("dts_svr.Application"), &error);
     }

DString highlightXml;
results->MakePdfWebHighlightFile(highlightXml);
CString csUrl = m_pPdfHighlighter->MakePdfUrl(results->DocName.getUi(), Utf8ToUi(highlightXml));
Navigate(csUrl);

Software firewalls 

Because dts_svr.exe communicates with Adobe Reader via HTTP, it may trigger a warning from some software firewalls. dts_svr.exe does not actually communicate with any other computer, but if the firewall software blocks dts_svr.exe from listening on an HTTP socket, then dts_svr.exe will not be able to respond to a request from Adobe Reader for the PDF file. Therefore, some firewall software may have to be configured to allow dts_svr.exe to communicate via HTTP. 

The firewall software included with Windows XP Service Pack 2 will display a message the first time dts_svr.exe runs, but will not affect its function whether or not "Blocking" is enabled. 

Highlighting hits in a client application using Adobe Reader 7 

Some versions of Adobe Reader 7 could highlight hits in an embedded browser window even if the PDF file was referenced using a local path.�� However, this capability disappeared with the Adobe Reader 7.05 patch. Therefore, the HTTP-based method of highlighting hits is currently the only method that works consistently across Adobe Reader versions.

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