PDF Set values

Started by roux2, August 24, 2011, 06:04:48 AM

Previous topic - Next topic

roux2

From my perl scripts i'd like to be able to write PDF metadata.
My understanding from the chart on the website is that it is possible now.

My test case is simple
$dri = new Image::ExifTool;
$dri->SetNewValue(Title => $oj{'Title'}) or die($!);
# $dri->SaveNewValues();
$dri->WriteInfo($fila,$fila.'.pdf','XMP','Info') or die($!);

I've been trying many combinations with the 8.624 version i'm using but no success yet in writing a title in the PDF metadatas.
I must be missing something ((

Phil Harvey

What you have done will write an XMP Title to your pdf file.  (Although the 2 last arguments in your WriteInfo call are unnecessary).  I tested it here and it works fine with the t/images/PDF.pdf sample file.

Why do you say the title isn't written?

- 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 ($).

roux2

When i open the file with Acrobat i can still see the old title.

I can see the right title in the XMP XML segment but not in the value i'll grab with ->GetValue('Title')

It seems to me all the layers of metadata are not synchronized.

- Stéphane.

Phil Harvey

Hi Stéphane,

This problem is related to FAQ number 3.

The "Title" tag exists in both XMP and PDF metadata in PDF files.  However, ExifTool should be writing both locations if you don't specify a group when writing the tag.  Use -a -G1 as per the FAQ when extracting to see where it was written.  If the values in the different locations disagree, I'm not sure which one Acrobat will display.

In case it is useful, there are two exiftool argument files included in the full exiftool distribution for synchronizing the PDF and XMP tags: pdf2xmp.args and xmp2pdf.args.

- 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 ($).