Copy link to clipboard
Copied
Hi Colleagues,
I need some help from you.
I need to write test case in VBscript for QTP / UFT (12.51)
QTP should launch Adobe Acrobat Pro 9, 10, 11 (all available on testing machines) open existing PDF file from testing folder. Find some text in the PDF document. Select this text and replace with another text. Save changes. Close file. Close Acrobat. Everything looks very simple but I spent 2 days without results. And didn’t find any working code solution.
findText() method didn’t find the text and I can’t proceed
Thank you in advance for any help and advice.
Copy link to clipboard
Copied
I don't know how you can say this sounds simple... there is no JavaScript method that can change page contents (as opposed to form fields or annotations).
Copy link to clipboard
Copied
But Adobe Acrobat have "Edit Document Text" function.
You click it, then click on the text you would like to select and can operate with it how you can do it in MS Word.
http://help.adobe.com/livedocs/acrobat_sdk/9/Acrobat9_HTMLHelp/wwhelp/wwhimpl/js/html/wwhelp.htm?hre...
There is a good documentation and description of all methods.
May be it is possible to find text, select it, and then using QTP tools perform the action of editing.
Copy link to clipboard
Copied
Ah, so you assume that because it is easy in the UI it is easy in JavaScript. These are entirely differently written, with different rules and approaches. Also, the JavaScript API is tiny - perhaps 5% of the API compared to the plug-in API for C programmers. But even in the plug-in API you cannot work with the text editing tool; you have to implement editing painfully using the PDF specification and plug-in abstraction of it. To work with JavaScript you have to start with a study of what is possible via looking at the whole API.
I have no idea what QTP is, but if it can simulate clicks and keystrokes, you can try it. But remember this can and will change between releases of Acrobat.
Copy link to clipboard
Copied
Thank you for your answer, but I still need a help. QTP is a very strong automation tool of HP company for web and desktop automation testing. It uses VBscript. You write about JavaScript. I don't know does it matter or no.
the problem that I stuck on the step to "findText() " method wich should find text in PDF document.
In the next steps I will try to manipulate with it... but it didn't work in my case but should be.
Copy link to clipboard
Copied
You most likely will need to use an external computer language like C and then use the Acrobat SDK API tools to interact with the PDF.
Copy link to clipboard
Copied
I have told you clearly. There is no such method for you.