Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PDF SaveAs to txt

Status
Not open for further replies.

sarduspater

Programmer
Jan 31, 2010
38
IT
I would convert a lot of PDF to txt using Vb or Vba.
My Pdf's files contains many tagged fields then I read for populate an Mdb.
Interactively it works fine, but I have too much files to process.
Reader doesn't work with Ole, by every using Acrobat 8 Professional I can't resolve my problem.
Thanks in advance,
Renato

Candu si tene su 'entu es prezisu bentolare.
 
With batch execution from Acrobat using Advanced/Document Processing/Batch Processing it works fine, but programmatically it's much interesting.
I open PDF file, but I cannot save it as txt(accessible).
Hi,
Renato

Candu si tene su 'entu es prezisu bentolare.
 
I found this in an adobe forum, but it has an error:

Sub yy()
savefile "C:\Aaa.pdf", "C:\Aaa.txt"
End Sub

Sub savefile(ByVal sfile As String, ByVal txtfile As String)
Dim acroApp, acroAV, acroPD, jso As Object
On Error GoTo ErrHandler
Set acroApp = CreateObject("AcroExch.App")
Set acroAV = CreateObject("AcroExch.AVDoc")
acroAV.Open sfile, "aaa"
Set acroPD = CreateObject("AcroExch.PDDoc")
Set acroPD = acroAV.GetPDDoc
Set jso = acroPD.GetJSObject
jso.mySaveas sfile, txtfile, "com.adobe.acrobat.text-plain"
acroPD.Close
Set acroPD = Nothing
Set acroAV = Nothing
Set acroApp = Nothing
Exit Sub
ErrHandler:
On Error Resume Next
MsgBox Err.Number & ": " & Err.Description, vbCritical
End Sub

and in acrobat this javascript function:

mySaveAs = app.trustPropagatorFunction(function(doc, path, type)
{
app.beginPriv();
doc.saveAs(path, type);
app.endPriv();
});

mySaveDoc = app.trustedFunction( function (doc, path, type)
{
app.beginPriv();
mySaveAs(doc, path, type);
app.endPriv();
});

Anyone can help me?
Thanks,
Renato

Candu si tene su 'entu es prezisu bentolare.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top