Why do I get a "NotAllowedError: Security settings prevent access to this property or method" when trying to Use SaveAs in Acrobat 9 Pro

First off I saw the solution posted previously by khkremer to TerranRich on 3.12.2009. I am having the same issue (using VBA in Access 2003). I confirmed that all the Javascript execution permissions in Preferences are checked. What else might be causing this? I have over a 1,000 pdf's to convert to text files so doing them by hand is somewhat out of the question. The code is attached, & seems pretty straightforward. The funny thing is I remember running this some tme ago and not having a problem.

Thanks.
Dim AcroXApp As Object
    Dim AcroXAVDoc As Object
    Dim AcroXPDDoc As Object

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

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

    AcroXAVDoc.BringToFront

    Set AcroXPDDoc = AcroXAVDoc.GetPDDoc

    Dim jsObj As Object
    Set jsObj = AcroXPDDoc.GetJSObject

    jsObj.SaveAs strFullPath, "com.adobe.acrobat.plain-text"

    AcroXAVDoc.Close False
    AcroXApp.Hide
    AcroXApp.Exit

Open in new window

TipstarAsked:
Who is Participating?
 
leakim971Connect With a Mentor PluritechnicianCommented:
So did you try to change the extension ? Currently you're using the same filename
0
 
TipstarAuthor Commented:
Oh, I forgot to mention that I am able to do SaveAs from the PDF document itself.
0
 
leakim971PluritechnicianCommented:
SaveAs need to be run in a Privileged context
Check this : http://acrobatusers.com/tutorials/how-save-pdf-acrobat-javascript

you need to create a js file inside the javascripts folder of your acrobat folder installation, for example saveItForMe.js
A very simple one (too simple, use the one in the link provided)



var saveItForMe = app.trustedFunction(oDoc,cPath,cFlNmame) {
   app.beginPriv();
   oDoc.saveAs(cPath + cFlName);
   app.endPriv();
}

Open in new window

0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
TipstarAuthor Commented:
THANKS I'LL TRY IT AND LET YOU KNOW
0
 
TipstarAuthor Commented:
Leakim971: I created the javascript file using your simple script but what do i have to do in my VBA code to get the js code to work?
0
 
leakim971PluritechnicianCommented:
You need to use : ExecuteThisJavascript
0
 
TipstarAuthor Commented:
please be more specific i am not that familar with java script

0
 
leakim971PluritechnicianCommented:
Check this posts for example :
http://forums.adobe.com/thread/583458?decorator=print&displayFullThread=true
http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_26733137.html

Line 18 :
 jsObj.SaveAs strFullPath, "com.adobe.acrobat.plain-text"

what's the extension in strFullPath
0
 
TipstarAuthor Commented:
Line 18 : jsObj.SaveAs strFullPath, "com.adobe.acrobat.plain-text"
the extension of the document is pdf, this is the document i want to save as a text file. I get the full path string from another procedure which uses the FileSystemObject to collect information about  each document in the folder.

What Object am I running ExcetueThisJava Script on? the AcroApp, the AVDoc, the PDDoc or the jsObject ? (refereing to my code.) None of them support that method.

I looked at the examples and I gather I can add the javascript to a variable in my VBA module and then use that as the arguement for ExecutethisJavascript. Am I reading that correctly?

What Object am I running ExcetueThisJava Script on? the AcroApp, the AVDoc, the PDDoc or the jsObject ? (refereing to my code.) None of them support that method.
0
 
leakim971PluritechnicianCommented:
ok could you try to use a txt extension instead the pdf one? For example for testing purpose, use a very simple path but with the txt extension

I never used ExecuteThisJavascript, I will try it to help you.

0
 
TipstarAuthor Commented:
I don't understand. The document i am opening is a pdf not a txt. that is what i am trying to do: convert, save as, export or whatever a pdf document to a text file. the first part of my code works fine.
0
 
leakim971PluritechnicianCommented:
You open a PDF but you save as TXT
Clipboard02.jpg
0
 
TipstarAuthor Commented:
yes that is what i want to do
0
 
TipstarAuthor Commented:
okay i get what you are trying to say now. the output file extension is still pdf and that needs to be changed to txt.
0
 
leakim971PluritechnicianCommented:
yes
0
 
TipstarAuthor Commented:
bingo. it was a hard way to get to a simple solution but you get the points and well deserved .
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.