Working with layers PDF xChange Editor (8.0.0336.0000)

Forum for the PDF-XChange Editor - Free and Licensed Versions

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Post Reply
Leonhard_Peppo
User
Posts: 4
Joined: Wed Jul 01, 2020 12:50 pm

Working with layers PDF xChange Editor (8.0.0336.0000)

Post by Leonhard_Peppo »

Hi together,

I´ m creating a pdf for some collegues. Some of them will already have activated JavaScript some of them won´´ t. My aim is to use a layer to give the user the hint to activate JavaScript. And I want use a JavaScript to hide this layer at document opening. So, if JavaScript is already enabled the user will not see anything, and if JavaScript is not enabled the user will see the layer.

I think I already have the code therefore which I put here: (hope the image work. If not: I put it in the JavaScript.

var ocgArray = this.getOCGs();
for (var i=0; i < ocgArray.length; i++) {
if (ocgArray.name=="Welcome") {
ocgArray.state = false;
break;
}
}

PDF.PNG
But I´ m not able to give the layer the text that says: "Please check that you activated JavaScript alredy. Do to Setting > javaScript and tick the box".

Thank you in advance
Leo
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8436
Joined: Wed Jan 03, 2018 6:52 pm

Re: Working with layers PDF xChange Editor (8.0.0336.0000)

Post by TrackerSupp-Daniel »

Hi, Leonhard_Peppo

My apologies for the delay here, from what I understand you have everything in place except for the page text you want shown correct?
At the moment (in build 339.0, which you may want to update to) we still cannot yet apply Base content to a layer, but that should be coming soon. Until then, you can accomplish this by using a comment, such as the "typewriter" tool and applying it to the desired layer instead.

Kind regards,
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Leonhard_Peppo
User
Posts: 4
Joined: Wed Jul 01, 2020 12:50 pm

Re: Working with layers PDF xChange Editor (8.0.0336.0000)

Post by Leonhard_Peppo »

Hi Daniel,

I´ m not sure if I get you right:

Is it possible to check if the people have acitvated JavaScript already, or not? (i have no clue how the code will work)
If possible: How can I show those who haven´ t activated JavaScript a comment that the should go to the settings and hit the checkbox?

I have never worked with layers, I d´ ont know how to apply the comment to the layer. Trial and error didn´ t worked :oops:

Kind regards,
Leo
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8436
Joined: Wed Jan 03, 2018 6:52 pm

Re: Working with layers PDF xChange Editor (8.0.0336.0000)

Post by TrackerSupp-Daniel »

Hi, Leonhard_Peppo

There shouldn't be any need to check if JavaScript is enabled, you can simply set the layer which requires JS active to be hidden by default, and the one showing that message to be visible by default. Then when someone opens the document, have JavaScript set to activate the hidden layer, and hide the active layer automatically.
If they have JavaScript enabled, this will work correctly and seamlessly for them. If JavaScript is disabled, then they will either see a message, or nothing will happen , resulting in them seeing the message that you left in place for them.

It is not possible to use JavaScript to check if JavaScript is enabled, as if disabled, that JS simply would not run to begin checking in the first place.

Kind regards,
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Leonhard_Peppo
User
Posts: 4
Joined: Wed Jul 01, 2020 12:50 pm

Re: Working with layers PDF xChange Editor (8.0.0336.0000)

Post by Leonhard_Peppo »

Hi Daniel,

is it possible for you to post an example?

Best regards
Post Reply