This content has been marked as final. Show 10 replies
Let's hope not. The idea that I could download a PDF and it could read
files on my computer doesn't fill me with enthusiasm.
Could you post the code that is generating the error? If you read the error, it is because of an incorrect parameter being passed to getDataObjectContents.
Thank you, PDL, you were absolutely correct. I was using the path to refer to the attachment, where I should have assigned a name (cName), and used that name to refer to the attachment. I found the solution in the API reference for the ImportDataObject method. I'll post the working code, conditional to no one using it to hack Aandi's computer.
// Prompt the user for a data file to embed:
// Print the contents to the console:
var oFile = this.getDataObjectContents("MyData");
var cFile = util.stringFromStream(oFile, "utf-8");
But that importDataObject won't work embedded in a PDF, so that seems
fine to me. Or rather, it will work, but will prompt for a file, which
I don't mind in the least.
When you said "Is there any way to get data from a text file into
wanted to have a script which automatically read from a predefined
It seems I celebrated too soon. This doesn't work in Acrobat Reader 7.0 (with usage rights or no), only in Acrobat Professional. Is there some way for me to import data into Reader and use it? I know Adobe went out of their way to prevent importing into reader in the conventional ways, but I don't want to give up hope quite yet.
There is nothing in the API reference saying that importDataObject won't work in Reader. Have you tried with Reader 8.1.2? What error are you getting?
I installed Acrobat Reader 8.1.2, and cahnged the registry key to allow debugging in Reader. The error I get is :
Exception in line 1 of function top_level, script Field:Mouse Up
The intention is to display an Open dialog from which the user chooses the file to be imported. Should I be declaring the data object first? If so, what type of object do I declare it as?
Thanks again for all the help,
You're right, looks like the documentation needs to be updated. This function will not run in Reader on its own. Doesn't really surprise me though, this is exactly the kind of functionality that would be excluded from Reader.
Does that mean it will run on older versions? I've kinda given up hope, but I'm still curious.
> Does that mean it will run on older versions? I've kinda given up hope, but I'm still curious.
It is an error in the documentation, but not impossible. If you have an Adobe LiveCycle Reader Extensions Server, you can extend the form to allow this. The "extended usage rights" you can apply with Acrobat Pro / ProEx will not suffice - it has to be the extended rights from LCRES.