C# Tutorial: Add PDF Document Metadata

Complete Guide and User Manual to Add Metadata for PDF File in C#
This page is written to provide C# developer with a general idea of what is metadata, what are the advantages of using PDF metadata, as well as how you can add metadata in PDF document by using Visual C# PDF processing component library.
What is the PDF metadata? Literally metadata means "data about data". Portable Document Format (PDF) documents created in Adobe Acrobat 5.0 or later versions contain their metadata in XML file format. Metadata includes additional background information about the PDF file and its contents in details, such as the PDF file name, subject, the name of the author, file type category, keywords, comment, copyright information, etc.
If you have not installed the Adobe Acrobat, you can also use a third party tool like Yiigo Visual C# .NET PDF processing library to extend and edit the metadata for the PDF. Metadata information can be important because they can help label and identify the PDF document.
If you still need other C# online tutorials for PDF application, some more Visual C# PDF guides are provided here for you:
How to Add PDF Document Metadata in C#

Available Filed for C# PDF Metadata Editor DLL

  • Title: The title for the Visual C# .NET PDF document that you have created;
  • Author: The author of this PDF file that you are creating;
  • Producer: The creator / editor who have produced this PDF file in C# project. Note that, it could the same as the PDF author;
  • CreationDate: The exact date on which you have created this PDF file. It should be in YYYYMMDDHHmmss format;
  • ModDate: The exact data on which you have made modifications to the Visual C# project PDF file;
  • Description: Give a general description for the subject / topic of C# PDF document that you have created;
  • Keywords: You can fill in some of the keywords for this PDF file, with each one of them separated by a semicolon.

C# PDF Metadata Adding Project: Configuration and Deployment

  • Microsoft Windows operating systems such as Windows XP, Windows 7, etc;
  • Microsoft .NET Framework 2.0 and later versions;
  • .NET development environment such as Microsoft Visual Studio 2005 and above;
  • Microsoft Visual Studio Windows application and ASP.NET Web application;
  • Visual C# .NET programming language.

C# PDF Metadata Adding Project: Installation and Integration

  • Download the trial package of Yiigo .NET Image SDK online;
  • Unzip the package and run the license wizard to get a license in txt format;
  • Open your Visual Studio to create a Visual C# PDF metadata adding application such as Windows Forms application;
  • Now copy the text license and all the C#.NET PDF & lmaging library DLLs into your C# project folder;
  • Add the references to all the PDF processing assemblies.

C# PDF Metadata Adding Project: Add PDF Metadata in C#

Up till now you have already created a Visual C# PDF metadata application in your Microsoft Visual Studio, and added the corresponding DLL components to your PDF project references. Now you are definitely ready to start adding and editing metadata information for your own PDF documents in C#.NET program.
There are actually several ways for C# users to add & edit the PDF metadata without using any third party tools like Adobe Acrobat, such as editing the Extensible Metadata Platform (XMP) or achieve this directly via Visual C# .NET programming. In the C# example below, we have provide you with a demo to edit the PDF metadata with information, like author, description, keywords, creation data, etc. You can change necessary details according to your PDF information and copy to your C# project for evaluation.
YiigoImagePDF yiigoPDFTest = new YiigoImagePDF ();
YiigoPDFProcess state= YiigoImagePDF .LoadFromFile("c:\\test.pdf", false);
if (state== YiigoPDFProcess .OK) {
yiigoPDFTest.SetMetadata("<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d' bytes='1513'?>" +
Constants.vbCrLf +
"<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:iX='http://ns.adobe.com/iX/1.0/'>" +
Constants.vbCrLf +
" <rdf:Description about='' xmlns='http://ns.adobe.com/pdf/1.3/' xmlns:pdf='http://ns.adobe.com/pdf/1.3/'>" +
Constants.vbCrLf +
" <pdf:Author>John</pdf:Author>" + Constants.vbCrLf +
" <pdf:Creator>Yiigo</pdf:Creator>" + Constants.vbCrLf +
" <pdf:Title>Hemingway</pdf:Title>" + Constants.vbCrLf +
" <pdf:CreationDate>D:201308211458+0100</pdf:CreationDate>" + Constants.vbCrLf +
" <pdf:Subject>PDF Demo File</pdf:Subject>" + Constants.vbCrLf +
" <pdf:Keywords>Various PDF processing demos</pdf:Keywords>" + Constants.vbCrLf +
" </rdf:Description>" + Constants.vbCrLf +
" <xap:Author>John</xap:Author>" + Constants.vbCrLf +
" <xap:Title>" + Constants.vbCrLf +
" <rdf:Alt>" + Constants.vbCrLf +
" <rdf:li xml:lang='x-default'>Demo</rdf:li>" + Constants.vbCrLf +
" </rdf:Alt>" + Constants.vbCrLf +
" </xap:Title>" + Constants.vbCrLf +
" <xap:CreateDate>D:201308211458+0100</xap:CreateDate>" + Constants.vbCrLf +
" <xap:Description>" + Constants.vbCrLf +
" <rdf:Alt>" + Constants.vbCrLf +
" <rdf:li xml:lang='x-default'></rdf:li>" + Constants.vbCrLf +
" </rdf:Alt>" + Constants.vbCrLf +
" </xap:Description>" + Constants.vbCrLf +
" <dc:creator>Yiigo</dc:creator>" + Constants.vbCrLf +
" <dc:title>Hemingway</dc:title>" + Constants.vbCrLf +
" <dc:description></dc:description>" + Constants.vbCrLf +
" </rdf:Description>" + Constants.vbCrLf +
"</rdf:RDF>" + Constants.vbCrLf + "<?xpacket end='r'?>");
yiigoPDFTest.SaveToFile("c:\\pdf-metadata.pdf", false);
MessageBox.Show("Ok");
} else {
MessageBox.Show("Failed to open the file");
}
Yiigo.Image for C#
Yiigo.Image Plugins
Image Viewer CoreBarcode PluginPDF Read & WriteTesseract OCR PluginForm Processing PluginJBIG2 CodecJPEG2000 CodecISIS ScannerTwain ScannerDICOM ReaderCAD Scanner