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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JavaScript error

Status
Not open for further replies.

sarduspater

Programmer
Jan 31, 2010
38
IT
Using an example I tried to obtain to save a pdf file in txt format within acrobat 8 professional.

This is the code:

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();
});

JavaScript console of Acrobat says:

TypeError: doc.saveAs is not a function
4:Folder-Level:App:mySaveAs.js

What's wrong?

Thanks in advance

Candu si tene su 'entu es prezisu bentolare.
 
This is my code in vba:

Sub yy()
savefile "C:\myDir\Aaa.pdf", "C:\myDir\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.mySaveDoc 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

Candu si tene su 'entu es prezisu bentolare.
 
>jso.mySaveDoc sfile, txtfile, "com.adobe.acrobat.text-plain"
Try this.
[tt]jso.mySaveDoc [red]acroPD[/red], txtfile, "com.adobe.acrobat.text-plain"[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top