0

The automation code below worked in Windows XP and Acrobat 8 & 9, where the GetPageNum would return the page number that the text was on. In Windows 8 and Acrobat 11, it always returns the first page.

Is there any alternative way to get page number of the text?

int returnval = -1;


var filePD = new Acrobat.AcroPDDoc();
filePD.Open(filelocation);
var fileAV = (Acrobat.AcroAVDoc)filePD.OpenAVDoc("Find");

if (fileAV.FindText("some type of text", 0, 0, 1))
{
    returnval = (int)fileAV.GetAVPageView().GetPageNum();
}

Thanks!

1 Answers1

0

We found no solution, except to

  1. Create a copy of the PDF
  2. Call FindText
  3. Delete Last Page
  4. Go back to #2, and repeat until FindText returns false

This then gets us the first occurrence of the text. This only works for unsecured PDFS.