我正在对一堆 PDF 文件中的元数据进行批量更新,出于某种原因,主题总是被附加到关键字元数据的末尾。即使我删除了“关键字”更新,当我更新数据时它仍在更新。
这是预期的吗?有没有其他人见过这个?
private void ProcessWithITextSharp(string sourceFile, string destFile) {
iTextSharp.text.pdf.PdfReader reader = new iTextSharp.text.pdf.PdfReader( sourceFile );
FileStream fs = new FileStream( destFile, FileMode.Create, FileAccess.Write, FileShare.None );
PdfStamper stamper = new PdfStamper( reader, fs );
Dictionary<string, string> info = reader.Info;
// title
UpdateValueInInfoDictionary( info, "Title", "My Ridiculous Title" );
UpdateValueInInfoDictionary( info, "Subject", "A Ridiculous Story" );
UpdateValueInInfoDictionary( info, "Author", "Mr. Ridiculous " );
UpdateValueInInfoDictionary( info, "Keywords", "A ridiculous story with a ridiculous title." );
stamper.MoreInfo = info;
stamper.Close();
fs.Close();
}