Adding the same XMP to PDF files

Started by masega1986@hotmail.com, October 18, 2023, 05:03:13 PM

Previous topic - Next topic

masega1986@hotmail.com

Hi there, sorry in advance if this question was resolved in other topic, but i couldn't find it.
first of all, i'm completely new in exiftool.

I'm trying to load a XMP file into various PDF files. At the moment, I'm doing it with Adobe Acrobat pro, but with this system, i have to add the same XMP to each PDF file. The result with Adobe Acrobat pro is a file that complies with PDF/A-2a Standard.

What I want to do, is to create a script/batch file to automat this task.
I've tried to do it in the following way.

I've got the next XMP code in a file named metadatos.xmp:
<?xpacket begin="�" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.3.0">
   <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>Nombre del Productor</pdf:Producer>
      </rdf:Description>
      <rdf:Description rdf:about=""
            xmlns:pdfaid="http://www.aiim.org/pdfa/ns/id/">
         <pdfaid:part>2</pdfaid:part>
         <pdfaid:conformance>A</pdfaid:conformance>
      </rdf:Description>
   </rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>

I run the next command in CMD:
exiftool -tagsfromfile metadatos2.xmp -all:all "justificante (1).pdf"
And reveived the following output:
1 image files updated
after that run:
exiftool.exe "justificante (1).pdf"
ExifTool Version Number         : 12.67
File Name                       : justificante (1).pdf
Directory                       : .
File Size                       : 16 kB
File Modification Date/Time     : 2023:10:18 22:44:16+02:00
File Access Date/Time           : 2023:10:18 22:44:17+02:00
File Creation Date/Time         : 2023:10:16 13:32:15+02:00
File Permissions                : -rw-rw-rw-
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.7
Linearized                      : No
Create Date                     : 2023:10:09 20:11:28+02:00
Modify Date                     : 2023:10:09 20:11:28+02:00
Page Count                      : 1
XMP Toolkit                     : Image::ExifTool 12.67
Creator                         : Mariano
Description                     : Your Description
Title                           : esto es una prueba
Producer                        : Nombre del Productor

1.7 is supposed to be ok (it complies with PDF/A-2a). But, when i open the PDF with acrobat pro, it doesn't says that it is correct (it should have a blue line on under the toolbar saying that we are viewing a PDF/A file). I also check with other PDF validator programs as veraPDF, and the results are the ones post in the image.

Ok, from here I'm running out of ideas. my question is: can Exiftool do what i need?
thanks in advance, and sorry for my english!!


Phil Harvey

I don't know why it fails validation.  I don't have a copy of the PDFA-2 specification -- it is imprisoned by the ISO, so I don't know anything about that.  Perhaps linearizing the PDF would help (incorporating ExifTool's incremental update).  This command will linearize a PDF, but you need the "qpdf" utility:

qpdf --linearize in.pdf out.pdf

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

StarGeek

Current versions of qpdf allow you to replace the original file, sort of like exiftool's -overwrite_original

qpdf --linearize --replace-input file.pdf

Quote from: masega1986@hotmail.com on October 18, 2023, 05:03:13 PMI also check with other PDF validator programs as veraPDF, and the results are the ones post in the image.

What is the output of VeraPDF's report (Save/View HTML/XML buttons at the bottom). I found a StackExchange post which showed the problems with the file.  At least, I'm assuming it's the report, it's not quite clear.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype