Circle something on a PDF just by clicking on it.

I am trying to figure out how to add a button or create something like a check box that will circle something like a yes/no question - when clicked on.

I have tried to look at previous questions like this but when I click on the links with the answers to show how to do it I run into a dead end.

Anyone know how to do this simply?

Thanks.


Joy Frandsen


3 Answers

Voted Best Answer

First create a radio button with a black border. Set the font size as small as possible. The lowest number in the drop-down is 6 but you can manually enter 2. Set the text color to white. Enter the following script in the mouseup action:

if (event.target.display == display.visible)
{
event.target.display = display.noPrint;
event.target.borderColor = color.transparent;
resetForm(event.target.name);
}
else
{
event.target.display = display.visible;
resetForm(event.target.name);
event.target.borderColor = color.black;
}

This script toggles the border color back and forth between black and transparent. It also resets the button so the it is never "On" so you can't see the middle.


By David Dagley   

Here's a link to a PDF that demonstrates a different approach: http://acroscript.net/pdf/demos/butto...

Make sure to open it in Adobe Reader or Acrobat. It's not likely to work in non-Adobe PDF viewers.


George Johnson   

If you want a real circle, you can use a button with an image as it's button face. The image would then be the circle (which you can e.g. create in Photoshop, or an image editor). The key here is that the circle has a transparent background. Then, name your "Yes" and "No" buttons "Button1_Yes" and "Button1_No" - they key here is that you have a button name followed by a Yes/No, separated by an underscore.

Then, create a hidden button that has the icon image as it's button face and name it "icon". Now you can use the following script for both your "Yes" and "No" buttons to circle the "Yes"/"No" options:

var baseName;
var currentState;

// get our name
var theName = event.target.name;

var re = /(.*)_(.*)/;

var ar = re.exec(theName);
if (ar.length > 0) {
    baseName = ar[1]; 
    currentState = ar[2];

    // make this button visible
    event.target.buttonSetIcon(this.getField("icon").buttonGetIcon());
    event.target.buttonPosition = position.iconOnly;
    // hide the other button
    var newState = "Yes";
    if (currentState == "Yes")
        newState = "No";

    var f = this.getField(baseName + "_" + newState);
    f.buttonPosition = position.textOnly;
}

Karl Heinz Kremer
PDF Acrobatics Without a Net
PDF Software Development, Training and More...
http://www.khkonsulting.com


Karl Heinz Kremer   


Please specify a reason: