嗨,我有一个 C# 代码片段,它将为 pdf 文件分配标题。但我正在尝试对目录中的每个 pdf 文件执行相同的操作。任何人都可以帮助我...?
以下是代码片段“ PdfReader pdfReader = new PdfReader(filePath); using (FileStream fileStream = new FileStream(newFilePath, FileMode.Create, FileAccess.Write)) { string title = pdfReader.Info["Title"] as string; Trace .WriteLine("现有标题:" + title);
PdfStamper pdfStamper = new PdfStamper(pdfReader, fileStream);
Hashtable newInfo = pdfReader.Info;
newInfo["Title"] = "New title";
pdfStamper.MoreInfo = newInfo;
pdfReader.Close();
pdfStamper.Close();
}
"