Quantcast
Channel: Adobe Community : Popular Discussions - JavaScript
Viewing all articles
Browse latest Browse all 12130

PDF to TXT Conversion

$
0
0
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:

I've looked through all of the documentation online and cannot come up with a reason why I'm not able to do this. Please help!!

Viewing all articles
Browse latest Browse all 12130

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>