Skip navigation
zwickl
Currently Being Moderated

Adding Metadata to PDF Form

Feb 4, 2011 11:09 AM

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?

 
Replies
  • Currently Being Moderated
    Feb 5, 2011 7:42 PM   in reply to zwickl

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 10, 2012 3:19 PM   in reply to zwickl

    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!

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 13, 2012 1:33 AM   in reply to SI_MSD7

    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

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points