26 January 2010

Quick Test Professional Automation with Adobe PDF Documents - VI

Saving Adobe documents - any open document 

Set AcroExchApp = CreateObject("AcroExch.App")
Get an object of the class App

loopCount = AcroExchApp.GetNumAVDocs
Getting the number of open documents in Adobe

For i = 0 to loopCount – 1     Loop through each open document in Adobe
Set AVDoc =  AcroExchApp.GetActiveDoc         Get AVDoc object from the active document
Set pdDoc = AVDoc.GetPDDoc        Get PDDoc object from AVDoc
docTitle = AVDoc.GetTitle       Get the document's title
Set jso = pdDoc.GetJSObject      Get the java object from PDdoc class
jso.saveAs("/C/Automation DATA/" & docTitle &"_" & i & ".pdf") 
        Save the document as specified by the path including the document name to save with
AVDoc.Close(1) Close document without saving - depends on the parameter given

No comments:

Post a Comment