Copy link to clipboard
Copied
I want to open a pdf, read from it, but keep it hidden from view. Can this be done?
Copy link to clipboard
Copied
No.
Copy link to clipboard
Copied
Can a pdf be hidden using "bHidden" command? The following is taken from
Adobe Acrobat 7.0.5
Acrobat JavaScript Scripting Reference
Manual
Example 3 (Acrobat 7.0)
Open a hidden PDF document, extract information from it, and close it.
oDoc = app.openDoc({
cPath:"/C/myDocs/myInfo.pdf",
bHidden: true
});
var v = oDoc.getField("myTextField").value;
this.getField("yourTextField").value = v;
oDoc.closeDoc();
Copy link to clipboard
Copied
Yes, this is possible.
Copy link to clipboard
Copied
In theory, yes, but in practice you'll notice that if you use it in a recent version of Acrobat or Reader it won't work.
I think this was done on purpose, although it's not documented in the API Reference, so I guess you could say it's a bug.
Either way, it doesn't work.
Copy link to clipboard
Copied
I use the method quite a bit. It works perfectly fine on the current version of Acrobat DC on Windows and Mac.
Copy link to clipboard
Copied
Hi, Joel
My called document.pdf contains the line 'this.disclosed = true;' within a JavaScript.
Still doesn't work.
Could you provide sample code?
Copy link to clipboard
Copied
Where did you put the disclosed code? It needs to go in the document level script and inside an anonymous function.
(function () {
this.disclosed = true;
})();
Copy link to clipboard
Copied
Why do you say it needs to be inside an anonymous function? It also works if you just place it as-is, outside of a function.
Copy link to clipboard
Copied
I've found that on certain machines (slower ones), Acrobat DC isn't fully loading the JavaScript engine before the document level scripts are interpreted and the document level code just falls on the floor unless you wrap it in an anonymous function. This only happens when Acrobat isn't running and you open a document from the system explorer. If Acrobat is already running, this doesn't happen.
Copy link to clipboard
Copied
Very strange, but good to know!
Copy link to clipboard
Copied
It took quite a bit of time to track down but when I noticed that the JavaScript for Shared Reviews always ran properly and didn't intermittently fail on various machines. I looked at how it was stored and it was in an anonymous function. When I put my own code inside one, the problem went away with no other code changes.
Copy link to clipboard
Copied
It didn't use to in previous versions. Maybe the bug got fixed...
Copy link to clipboard
Copied
You can use JavaScript to open a PDF file and keep it hidden but in your use case, the document wll also need to be "disclosed" in order to use JavaScript to communicate data between documents.
Copy link to clipboard
Copied
Still can't get bHidden to work. Yes, I put this.disclosed=true in document level.
Anyone have SIMPLE sample code using bHidden?
Copy link to clipboard
Copied
Where are you using this code?
Please post the complete script.
Copy link to clipboard
Copied
"this.disclosed = true" in docuemt level script
var otherDoc = app.openDoc("SampleDoc.pdf", bHidden:true);
otherDoc.closeDoc(true);
I get SyntaxError: missing ) after argument list
Copy link to clipboard
Copied
Here is the correct syntax, but your file path isn't going to work.
var otherDoc = app.openDoc({cPath:"SampleDoc.pdf", bHidden:true});
With nearly all Acrobat JS object methods you can either provide the native list of arguments, or pass the arguments as an object. It has to be one or the other. You can't mix them up
Copy link to clipboard
Copied
Thanks for your responce. I have little knowlegde of Adobe - I'm afraid I don't understand the meaning of 'native list of arguments, or pass the arguments as an object'. Any chance of providing sample code which opens a hidden file called "SampleDoc.pdf"?
Copy link to clipboard
Copied
I already provided that code in my previous post. In fact, you already posted it on July 26th of last year.
Everything you need to know has already been provided in the previous posts. However, if you do not know how to program using JavaScript, then you're chances of success are extremely low. I would strongly suggest you learn about programming in JavaScript, or hire a consultant to either create the code for you, or walk you through the process of developing it yourself.
You have not answered one of the most critical questions posted here. Where is this code being used? For initial testing purposes it should be done from the console window.
You'll find a tutorial on the console here:
https://www.pdfscripting.com/public/Free_Videos.cfm#JSIntro