Mike - SMT
Mike - SMT

Reputation: 15226

Can I add string of text with a date attached all in one field?

I have a macro that does a few things to my PDF documents. Currently I can add a text field where the macro then places the current date. I would like to add a string of text in front of the date. Something like MACRO Date: 05/03/2017

I have tried adding a string of text next to the AcDateFormat this did not work. I have also tried to add the string of text in the same quote with mm/dd/yyyy" that kind of worked, but has change some of the letters to numbers resulting in something like this 28ACRO Daae: 05/03/2017 on the page.

Is there a way to add the text to the field then add the date next to the text?

I do not want to add two separate fields, because I need to be able to search for the term MACRO Date: and then have the text after return.

This is the working code I have. Can anyone shed some light on how to add a string of text next to the date as it prints into the field?

var AcDate = new Date();var AcDateFormat = "mm/dd/yyyy";
for (var p = 0; p < this.numPages;p++) {
    var fd = this.addField("xftDate", "text", 0, [10, 10, 100, 25]);
    fd.value =  util.printd(AcDateFormat, AcDate);
    fd.textSize = 16;
    fd.readonly = true;
    fd.alignment = "right";
}

Upvotes: 0

Views: 247

Answers (1)

ReFran
ReFran

Reputation: 897

fd.value = "myDate:" + util.printd(AcDateFormat, AcDate) + " that's it";

Upvotes: 2

Related Questions