QTP Version 10
Adobe Acrobat Reader : 10.1.1
ATTP plugin from adobe....
All works fine...
Activex component can’t create object ‘acroexch.app’ or Working with PDF
For working with PDF you require to have PDF writer installed in the system.
To use “AcroExch.PDDoc” object, you have to install Adobe Acrobat (Adobe Acrobat is writer which is chargeable or has trial for 30 days) on your computer.
Check whether “AcroExch.PDDoc” object is available on your computer. For that, open a registry and check the path: HKEY_CLASSES_ROOT\AcroExch.PDDoc
If “AcroExch.PDDoc” key exists, then you can use Acrobat OLE Automation in your QTP scripts,else you need to install the software
Solution Code :
'' This code opens the pdf file, make sure it used IE
Public Function zOpenPDF(spdfPath)
''Close all IE before opening
SystemUtil.CloseProcessByName("iexplore.exe")
wait(3)
SystemUtil.Run spdfPath
wait(3)
End Function
Public Function zSaveAsPDF(pdf_path_SaveAs)
Set WshShell = CreateObject("WScript.Shell")
Window("Windows Internet Explorer").Activate
WshShell.SendKeys "+^{S}"
wait(5)
WshShell.SendKeys pdf_path_SaveAs
wait(2)
WshShell.SendKeys "~"
wait(2)
End Function
Public Function zClosePDF()
wait(3)
Window("Windows Internet Explorer").Activate
sIETitle=Window("Windows Internet Explorer").GetROProperty("Title")
Window("Windows Internet Explorer").Close
End Function
Solution Code :
'' This code opens the pdf file, make sure it used IE
Public Function zOpenPDF(spdfPath)
''Close all IE before opening
SystemUtil.CloseProcessByName("iexplore.exe")
wait(3)
SystemUtil.Run spdfPath
wait(3)
End Function
Public Function zSaveAsPDF(pdf_path_SaveAs)
Set WshShell = CreateObject("WScript.Shell")
Window("Windows Internet Explorer").Activate
WshShell.SendKeys "+^{S}"
wait(5)
WshShell.SendKeys pdf_path_SaveAs
wait(2)
WshShell.SendKeys "~"
wait(2)
End Function
Public Function zClosePDF()
wait(3)
Window("Windows Internet Explorer").Activate
sIETitle=Window("Windows Internet Explorer").GetROProperty("Title")
Window("Windows Internet Explorer").Close
End Function