Whenever I export a PDF file in Mathematica with the Export command, the meta-info of the pdf file will have the title as "Temporary Clipboard 0". I want to change the title. But using:
plot = Plot[Sin[x], {x, 0, 6 Pi}];
Export["test.pdf", plot, "Title" -> "Some title"]
does not change anything.
The Manual, says "Title" is the correct Meta-information element.
Whats wrong?
Thank you for your time reading this and your possible hints and solutions!
Answer
I have found a solution that works but it is OS specific. The following code works on Linux with installed exiftools.
A new function is provided (ExportPDF) that takes the same arguments as Export and an optional further argument "title". The PDF is produced with the standard export function and the command line tool exiftool is used to alter the title. If no title is given, then the filename will be used as title.
ExportPDF[filename_, expr_, title_: 0] := Module[{command, title0},
If[title == 0, title0 = filename, title0 = title];
command = "exiftool -Title='" <> ToString[title0] <> "' -overwrite_original " <> filename;
Export[filename, expr];
Run[command]
];
The same can be done with meta-fields as e.g. author.
Any better solutions or improvements of the given function are very welcome!
Comments
Post a Comment