I have a three paragraph text file named cicero.txt in my home directory. I have a PDF on my Desktop named cicero.pdf containing the same text as the text file. Now, I want to use ExifTool to insert the contents of that text file into the XMP:descriptioin field of the PDF.
exiftool -overwrite_original '-Description<=-' cicero.pdf < ~/cicero.txt
One requires a PDF Editor to view this XMP description data, but I have written a shell script that extracts the XMP data from the PDF to stdout using ExifTool. The pipe to awk removes dozens of spaces at the end of the ExifTool output.
#!/bin/zsh
[[ "${1:e:l}" == "pdf" ]] || {echo "not a pdf."; exit 1}
XMPData="$(which exiftool) -XMP -b "${1}" | awk 'NF' "
[[ ${XMPData} ]] || {echo "no XMP data in PDF"; exit 1}
print ${XMPData}
exit 0