I am opening a PDF document fromm VBA excel. After opening document it should save the document as excel file or text file in one folder.
I am trying to do this with some code but not able to , pls help me thatnks.
Dim AcroApp As Acrobat.CAcroApp
Dim Part1Document As Acrobat.CAcroPDDoc
Set Part1Document = CreateObject("AcroExch.PDDoc")
Part1Document.Open ("Z:\EG MI Information\MIS\Requests\Req_156\NO.1.pdf")
Dim app As Object, avdoc As Object, pageview As Object
Set app = CreateObject("AcroExch.App")
Set avdoc = app.GetActiveDoc
Usage of the JSObject is shown in the VB Samples folder in the Acrobat SDK in this folder
[Acrobat SDK Install location]\Version 1\InterAppCommunicationSupport\VBSamples
and look in these two samples to see how to use the JSObject
There is also documentation on the JSObject here
Hope this helps
Thanks for your helpful information.
I need to install Adobe SDK first to gets examples. I tried using JSObject with some examples I found on Adobe site, but not able to activate menu. In below code "save as" is storing PDF file in machine code language inside text file. If you use "save as text" menu option from "file" main menu then it stores contents of pdf file into text file. and I want this to be done by code in VBA.
Dim Acroapp As CAcroApp
Set Acroapp = CreateObject("AcroExch.App")
Dim avdoc As CAcroAVDoc
Set avdoc = CreateObject("AcroExch.AVDoc")
Dim jso As Object
Dim PDDoc As CAcroPDDoc
Set PDDoc = CreateObject("AcroExch.PDDoc")
PDDoc.Open ("Z:\EG MI Information\MIS\Requests\Req_156\NO.1.pdf")
Set jso = PDDoc.GetJSObject
jso.SaveAs "Z:\EG MI Information\MIS\Requests\Req_156\temp.txt"
In the documentation for the saveAs function it has the following params
cPath The device-independent path in which to save the file.
cConvID (optional, Acrobat 6.0) A conversion ID string that specifies the conversion
cFS (optional, Acrobat 7.0) A string that specifies the source file system name.
bCopy (optional, Acrobat 7.0) A Boolean value which, if true, saves the PDF file
as a copy. The default is false.
bPromptToOverwrite (optional, Acrobat 7.0) A Boolean value which, if true, prompts the user if
the destination file already exists. The default is false.
In order to get a text file saved you need to specify the correct cConvID.
See the documentation for the valid convID's - http://livedocs.adobe.com/acrobat_sdk/10/Acrobat10_HTMLHelp/JS_API_Acr oJS.88.519.html
Please note the Acrobat SDK contains all the information and does not require much installing ( as it is a zip file(on windows) and a disc image (on Mac) it just needs extracted)
Thanks for your time & efforts. I think this will solve my task but when I use "save as" options it gives me error of 448, "Named argument not found", I checked for this and found that I have 2 versions of adobe oe is Adobe5 & another one is Adobe 7.
my code opens Adobe 5 version window first and then opens my document in this window. Now I am trying to open it in Adobe 7 version window. do you have any clue for it.
jso.SaveAs cPath:="Z:\EG MI Information\MIS\Requests\Req_156\teNO1.txt", cConvID:="com.adobe.acrobat.plain-text"
No, that functionality is not available in that EXTREMELY OLD version.
Also, even if you were using Acrobat 7, we could not help you as we no longer support that version either.
You need to upgrade to Acrobat 9.
Thanks for your information. If I install Adobe reader 9.0 version on my system then will we be able to select adobe reader 9.0 version to open my pdf file? and also use above mentioned save as option to save file in text format ?
The Adobe Reader software can only save files if they have been enabled by the LiveCycle Reader Extension's Server or Acrobat Professional, if you have an enabled PDF file then the script should work, although please note the documentation which says.
Note: This method can only be executed during a batch or console event. See Privileged versus
Please see the documentation for more information