• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Can a PDF file be opened and hidden from view?

Community Beginner ,
Jul 26, 2019 Jul 26, 2019

Copy link to clipboard

Copied

I want to open a pdf, read from it,  but keep it hidden from view. Can this be done?

TOPICS
Acrobat SDK and JavaScript

Views

1.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 26, 2019 Jul 26, 2019

Copy link to clipboard

Copied

No.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 26, 2019 Jul 26, 2019

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 26, 2019 Jul 26, 2019

Copy link to clipboard

Copied

Yes, this is possible.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 26, 2019 Jul 26, 2019

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 26, 2019 Jul 26, 2019

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 26, 2019 Jul 26, 2019

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 31, 2019 Jul 31, 2019

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;

})();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 31, 2019 Jul 31, 2019

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 02, 2019 Aug 02, 2019

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 02, 2019 Aug 02, 2019

Copy link to clipboard

Copied

Very strange, but good to know!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 03, 2019 Aug 03, 2019

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 26, 2019 Jul 26, 2019

Copy link to clipboard

Copied

It didn't use to in previous versions. Maybe the bug got fixed...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 26, 2019 Jul 26, 2019

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 04, 2020 Apr 04, 2020

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 04, 2020 Apr 04, 2020

Copy link to clipboard

Copied

Where are you using this code?

Please post the complete script.  

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 09, 2020 Apr 09, 2020

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 09, 2020 Apr 09, 2020

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

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 13, 2020 Apr 13, 2020

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"?

 

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 13, 2020 Apr 13, 2020

Copy link to clipboard

Copied

LATEST

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

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines