Custom scheme XMP

Started by lxlx, October 01, 2018, 05:53:14 PM

Previous topic - Next topic

lxlx

Hello, I need to create custom XMPs but with the XMP scheme of PDFA / A-1a. Honestly, I do not know how to specify it, because it's the only thing I need ...

I leave the command that I make: exiftool -config schema_dc.config -xmp-dc:radicate="1821" whatis.pdf

The problem occurs when I export the pdf to XMP, it is as if "radicate" was not created.

Quote<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 10.10'>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>

<rdf:Description rdf:about=''
  xmlns:dc='http://purl.org/dc/elements/1.1/'>
  <dc:description>
   <rdf:Alt>
    <rdf:li xml:lang='de-AL'>ff</rdf:li>
    <rdf:li xml:lang='de-matr'>ff</rdf:li>
    <rdf:li xml:lang='de-radicado'>ff</rdf:li>
    <rdf:li xml:lang='de-recb'>ff</rdf:li>
    <rdf:li xml:lang='de-xls'>ff</rdf:li>
    <rdf:li xml:lang='de-xrm'>32</rdf:li>
   </rdf:Alt>
  </dc:description>
</rdf:Description>

<rdf:Description rdf:about=''
  xmlns:pdf='http://ns.adobe.com/pdf/1.3/'>
  <pdf:Producer>LibreOffice 5.1</pdf:Producer>
</rdf:Description>

<rdf:Description rdf:about=''
  xmlns:xmp='http://ns.adobe.com/xap/1.0/'>
  <xmp:CreateDate>2017-10-01T15:37:32-05:00</xmp:CreateDate>
  <xmp:CreatorTool>Draw</xmp:CreatorTool>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end='w'?>
I would greatly appreciate your collaboration.

PS: The XMP scheme that I need is 2004.

Phil Harvey

What are you showing with the XMP you posted?

What is the config file you were using?

I thought you were trying to write a "radicate" tag.  Can you give an example of XMP containing this tag?

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

lxlx

#2
Thanks for answering, you are very kind,

The configuration file that I am using are several that I find in this forum. However now I do not have the certainty, because I made a rm to the configuration file to put another and another to see if it worked.

I want to write metadata in a PDF that complies with the PDFA / A-1a standard. In fact, if I insert metadata of the form exiftool -xmp:description-of-a="something" name.pdf or exiftool -xmp:description-of-b="something" name.pdf it works. I do not know if I make myself understood, I want to create custom labels with XMP that comply with the PDFA / A-1a standard with exiftool

Phil Harvey

I still don't know what you want.

Quote from: lxlx on October 02, 2018, 12:04:53 AM
In fact, if I insert metadata of the form exiftool -xmp:description-of-a="something" name.pdf or exiftool -xmp:description-of-b="something" name.pdf it works.

I get this:

> exiftool -xmp:description-of-a="something" a.pdf
Warning: Tag 'xmp:description-of-a' is not defined or has a bad language code
Nothing to do.


QuoteI want to create custom labels with XMP that comply with the PDFA / A-1a standard with exiftool

I don't know what this standard is, but you can either create native PDF tags, or some custom XMP tags in PDF files.  If you use XMP, you should probably put them in the pdfx namespace (ExifTool XMP-pdfx group) or some custom namespace, rather than creating new tags in the standard dc namespace (ExifTool XMP-dc group).

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

lxlx

#4
I will explain myself in a better way.

I have a document called file.pdf and that, currently has the following metadata (exiftool file.pdf):

ExifTool Version Number: 10.10
File Name: file.pdf
Directory:.
File Size: 172 kB
File Modification Date / Time: 2017: 10: 02 08: 12: 25-05: 00
File Access Date / Time: 2017: 10: 02 08: 12: 39-05: 00
File Inode Change Date / Time: 2017: 10: 02 08: 12: 25-05: 00
File Permissions: rw-r - r--
File Type: PDF
File Type Extension: pdf
MIME Type: application / pdf
PDF Version: 1.4
Linearized: No
Page Count: 1
Tagged PDF: Yes
Part: 1
Conformance: A
Producer: LibreOffice 5.1
Creator Tool: Draw
Create Date: 2017: 10: 02 08: 12: 25-05: 00
Creator: Draw

If I export the file.pdf to XMP, I have the following result (exiftool -xmp:all -o file.xmp /home/dev/Desktop/file.pdf):

Quote<? xpacket begin = '' id = 'W5M0MpCehiHzreSzNTczkc9d'?>
<x: xmpmeta xmlns: x = 'adobe: ns: meta /' x: xmptk = 'Image :: ExifTool 10.10'>
<rdf: RDF xmlns: rdf = 'http: //www.w3.org/1999/02/22-rdf-syntax-ns#'>

<rdf: Description rdf: about = ''
  xmlns: pdf = 'http: //ns.adobe.com/pdf/1.3/'>
  <pdf: Producer> LibreOffice 5.1 </ pdf: Producer>
</ rdf: Description>

<rdf: Description rdf: about = ''
  xmlns: xmp = 'http: //ns.adobe.com/xap/1.0/'>
  <xmp: CreateDate> 2017-10-02T08: 12: 25-05: 00 </ xmp: CreateDate>
  <xmp: CreatorTool> Draw </ xmp: CreatorTool>
</ rdf: Description>
</ rdf: RDF>
</ x: xmpmeta>
<? xpacket end = 'w'?>

Now, with VERAPDF-GUI (program to validate if a file is valid with the PDFA / A-1a standard), I get it right.


Now, I need to create custom metadata, so I took an exiftool configuration file that I found in the forum (my.config):

Quote% Image :: ExifTool :: UserDefined = (
    'Image :: ExifTool :: XMP :: dc' => {
        mytest => {},
    },
);
# end

And I put the following command:
exiftool -config my.config -xmp-dc:mytest=test /home/dev/Desktop/file.pdf

And when I put exiftool file.pdf:

ExifTool Version Number: 10.10
File Name: file.pdf
Directory:.
File Size: 175 kB
File Modification Date / Time: 2017: 10: 02 08: 40: 33-05: 00
File Access Date / Time: 2017: 10: 02 08: 40: 36-05: 00
File Inode Change Date / Time: 2017: 10: 02 08: 40: 33-05: 00
File Permissions: rw-r - r--
File Type: PDF
File Type Extension: pdf
MIME Type: application / pdf
PDF Version: 1.4
Linearized: No
Page Count: 1
Tagged PDF: Yes
XMP Toolkit: Image :: ExifTool 10.10
Mytest: test
Producer: LibreOffice 5.1
Conformance: A
Part: 1
Create Date: 2017: 10: 02 08: 39: 30-05: 00
Creator Tool: Draw
Creator: Draw

As shown above, Mytest is created correctly, but now I put it in VERAPDF-GUI and it does not comply with the standard. The report you take out can be saved in HTML or XML and shows the following:


QuoteRule Status
Specification: ISO 19005-1: 2005, Clause: 6.7.9, Test number: 2
Properties specified in XMP form shall use either the predefined schemas defined in XMP Specification, or extension schemas that comply with XMP Specification Failed
1 occurrences Hide
XMPProperty
(isPredefinedInXMP2004 == true || isDefinedInCurrentPackage == true) && isValueTypeCorrect == true
root / document
I would appreciate being able to know how to solve this error, I think it is due to the XMP or DC scheme, I really do not know. I'm attentive Thank you very much.

PD:I attach the files, file.pdf is the file that when it is put in verapdf-gui it works, file_not_working.pdf is when I create the custom metadata and it does not work. The two screenshots belong respectively to file.pdf (valid) and to file_not_working.pdf (invalid)

Phil Harvey

Note that there are random spaces throughout your post that make it impossible for me to cut/paste any of this for testing.

But it seems that the problem is you are defining a custom tag in a standard namespace, which is what I mentioned in the last sentence of my last post.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

lxlx

I have corrected the spaces and attached the files, please try again

Phil Harvey

It seems that the problem is you are defining a custom tag in a standard namespace, which is what I mentioned in the last sentence of my last post.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

lxlx

To create the namespace, I require a .config file?

Phil Harvey

Yes.  But I would suggest using pdfx.  However, you will need a config file anyway to create a user-defined tag.
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

lxlx

Reviewing in the forum, for purposes of testing, could this work in my case? https://exiftool.org/forum/index.php?topic=6208.0

Phil Harvey

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

lxlx

I tried the following config file:
%Image::ExifTool::UserDefined = (
    'Image::ExifTool::XMP::pdfx' => {
        document_id => { Writable => 'string', },
        description => { Writable => 'string',},
    },
);
1;  #end

And: exiftool -config pdfxth.config -xmp-pdfx:document_id="test" -xmp-pdfx:description="Description Test" /home/dev/Desktop/file.pdf

ExifTool Version Number         : 10.10
File Name                       : file.pdf
Directory                       : .
File Size                       : 175 kB
File Modification Date/Time     : 2018:10:02 09:22:43-05:00
File Access Date/Time           : 2018:10:02 09:22:46-05:00
File Inode Change Date/Time     : 2018:10:02 09:22:43-05:00
File Permissions                : rw-r--r--
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.4
Linearized                      : No
Page Count                      : 1
Tagged PDF                      : Yes
XMP Toolkit                     : Image::ExifTool 10.10
Producer                        : LibreOffice 5.1
Conformance                     : A
Part                            : 1
Description                     : Description Test
Document id                     : test
Create Date                     : 2018:10:02 09:11:11-05:00
Creator Tool                    : Draw
Creator                         : Draw

