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

Make layers name in the layers palette invisible

Explorer ,
Aug 17, 2016 Aug 17, 2016

Hi all,

on

https://acrobatusers.com/tutorials/creating-and-using-layers-ocgs-with-acrobat-javascript

Thom Parker describes, how to make hidden layers visible in the layers palette with the JS-Code:

this.getOCGs();

But how can I make the layer name in the layers palette invisible again? What is the JavaScript-Code so that I can do it vice versa or that I can undo it?

I can't find anything about this in the literature.

Thanks for a helpful tip,

Yosimo

TOPICS
Acrobat SDK and JavaScript , Windows
540
Translate
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 17, 2016 Aug 17, 2016

That code doesn't do anything on its own. It just retrieves the array of OCGs (layers) in the file.

To make a specific layer visible (or invisible) you need to access it via that array and then change its state property to true or false, resp.

I believe it's all explained in that tutorial you found.

Translate
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
Explorer ,
Aug 17, 2016 Aug 17, 2016

I don't want to make a specific layer invisible. I want to make the layer name in the layers palette invisible.

If I place a watermark with the watermark function of Acrobat, then I can make  the layer name in the layers palette visible with the JS-code

this.setOCGOrder(this.getOCGs());   //  (and not: this.getOCGs(); sorry, I was wrong)

But what is the code to make the layer name in the layers palette invisible again?

Translate
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 17, 2016 Aug 17, 2016

That code doesn't have anything to do with showing the layers palette or making a layer's name in it hidden or visible. It just sets the order of the layers (to the current order, which is useless).

As far as I know, it's not possible to do any of those things using a script.

Translate
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
Explorer ,
Aug 17, 2016 Aug 17, 2016

Too bad, I was hoping I could do it with JS.

Thank you very much.

Translate
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
LEGEND ,
Aug 17, 2016 Aug 17, 2016
LATEST

The point is you can have an OCG that doesn't show up in the list, such as when you add a watermark. The code:

this.setOCGOrder(this.getOCGs())

has the effect of making the OCG names that aren't visible in the Layers pane visible, which then allows a user to manipulate it via the user interface.

Translate
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