如何從 pdf 中刪除元資料的特定行/鍵

如何從 pdf 中刪除元資料的特定行/鍵

我在多個論壇上讀到,pdf 書籍元資料的通用 PDF 部分格式錯誤,在嘗試讀取時會導致錯誤。如何從 pdf 中刪除特定的鍵和值,這會損壞資料嗎?

這是數據

File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.6
Linearized                      : No
Universal                       : PDF
The                             : process
Code Mantra                     : Acrobat
Author                          : ModDate
LLC                             : http://www.codemantra.com
Create Date                     : 2004:08:26 09:42:01+05:30
EBX PUBLISHER                   : University of Toronto Press
Page Layout                     : SinglePage
Page Count                      : 419
Page Mode                       : UseOutlines
Has XFA                         : No
XMP Toolkit                     : 3.1-702
Code Mantra 002 C0020 LLC       : http://www.codemantra.com
Universal 0020 PDF              : The process that creates this PDF constitutes a trade secret of codeMantra, LLC and is protected by the copyright laws of the United States
Modify Date                     : 2012:09:11 15:27:50+05:30
Metadata Date                   : 2012:09:11 15:27:50+05:30
Creator Tool                    : Acrobat 5.0 Paper Capture Plug-in for Windows
Document ID                     : uuid:ccee9833-967a-4d92-b5fa-12faa7d620c4
Instance ID                     : uuid:51e5148e-3afa-45df-82b8-26d43c7e6ffc
Format                          : application/pdf
Title                           : 
Creator                         : .

任何幫助,將不勝感激

答案1

這個答案假設您想使用 exiftool 來實現此目的。對於 PDF,可能還有其他工具可以更好地完成工作,特別是如果您想要定位單個項目,但不想刪除所有項目。

首先,您需要確定標籤名稱(參見exiftool 常見問題 #2)。您顯示的輸出列出了標籤描述,而不是標籤名稱。運行此命令以按名稱列出標籤。
exiftool -s File.PDF

獲得要刪除的標籤名稱後,您的命令將是
exiftool -TAG= <FileOrDir>
您可以清除多個標籤並在該命令中列出多個檔案和目錄。

如果出現類似 的錯誤Warning: Tag 'xxx' is not defined,則表示您有自訂標記,exiftool 無法單獨刪除該標記。從您發布的輸出來看,情況可能是這樣。您可以使用 exiftool 刪除所有嵌入的元數據
exiftool -All:All= <FileOrDir>

由於 exiftool 編輯文件的方式,您可能仍然遇到問題(請參閱exiftool PDF 頁面)。您可能需要重新線性化文件才能完成專案。這可以用以下方法完成量子PDF用指令
qpdf --linearize in.pdf out.pdf

相關內容