But now the output is two errors  :( :

QuoteRule   Status
Specification: ISO 19005-1:2005, Clause: 6.7.9, Test number: 2   
Properties specified in XMP form shall use either the predefined schemas defined in XMP Specification, or extension schemas that comply with XMP Specification   Failed
2 occurrences   Hide
XMPProperty   
(isPredefinedInXMP2004 == true || isDefinedInCurrentPackage == true) && isValueTypeCorrect == true   
root/document[0]/metadata[0](170 0 obj PDMetadata)/XMPPackage[0]/Properties[4](http://ns.adobe.com/pdfx/1.3/ - pdfx:document_id)
root/document[0]/metadata[0](170 0 obj PDMetadata)/XMPPackage[0]/Properties[3](http://ns.adobe.com/pdfx/1.3/ - pdfx:description)

Phil Harvey

It looks like your validator just doesn't accept any custom XMP tags. :(
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

lxlx

exiftool -config my.config -xmp-dc:mytest=test /home/dev/Desktop/file.pdf

I uploaded it in another validator: https://www.pdf-online.com/osa/validate.aspx and with the configuration file of:

Quote%Image::ExifTool::UserDefined = (
    'Image::ExifTool::XMP::dc' => {
        mytest => { },
    },
);
# end
Quote
Validating file "file.pdf" for conformance level pdfa-1a

The property 'dc:mytest' is not defined in schema 'Dublin Core Schema'.

The document does not conform to the requested standard.

The document's meta data is either missing or inconsistent or corrupt.

The document does not conform to the PDF/A-1a standard.

Done.

With PDFX:

Quote%Image::ExifTool::UserDefined = (
    'Image::ExifTool::XMP::pdfx' => {
        document_id => { Writable => 'string', },
        description => { Writable => 'string',},
    },
);
1;  #end


exiftool -config pdfxth.config -xmp-pdfx:document_id="test" -xmp-pdfx:description="Description Test" /home/dev/Desktop/file.pdf

QuoteValidating file "file.pdf" for conformance level pdfa-1a

The schema description for namespace 'pdfx:' (http://ns.adobe.com/pdfx/1.3/) is missing.

The document does not conform to the requested standard.

The document's meta data is either missing or inconsistent or corrupt.

The document does not conform to the PDF/A-1a standard.

Done.

Any idea?  :-\

Phil Harvey

Quote from: lxlx on October 02, 2018, 10:36:08 AM
Any idea?  :-\

Yes:

The property 'dc:mytest' is not defined in schema 'Dublin Core Schema'.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

lxlx

Hahaha, could I specify the schema that I want to use in the configuration file for exiftool to take it? for example: http://ns.adobe.com/pdfx/1.3/

Phil Harvey

You can try, but your other validator didn't like custom tags in pdfx.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

lxlx

In the config, how could you specify the schema, do you have an example that you can share with me please?

Phil Harvey

I think you're missing the point.  The schemas are defined by the various standards that are recognized by your validator.  They aren't something that is written in the file.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

lxlx

Honestly, I thought that in the namespace it was specified in the config file:

https://www.pdflib.com/pdf-knowledge-base/xmp/xmp-in-pdfa/

%Image::ExifTool::UserDefined::ns_1 = (
    GROUPS        => { 0 => 'XMP', 1 => 'XMP-ns_1', 2 => 'Image' },
    NAMESPACE     => { 'ns_1' => 'http://www.aiim.org/pdfa/ns/schema#'; },
    WRITABLE      => 'string',
    tag_one => { },
    tag_two => { },
    tag_three => { },
    pumpkinpie => { },
);

%Image::ExifTool::UserDefined::ns_2 = (
    GROUPS        => { 0 => 'XMP', 1 => 'XMP-ns_2', 2 => 'Image' },
    NAMESPACE     => { 'ns_2' => 'http://www.aiim.org/pdfa/ns/schema#'; },
    WRITABLE      => 'string',
    abc_one => { },
    donuts => { },
    abc_two => { },
    spaceship => { },
    unknown => { },
);

# The %Image::ExifTool::UserDefined hash defines new tags to be added
# to existing tables.
%Image::ExifTool::UserDefined = (
    # new XMP namespaces (ie. XXX) must be added to the Main XMP table:
    'Image::ExifTool::XMP::Main' => {
        ns_1 => {
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::ns_1',
            },
        },
        ns_2 => {
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::ns_2',
            },
        },
    },
);

1;  #end

Could you clarify this, please?

Phil Harvey

The problem is that your validator only recognizes pre-defined schemas.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).