vb.net - Acrobat API reading text from a specific area -
i have piece of code worked fine 3 years. i'm not sure happened server made stop working. reads text in funky characters !..||+$% instead of actual text.
i'm using vb.net , windows forms in visual studio 2010 acrobat pro can use api. please me.
dim objpdfpage acropdpage dim objpdfdoc new acropddoc dim objpdfavdoc new acroavdoc dim objacroapp new acroapp dim objpdfrecttemp object dim objpdfrect new acrorect dim textrangecount integer dim objpdftextselection acropdtextselect dim temptextcount long dim strtext string = "" dim pagecount integer = 0 dim pageindex integer dim itemname string = "" dim column integer = 0 objpdfdoc.open(txt_path.text) pagecount = objpdfdoc.getnumpages pageindex = 0 pagecount - 1 'get pages in pdf document objpdfpage = objpdfdoc.acquirepage(pageindex) 'get page real size objpdfrecttemp = objpdfpage.getsize 'draw rectangle around area want read objpdfrect.left = 50 objpdfrect.right = objpdfrecttemp.x - 350 objpdfrect.top = objpdfrecttemp.y - 300 objpdfrect.bottom = 650 'select text in rectangle area objpdftextselection = objpdfdoc.createtextselect(pageindex, objpdfrect) ' text of range try temptextcount = objpdftextselection.getnumtext textrangecount = 4 objpdftextselection.getnumtext 'get item number , exit loop 'itemname = itemname & " " & objpdftextselection.gettext(textrangecount - 1) itemname = objpdftextselection.gettext(textrangecount - 1) exit next catch ex exception msgbox("this error message rectangle around text. " & ex.message) objpdfdoc.close() end try 'set array contain item number , page number setarray(pageindex, itemname) next
Comments
Post a Comment