Hi guys,
I need help how to save PDF file using QTP.
In my application user generate PDF (script is ready); when PDF is open I need just save PDF on any drive. I try to record and play back, but don’t work for me.
Regards,
Gene.
what was the problem you were facing when u tried to save the PDF file?
I think u need to use Descriptive programming.
Thanks for reply.
The problem is that QTP were not able to see save button or file - save as option to save PDF.
I am beginner in QTP so for me Descriptive programming is WOW!
Could you please help me with that? I need any options (save button or file - save as) just to save PDF.
Regards,
Gene.
Try the following:
Code:
Window("<your pdf window name>").Click
Set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "%{F}" ' Press ALT+F
WshShell.SendKeys "{a}" ' Send the corresponding letter which is underlined, for 'save' under 'File' Menu. This opens a 'save a copy' dialog box
Window("<pdf window>").Dialog("Save a Copy").Click
Window("Adobe Reader").Dialog("Save a Copy").WinEdit("File name:").Set "<File Path>"
Window("Adobe Reader").Dialog("Save a Copy").WinButton("Save").Click
Set WshShell = Nothing
Let me know if u face any issues in object identification.
Thank you very much for code.
You are correct, I have a problem with window name object identification.
Below you can see PDF URL:
lifetimewealthanalyzer.com/lwp_pa/write/LWP_PA_109399_Current.pdf
Number 109399 is unique and always change. What should I do?