Copy link to clipboard
Copied
I've created a PDF document containing serveral posters which all contain an area for a departmental branding. I want to be able to change the branding information across all of the pages in one hit by selecting the department from a (non printing) dropdown box.
I've managed to achieve this on a single page by using layers and the following javascript to show/hide the different departments. However, this doesn't change the layer visibility across all of the pages. Does anyone out there know how this can be done or if it's even possible?
var layers = ["Dept1","Dept2","Dept3","Dept4","Dept5","Dept6"];
var docOCGs = this.getOCGs();
for( i=0 ; i<docOCGs.length ; i++){
var val = layers.indexOf(docOCGs[i].name);
if(val >=0){
layers[val] = docOCGs[i];
}
}
function SetFieldValues (item){
for( i=0 ; i<layers.length ; i++){
layers[i].state = false;
if(layers[i].name == item){
layers[i].state = true
}
}
}
SetFieldValues (this.getField("select").value);
Copy link to clipboard
Copied
The layers need to be added to the PDF differently. The layers tool adds each image was separately. But the Watermark tool add the same image as a layer to every page. To add multiple layers to every page just rename the watermark layer.
Read this article:
https://acrobatusers.com/tutorials/create_use_layers/
Copy link to clipboard
Copied
The layers need to be added to the PDF differently. The layers tool adds each image was separately. But the Watermark tool add the same image as a layer to every page. To add multiple layers to every page just rename the watermark layer.
Read this article:
https://acrobatusers.com/tutorials/create_use_layers/
Copy link to clipboard
Copied
Thanks Thom, that's a gret idea and it works a treat.
At first when I used the "Update" option in the Watermark section, choosing a diferent saved watermark didn't change anything, but I found that using the "add" option , choosing "Replace Existing" and then selecting one of my saved watermarks from the "Saved Settings" dropdown, is the way to go 🙂
Just pushing the idea, and to make it easier for others in my office who might not be as familiar with delving into opening and editing of the PDF.... is there a way to use a Forms dropdown option (similar to the method I discussed in my original post) to change the watermark?
Copy link to clipboard
Copied
The watermarks are "Layers" that are named "watermark". You can add multiple layers by alternately renaming the "watermark" to a custom name and then adding a new watermark.
The issue with watermarks is that they are not immediately visible on the Layers Tab. To make them visible, run this code in the console window.
this.setOCGOrder(this.getOCGs());
After this you'll be able to change the "watermark" name to something else. And then you can use the dropdown to control visibility.