简体   繁体   English

使用 C# 在线编辑 PDF 文件的元数据

[英]Edit metadata of a PDF file online with C#

I searching for methods or libarys to edit metadata of an online pdf file.我正在搜索方法或库来编辑在线 pdf 文件的元数据。

I work on Sharepoint 2013 and i have 10k files where I need to delete the "author" and "modifiedBy".我在 Sharepoint 2013 工作,我有 10k 个文件需要删除“作者”和“修改者”。

I'm on LAN and the server has no inte.net connection我在 LAN 上,服务器没有 inte.net 连接

I have already tested PDF Sharp, i can save it in local but i can't save it at the same place/url.我已经测试过 PDF Sharp,我可以将它保存在本地,但我不能将它保存在同一个地方/url。

public static void RemoveMetadataPropertiesPdf(IGrouping<string, SPFile> GetAllSpecifiedGroupingFile)
    {
       // DeleteUserWordX();
        foreach(SPFile file in GetAllSpecifiedGroupingFile){

            Stream streamfile = file.OpenBinaryStream();

            PdfDocument document = PdfReader.Open(streamfile);

            string DocumentInfoAuto = document.Info.Author;
            document.Info.Author = "toto";
            document.Save(streamfile);
            document.Close();
            streamfile.Dispose();

            file.Update();
        }
        
    }

Maybe you have some issues or samples for c#.也许您有 c# 的一些问题或样品。

Thanks a lot非常感谢

Maybe you could use the Microsoft graph API for this, In that sense i mean importing the file with the API. Then perform your actions on the file and send it back using the API.也许您可以为此使用 Microsoft 图 API,从这个意义上说,我的意思是使用 API 导入文件。然后对文件执行操作并使用 API 将其发回。

Have never worked with files in the graph API, but it seems to be possible.从未使用过图表 API 中的文件,但这似乎是可能的。 I recommend reading the documentation well since the use of the API can be confusing我建议仔细阅读文档,因为 API 的使用可能会造成混淆

Overview概述

Microsoft Graph API微软图形 API

Files文件

Working with files 使用文件

Documentation文档

enter link description here 在此处输入链接描述

It also has an handy demo environment.它还有一个方便的演示环境。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM