Andre Borges Andre Borges - 1 year ago 153
C# Question

iTextSharp - Modify additional metadata in PDF

There are a lot of

examples out there showing how to append metadata like "Title", "Author", "Keywords" to an existing PDF using
dictionary (like this), and I've successfully managed to do this.

But is there a way to set properties that Adobe Reader calls "Additional Metadata" that are visible when you click "Document Properties" -> "Additional metadata"? These properties include "Description", "Author title", "Copyright status", "Copyright notice" and some more. Are there some dictionary keys in
that represent these properties?

Answer Source

iText5 does not expose the additional data in PdfStamper#MoreInfo. It is however possible to retrieve the metadata containing using PdfReader#XmpMetaData and to set it using PdfDocument#XmpMetaData or PdfStamper#XmpMetaData.

the metadata is returned and set as a byte[], so you'll have to handle the translation/generation from and to yourself.

In iText7, the process is mostly the same, but handled through the PdfDocument class instead (since it is a wrapper for a PdfReader and PdfWriter object.)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download