Skip to main content
Participant
Aug 30, 2018 11:26 AM UTC
Answered

Add a search function

Hello

Is there a way to add a search function to an interactive PDF when viewed in a browser (ie NOT Acrobat reader).

I have found a method using this Javascript:

var textToSearch = this.getField("Search Term").valueAsString;

if (textToSearch!="") search.query(textToSearch, "ActiveDoc");

But, when viewed through a browser it does work.

Am I asking the impossible?

Many thanks

This topic is closed to new replies. Start a new post to keep the conversation going.
paulhilkenCorrect answer
Participant
Aug 30, 2018 11:35 AM UTC

There's no real way to ensure it will work if the file is opened inside a browser window, as most browsers use their own PDF plugins, and those plugins are not likely to execute the code correctly. For best results instruct the users to download the file and open it in Adobe Reader.


OK - Many thanks try67.

I thought this might be the case, but worth an ask on here just in case

6 replies

try67
Community Expert
Community Expert
Aug 30, 2018 11:28 AM UTC

What browser are you using? What PDF plugin is being used in it to display

the file?

Translate
Participant
Aug 30, 2018 11:31 AM UTC

I'm using safari - however my client will be using different browsers across different locations and on different systems.

A mine field I know…

Translate
try67
Community Expert
Community Expert
Aug 30, 2018 11:33 AM UTC

There's no real way to ensure it will work if the file is opened inside a browser window, as most browsers use their own PDF plugins, and those plugins are not likely to execute the code correctly. For best results instruct the users to download the file and open it in Adobe Reader.

Translate