Sharepoint 2013 PDF与元数据字段 [英] Sharepoint 2013 PDF with metadata fields

查看:109
本文介绍了Sharepoint 2013 PDF与元数据字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行sharepoint 2013基金会,并希望制作内容类型为pdf。我想映射到PDF本身的sharepoint元数据字段,但我无法找到使用adobe acrobat dc的任何方法。有没有人这样做,可以给b
指示如何做到这一点?

i am running sharepoint 2013 foundation and would like to make a content type of pdf. I would like to map onto the PDF itself sharepoint metadata fields but i am unable to find any way to do it using adobe acrobat dc. Has anyone done this and could give me pointers on how to do it?

我的目标是,如果用户创建新文档,她将会看到pdf表单,她填充和sharepoint列将被填充。

My goal is that if a user creates new document she will be presented with the pdf form which she fills and the sharepoint columns would be filled.

推荐答案

我们可以创建一个事件接收者实现它。

We can create an event receiver to achieve it.

1。使用GacUtil.exe,在GAC中安装iTextSharp.dll。

1. Using the GacUtil.exe, install the iTextSharp.dll in the GAC.

2。创建一个名为"元数据"的新列。并使其成为"多线"类型。

2. Create a new column called "Metadata" and make it a "Multiline" type.

3。为文档库创建一个事件接收器。

3. Create an event receiver for document library.

4。在事件接收器ItemAdded方法中,将下面的代码添加到此方法中。

4. In event receiver ItemAdded method, add the code below to this method.

base.ItemAdded(properties);
SPFile f = properties.ListItem.File;
SPListItem currentItem = properties.ListItem;
if (f.Name.EndsWith(".pdf"))
{
	byte[] pdfIn = f.OpenBinary();
	PdfReader pr = new PdfReader(pdfIn);
	string meta = "";
	foreach (KeyValuePair<string, string> pair in pr.Info)
	{
		meta = meta + pair.Key + " = " + pair.Value + ";";
	}
	currentItem["Metadata"] = meta;
	currentItem.SystemUpdate();
}

5。对于ItemUpdating事件,添加以下代码行:

5. For the ItemUpdating event add the following lines of code:

base.ItemUpdating(properties);
properties.ListItem["Metadata"] = properties.AfterProperties["Metadata"];

更多信息请点击此处:

https ://www.c-sharpcorner.com/UploadFile/d2ee01/extract-metadata-of-a-pdf-file-in-sharepoint-2013-document-l/

最诚挚的问候,

丹尼斯


这篇关于Sharepoint 2013 PDF与元数据字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