srikrishnan has asked for the wisdom of the Perl Monks concerning the following question:

Hi All,

I am trying to add XMP metadata in our pdf files.
For this I need to generate UUID values for the "xmpMM:DocumentID" and "xmpMM:InstanceID" fields

For e.g.:
<xmpMM:DocumentID>uuid:27bf4dc2-daa2-46a0-9944-4aeea86cb8d0</xmpMM:DocumentID>
<xmpMM:InstanceID>uuid:27f7c7ea-bde3-49fd-b76b-0975741cc5d9</xmpMM:InstanceID>

I am trying perl module "DATA::UUID" for the above requirement. But I dont know how to generate the above two UUIDS for our each pdf.

Please anybody can help me

Regards,
Srikrishnan
  • Comment on How to generate UUID for DocumentID and InstanceID

Replies are listed 'Best First'.
Re: How to generate UUID for DocumentID and InstanceID
by Anonymous Monk on Dec 08, 2008 at 12:57 UTC
    You're not supposed to duplicate UUIDs
Re: How to generate UUID for DocumentID and InstanceID
by JadeNB (Chaplain) on Dec 08, 2008 at 22:40 UTC
    According to the Data::UUID documentation:
    use Data::UUID; $ug = new Data::UUID; $uuid1 = $ug->create(); $uuid2 = $ug->create_from_name(<namespace>, <name>);
    Does this work for you? If not, what error message do you get?
      Hi,

      I am trying something like below:

      use Data::UUID;
      my $ug = new Data::UUID;

      my $PDFpath = "C:\\XMP_Metadata\\Sample.pdf";
      my $DocIDVal = $ug->create_from_name_str(<namespace>, "$PDFpath");
      print "$DocIDVal\n";

      But in the above script, I dont know what namespace I have to use for pdf files, also I dont know how to generate two different UUIDs for DocumentID and InstanceID?

      In the Module they have specified only the four namespaces:

      NameSpace_DNS
      NameSpace_URL
      NameSpace_OID
      NameSpace_X500

      Thanks,
      Srikrishnan

        You need to choose a namespace for your application. The purpose of the namespace is to separate your UUIDs from everyone else's.

        One possibility would be to declare two different namespaces, one for document IDs and one for instance IDs. Then use the appropriate namespace for the ID you want to generate. The important point is that the IDs should be different for different objects.

        On a side note, the quotes in "$PDFpath" serve no purpose and should probably be removed. $PDFpath is already a string.

        G. Wade