Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

How to add a fill color to my scripted form field?

SLarscheidt
Level 1
Level 1

I would like to add the color white to the IRdate field created below.  The reason is to cover up any previous text under the field.  At the moment, when I place the IRdate appearance the old PDF text comes through.  I know I can manually change it so there must be a script way of doing this.  Any ideas out there?  Thanks!

//Establish Scaling
var inch = 72;

//Position Rectangle for RFC Stamp Field
var aRect = this.getPageBox( {nPage: 0} );
aRect[0] += 16.25*inch;  // from upper left hand corner of page.
aRect[1] -= 0.509*inch;
aRect[2] = aRect[0]+0.480*inch;
aRect[3] = aRect[1]-0.115*inch;

// Construct RFC Stamp Field
var field_name = "IRdate"
var f = this.addField(field_name, "signature", 0, aRect)


sig_field = "IRdate"

var f = getField(sig_field);

// Choose handler
var ppklite = security.getHandler("Adobe.PPKLite");

// Login -- *****change as appropriate*******
ppklite.login("Password-something", "/C/Documents and Settings/Zap/My Documents/Digital_ID/Zap.pfx")
f.signatureSign(ppklite,{password: "Password-something", appearance: "IRdate"});
ppklite.logout();

3 Replies
SLarscheidt
Level 1
Level 1

Well...I found a work around.  Basically I ran this script twice...the first time my appearance used a white blank JPG as I found out that they do not support transparency and the second run was what I actually wanted to show.  So in a nut shell, I covered up old PDF text with a white jpg appearance, then covered the jpg with a PDF appearance.

Still...would prefer to know the script way of changing the field to a fill of white.

George_Johnson
Level 6
Level 6

I'm not sure I understand what you're asking about exactly, but you should be able to follow this line:

var f = this.addField(field_name, "signature", 0, aRect)


with this:


f.fillColor = color.white;

SLarscheidt
Level 1
Level 1

THAT is what I was looking for!  Much better than my cumbersome work around.  Thank you!