Expand my Community achievements bar.

Adding Metadata to PDF Form

Avatar

Level 2

Hi, I'm trying to add some metadata to a pdf. I have the follow script in the form initialize event:

if (form1.desc.nodes.namedItem("metadata") == null) then
var oNode=xfa.form.createNode("text", "metadata")
form1.desc.nodes.append(oNode)
endif

I receive the error message:

Argument mismatch in property or function argument

I also tried this code:

if (form1.desc.nodes.namedItem("metadata") == null) then
var oNode=xfa.form.createNode("text", "metadata")
oNode.value = "Test Data"
form1.desc.nodes.append(oNode)
endif

Which gave me this error:

accessor "oNode.value" is unknown

It appears that the oNode object is not being created.

Any suggesting how I can add Metadata to the PDF?

6 Replies

Avatar

Level 10

Hi,

I don't use FormCalc a great deal, the following equivilent in JavaScript seems to work;

if (form1.desc.nodes.namedItem("metadata") == null)
{
var oNode=xfa.form.createNode("text", "metadata")
form1.desc.nodes.append(oNode)
}

Bruce

Avatar

Level 2

Thanks for the tip. Using JavaScript instead of FormCalc corrected the problem.

Avatar

Level 6

Bruce / Zwicki - or anyone who can assit...

How did you get this to work?

I'm looking for a way to add/inject values (keywords) into the form's meta-data by retrieving the values from user input.

To test the above solution, I added the following script to the initialize event as referenced, but I'm not sure what is happening:

if (form1.desc.nodes.namedItem("metadata") == null)

{

var oNode=xfa.form.createNode("text", "metadata")

form1.desc.nodes.append(oNode)

}

1. Do I need a field on the page?

2. What part of the above script affects the meta-data?

Thanks!

Avatar

Level 2

I am out of the office until 08/13/2012.

Note: This is an automated response to your message "[LiveCycle Designer]

Adding Metadata to PDF Form" sent on 8/10/2012 6:18:49 PM.

This is the only notification you will receive while this person is away.

Avatar

Level 10

Hi,If you mean metadata like those set in the Form Properties Info tab, I don't think you can do this at run time, the above code is more like a form variable. Regards Bruce

Avatar

Level 2

Hi,

This is the code I use to place metadata into the pdf file. If you open

the resulting pdf file using Notepad, the metadata is visible as readable

text in the file. I'm not sure the same approach can be used to add

metadata as viewed under Document Properties. We are not using it that

way. Maybe by changing the node name?

if ((EMAIL_SUBJECT1.rawValue != "")&&(EMAIL_SUBJECT1.rawValue != null))

{

var vDesc=xfa.template.data.desc;

var oNode1=xfa.template.createNode("text", "EMAIL_SUBJECT1");

vDesc.nodes.append(oNode1);

vDesc.nodes.namedItem("EMAIL_SUBJECT1").value=EMAIL_SUBJECT1.rawValue;

}

Andrew Zwickl | Worldwide Information Systems |

Eastman Kodak Company | 1669 Lake Ave | Rochester, NY 14652-4455 |

VOX: 585-477-1402

FAX: 585-588-4123

EMail: andrew.zwickl@kodak.com

www.kodak.com

From:

SI_MSD7 <forums@adobe.com>

To:

zwickl <andrew.zwickl@kodak.com>

Date:

08/10/2012 06:18 PM

Subject:

Adding Metadata to PDF Form

Re: Adding Metadata to PDF Form

created by SI_MSD7 in LiveCycle Designer - View the full discussion

Bruce / Zwicki - or anyone who can assit...

How did you get this to work? I

I'm looking for a way to add/inject values (keywords) into the form's

meta-data by retrieving the info/values from user input.

To test the above solution, I added the following script to the initialize

event as referenced, but I'm not sure what is happening:

if (form1.desc.nodes.namedItem("metadata") == null)

{

var oNode=xfa.form.createNode("text", "metadata")

form1.desc.nodes.append(oNode)

}

1. Do I need a field on the page?

2. What part of the above script affects the meta-data?

Thanks!

Replies to this message go to everyone subscribed to this thread, not

directly to the person who posted the message. To post a reply, either

reply to this email or visit the message page: [

http://forums.adobe.com/message/4613534#4613534]

To unsubscribe from this thread, please visit the message page at [

http://forums.adobe.com/message/4613534#4613534]. In the Actions box on

the right, click the Stop Email Notifications link.

Start a new discussion in LiveCycle Designer by email or at Adobe Forums

For more information about maintaining your forum email notifications

please go to http://forums.adobe.com/message/2936746#2936746.