How to Save PDF file to text format
Hi All,
I need to use TestComplete to save the PDF file into text format. The scenario is as follow :
Scenario
1) It is a web based application. In the application there is button,when I click on the button it will show dialog box below.
2) I am able to open the PDF file by clicking on the PDF button.
3) PDF file open in Adobe Reader, now I need to Save the PDF as text format by going to File - SaveAsOther and select the Text option
4) I tried the recording this part, but it is not working as well not reliable. Also tried using shell script with the send keys but it is not Saving it.
I am not sure what is the issue.For the sendkeys my assumption is that it is not able to work on the PDF file,but then I tried activating and also maximizing it but it does not work. Please let me know if you have better or reliable solution
Below is my code :-
Function func_SavePDFToText(arg_FolderPath) 'Aliases.browser.BrowserWindow.FrameNotificationBar.Wa 'Click on the open button to open the PDF File If Aliases.browser.BrowserWindow.FrameNotificationBar.Exists Then Call Aliases.browser.BrowserWindow.FrameNotificationBar.Click 'this statment to have the focus on the notificaton bar Call Aliases.browser.BrowserWindow.FrameNotificationBar.Item.buttonOpen.ClickButton End If If Sys.WaitProcess("AcroRd32 *32",1000).Exists Then Call Aliases.AcroRd323.wndAcrobatSDIWindow.Activate Call Aliases.AcroRd323.wndAcrobatSDIWindow.Maximize 'Save the PDF file to Text Set oShell = CreateObject("WScript.Shell") oShell.SendKeys("%Fhx") Delay(500) strFileName=Aliases.browser.dlgSaveAs.DUIViewWndClassName.Explorer_Pane.FloatNotifySink.ComboBox.Edit.wText oShell.SendKeys(arg_FolderPath&"\"&strFileName&func_CreateDateTimeStamp()&".txt") Delay(500) oShell.SendKeys"{ENTER}" oShell.SendKeys("^%Fx") func_SavePDFToText=strFileName End If
Hi nimishbhuta
nimishbhuta wrote:
Also tried using shell script with the send keys but it is not Saving it.
Try simply clicking somewhere inside a pdf file to activate the window and call the SendKeys method.
If this doesn't work, could you please explain what you mean by "Also tried using shell script with the send keys but it is not Saving it. "? if you get errors, give us their text.