Groups > Software Support > Adobe Acrobat Scripting > Re: PDF to TXT Conversion




PDF to TXT Conversion

PDF to TXT Conversion
Wed, 7 May 2008 09:27:21 -0700
I'm using Acrobat Standard 8.1.0.

I would like to run from Excel VBA a process to convert PDF files into TXT
files. The same affect of opening the files in Acrobat and clicking on Save As
and changing the filetype to .txt. I've looked through the online SDK and am
rather familiar with VBA, etc. I get the following error no matter what syntax I
use to try to save the file as anything other than a pdf file. Here's my code
and the error:

Code:

Dim AcroXApp As Acrobat.AcroApp
Dim AcroXAVDoc As Acrobat.AcroAVDoc
Dim AcroXPDDoc As Acrobat.AcroPDDoc
Dim Filename As String

Filename = "R:\My Documents\ZBIR006A_8781830 - DRC000004311.pdf"

Set AcroXApp = CreateObject("AcroExch.App")
AcroXApp.Show

Set AcroXAVDoc = CreateObject("AcroExch.AVDoc")
AcroXAVDoc.Open Filename, "Acrobat"

Set AcroXPDDoc = AcroXAVDoc.GetPDDoc

Dim jsObj As Object
Set jsObj = AcroXPDDoc.GetJSObject

jsObj.SaveAs "R:\My Documents\pdfTest.txt",
"com.adobe.Acrobat.plain-text"

AcroXAVDoc.Close False
AcroXApp.Hide
AcroXApp.Exit

Error:
On the jsObj.SaveAs line I get the following error:
"UnsupportedValueError: Value is unsupported. ===> Parameter cConvID.
Doc.saveAs:-1:

Post Reply
Re: PDF to TXT Conversion
Wed, 7 May 2008 09:43:55 -0700
Post Reply
Re: PDF to TXT Conversion
Wed, 7 May 2008 09:47:24 -0700
It would appear that the string "com.adobe.Acrobat.plain-text" is not
a supported "cConvID". You can use:

console.show();
console.clear();
for ( var i = 0; i < app.fromPDFConverters.length; i++)
console.println(app.fromPDFConverters[i]);

Post Reply
Re: PDF to TXT Conversion
Wed, 7 May 2008 10:52:32 -0700
Post Reply
Re: PDF to TXT Conversion
Mon, 19 May 2008 23:21:33 -070
Hello!

I try this code above and I 've got message on saveas:

NotAllowedError: Security settings prevent access to this property or method.

Any suggestions?

Post Reply
<< Previous 1 2 Next >>
( Page 1 of 2 )
about | contact