c# – iTextSharp .NET PDF – 无法更改PDF Producer
发布时间:2020-12-15 23:31:55 所属栏目:百科 来源:网络整理
导读:我正在使用iTextSharp产品来更改PDF属性,如下所示. 我根本无法更改“PDF Producer”属性.请建议,我哪里出错了. 代码行 info [“Producer”] =“我的制片人”; 没有按预期工作. string sourcePath = tbPath.Text; IListstring dirs = null; string pdfName =
我正在使用iTextSharp产品来更改PDF属性,如下所示.
我根本无法更改“PDF Producer”属性.请建议,我哪里出错了. 代码行 没有按预期工作. string sourcePath = tbPath.Text; IList<string> dirs = null; string pdfName = string.Empty; string OutputPath = string.Empty; DirectoryInfo di = new DirectoryInfo(sourcePath); DirectoryInfo dInfo = Directory.CreateDirectory(sourcePath + "" + "TempDir"); OutputPath = Path.Combine(sourcePath,"TempDir"); dirs = Directory.GetFiles(di.FullName,"*.pdf").ToList(); for (int i = 0; i <= dirs.Count - 1; i++) { try { PdfReader pdfReader = new PdfReader(dirs[i]); using (FileStream fileStream = new FileStream(Path.Combine(OutputPath,Path.GetFileName(dirs[i])),FileMode.Create,FileAccess.Write)) { PdfStamper pdfStamper = new PdfStamper(pdfReader,fileStream); Dictionary<string,string> info = pdfReader.Info; info["Title"] = ""; info["Author"] = ""; info["Producer"] = "My producer"; ////THIS IS NOT WORKING.. pdfStamper.MoreInfo = info; pdfStamper.Close(); pdfReader.Close(); } 解决方法
如果您拥有许可证密钥,则只能更改生产者行.需要从
iText Software购买许可证密钥.有关如何应用许可证密钥的说明与该密钥一起发送.
如果您想免费使用iText,则无法更改生产线.查看开源版iText中每个文件的许可证标题: * In accordance with Section 7(b) of the GNU Affero General Public License,* a covered work must retain the producer line in every PDF that is created * or manipulated using iText. 您的信息:iText集团已成功起诉一家德国公司,该公司在未购买许可证的情况下更改了生产线.你可以在这里找到一些与这个案例有关的文件:IANAL: What developers should know about IP and Legal(幻灯片57-62) 顺便说一句,我通过这次演讲获得了JavaOne Rockstar奖:https://twitter.com/itext/status/704278659012681728 总结:如果您没有iText的商业许可,则无法合法更改iText中的生产线.如果您拥有商业许可证,则需要应用许可证密钥. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |