即時通訊使用iText將xhtml轉換爲pdf。之後,我正在構建生成的pdf的md5校驗和以僅存儲新的/更改的文件。刪除PDF中的PDF
每個創建的文件都包含一個看起來像散列的PdfID0和PdfID1。
這些「哈希」是什麼?我該如何刪除它們?使用PDFTK
com.lowagie.text.pdf.PdfReader reader = new PdfReader(pdfPath);
com.lowagie.text.pdf.PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(tempFile));
HashMap<String, String> hMap = reader.getInfo();
hMap.put("Title", "MyTitle");
hMap.put("Subject", "Subject");
hMap.put("Keywords", "Key, words, here");
hMap.put("Creator", "me");
hMap.put("Author", "me");
hMap.put("Producer", "me");
hMap.put("CreationDate", null);
hMap.put("ModDate", null);
hMap.put("DocChecksum", null);
stamper.setMoreInfo(hMap);
stamper.close();
和提取的文件METAS:
IM使用下面的代碼從iText的包裝改變metainfos
InfoKey: Creator
InfoValue: me
InfoKey: Title
InfoValue: MyTitle
InfoKey: Author
InfoValue: me
InfoKey: Producer
InfoValue: me
InfoKey: Keywords
InfoValue: Key, words, here
InfoKey: Subject
InfoValue: Subject
PdfID0: 28c71a8d7790a4d3e85ce879a90dec0
PdfID1: 4c5865d36c7a381e6166d5e362d0aafc
NumberOfPages: 1
感謝任何提示
我在生成SHA1和時具有與這些ID完全相同的問題。你有沒有想過如何去除/規範化這個問題,或者你知道下面的信息後就放棄了嗎? – mlissner