Search pdf and copy page numbers which having the search result to txt

Hi,
I’m very new to applescript. could someone help me with the below.

  1. Search pdf for text . In my case either “fruit” or “vegie”.
  2. Get the page numbers having either “fruit” or “vegie” to a text file. coma separated.

Thanks:)
DC