Copy link to clipboard
Copied
Hi,
I have been struggeling with a way to get a form button to create two printouts. One as the form looks orginally and one with a COPY stamp/watermark on it. I have not gotten any script to work.
Is this possible and if it is how do i do it?
Hope you guys can point me in the right direction
First, use the built-in Add Watemark command to create this watermark. Then, run this code to hide it from the JS Console:
this.getOCGs()[0].state=false;
Now, create your print button and use the following code as it's MouseUp action:
this.print();
this.getOCGs()[0].state=true;
this.print();
this.getOCGs()[0].state=false;
The same is happening to me... Maybe using this watermark is not the best option. It seems to be a bit problematic. You can remove it and use a button field, instead. Make the fill color transparent and set its label to "COPY". Then set its appearance to hidden and adjust the print code to the following (let's say the button is called "COPY"):
this.print();
this.getField("COPY").display = display.visible;
this.print();
this.getField("COPY").display = display.hidden;
That way you won't need to a
...Copy link to clipboard
Copied
First, use the built-in Add Watemark command to create this watermark. Then, run this code to hide it from the JS Console:
this.getOCGs()[0].state=false;
Now, create your print button and use the following code as it's MouseUp action:
this.print();
this.getOCGs()[0].state=true;
this.print();
this.getOCGs()[0].state=false;
Copy link to clipboard
Copied
PS. You might also want to add the first line of code as a doc-level script, to prevent the watermark from appearing when the file is first opened, since you can't change its initState property because it's a special OCG.
Copy link to clipboard
Copied
You sir are a magician, thank you.
Now i see it working it would be great if it could print directly instead of opening the print dialog. Is this possible?
Copy link to clipboard
Copied
To do that you would need to install a script on the local machine of each user.
Copy link to clipboard
Copied
Okay, that could be an option in the future to explore. Thank you for the reply
It seems that when i re-open the this.getOCGs()[0].state=false; as a document level scipt but for some reason it will not activate when i re-open the form.
Copy link to clipboard
Copied
What do you mean? Does it show the watermark when you open the file, even though you added the script? Where did you place it, exactly?
Copy link to clipboard
Copied
The same is happening to me... Maybe using this watermark is not the best option. It seems to be a bit problematic. You can remove it and use a button field, instead. Make the fill color transparent and set its label to "COPY". Then set its appearance to hidden and adjust the print code to the following (let's say the button is called "COPY"):
this.print();
this.getField("COPY").display = display.visible;
this.print();
this.getField("COPY").display = display.hidden;
That way you won't need to add any additional code to hide it when the file is opened.
Oh, and you can duplicate the button to all pages by right-clicking it (in Prepare Form mode) and selecting Duplicate Across Pages.
Copy link to clipboard
Copied
Yes exactly still showing on startup
Java tools - Document javascripts - New with the name hide and script this.getOCGs()[0].state=false;
Copy link to clipboard
Copied
Didnt catch your post earlier, will give that a try.
Copy link to clipboard
Copied
That works perfectly. Thank you once again.