These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Line Feed in util.printd not working in version 8

landrew
Registered: Feb 15 2008
Posts: 12
Answered

Hello,

I have been using a multiline text field to display the Day and date. The day of the week was on the top line and the month, day and year were on the second. Acrobat 8 displays 'undefined'. When I remove the escaped characters '\n' the value is displayed. Of course the line feed is missing.

original code:
event.target.value = util.printd("dddd\nmmm dd, yyyy", new Date());

Displayed:
Saturday
February 16, 2008

current work-around:
event.target.value = util.printd("dddd mmm dd, yyyy", new Date());

Displayed:
Saturday February
16, 2008

If I make the text box narrower the certain months may not fit on the second line properly.

Is there a new way to generate a line feed (newline) in the util.printd syntax?

Thanks in advance.

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
because the printd function has weak general formatting. It's really only good for dates, so do your special formatting with two printd calls.

var dt = new Date();
event.target.value = util.printd("dddd", dt ) + "\n";
event.target.value += util.printd("mmm dd, yyyy", dt );

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

landrew
Registered: Feb 15 2008
Posts: 12
thomp,

Great 'outside the box' solution. I am pretty good at these things but you came up with a winner.

I am updating several version 5 forms and finding several functions do not work the same in version 8. This forum is a great help.

Thanks.