相关疑难解决方法(0)

iTextSharp .NET PDF - 无法更改PDF Producer

我正在使用iTextSharp产品来更改PDF属性,如下所示.我根本无法更改"PDF Producer"属性.请建议,我哪里出错了.

代码行 信息["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 …
Run Code Online (Sandbox Code Playgroud)

c# asp.net itextsharp

3
推荐指数
1
解决办法
1899
查看次数

标签 统计

asp.net ×1

c# ×1

itextsharp ×1