In data management solutions and publishing scenarios there is a need to route documents based on metadata of a file. For example, there is a scanner that scans documents and puts the documents in a shared folder and from there on a utility looks at the document metadata and routes it to the appropriate folder. In SharePoint 2013, extracting metadata of Microsoft Office documents is fairly straightforward. But the metadata of a PDF file is not extracted automatically. In this article, we will see how, by using the iTextSharp library, we can easily extract the metadata of a PDF file.
Step 1: Using the GacUtil.exe, install the iTextSharp.dll in the GAC. The latest iTextSharp can be downloaded from here.

Step 2: Create a new column called "Metadata" and make it a "Multiline" type as shown below.

Step 3: Create a new blank project for SharePoint 2013 as in the following:

Step 4: Create an Event Receiver as shown below. Choose "Document Library" --> "Add Item Event" and "Item Updating Event".


Step 5: Add a reference to the iTextSharp library and add the following lines of code:
using iTextSharp.text.pdf;
using System.Collections.Generic;
Step 6: In the ItemAdded event add the following lines of code. Please note that this code will only run for document libraries where you have added the additional "Metadata" columns since that is hardcoded as shown below.


Karol WitekPosted Aug 7, 2014, 11:22 AM
Hello, how can I use this solution to SharePoint Online? I don't have Event Receiver Item (just Remote Event Receiver), and don't have those objects. Do you have any idea how to solve that problem? Regards Karol
Lakshmanan Sethu SankaranarayanPosted Feb 23, 2014, 3:43 AM
Thanks for the link
Veena SardaPosted Feb 23, 2014, 2:34 AM
iText is used by Java, .NET, Android and GAE developers to enhance their applications with PDF functionality. iTextSharp is the .NET port. of iText. You can find details at - http://sourceforge.net/projects/itextsharp/
Lakshmanan Sethu SankaranarayanPosted Feb 23, 2014, 12:57 AM
Is iTextSharp a third party library?