• Craig

    (@spedadvocate)


    Is it possible to pass a search word so that the pdf opens with that word(s) highlighted?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Thomas McMahon

    (@twistermc)

    Not sure if this is supported by the PDFJS library, but I’ll do some digging.

    Thread Starter Craig

    (@spedadvocate)

    I did some searching this weekend, and this is definitely above my pay grade but I found these three things and at least two look useful. But then again, you know the code and so much more. I am willing to beta test or whatever help I can offer.
    https://github.com/mozilla/pdf.js/issues/9831
    https://stackoverflow.com/questions/35501417/how-to-search-with-pdf-js
    https://blog.expertrec.com/pdf-js-search-text/

    Thread Starter Craig

    (@spedadvocate)

    Thomas:
    Ok, I did that which is forbidden. I modified some plugin code. But trivially and have it working. It finds the search word and highlights it. Would be nice if the search field opened, but this is great.
    I added three lines and now I can add whatever I want to the parameter string sent to the viewer. So I added in your top level code (not in one place, you can understand where):

     'user_param'  =>  '',
     $userparam   =  $incoming_from_handler['user_param'];
     $final_url .= $userparam;

    And all I did for the search was add user_param=&search=token to the shortcode.
    That gives me tremendous flexibility (and also the ability to really mess up). Should probably use quotes but worked fine without.
    Kindly consider adding to the plugin!
    -Craig

    • This reply was modified 4 years, 4 months ago by Craig.
    Plugin Author Thomas McMahon

    (@twistermc)

    Thanks for the great research! I’ll add it to the list of things to add.

    Plugin Author Thomas McMahon

    (@twistermc)

    I added support for highlighting some text in the latest version, but it only works with single words. It’s a step forward though.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Search on loading’ is closed to new replies.