ドキュメントを元の形式で保存するには、メタデータを削除または編集して、すべての機密データを削除する必要があります。これらの目的のために、GroupDocs.Redactionはメタデータ編集APIを提供します。 GroupDocs.Redaction APIを使用すると、編集済みドキュメントをPDFで保存するか、すべてのページをラスターイメージに変換するか、編集済みドキュメントを元の形式で保存してさらに編集することができます。 PDF、DOC、DOCX、PPT、PPTX、XLS、XLSXなどを含むすべてのファイル形式には、いくつかのメタデータプロパティがあります。これらのプロパティには、作成者名、カテゴリ、会社名、コメント、作成時間、最終更新日などが含まれます。また、さまざまなツールや手法を使用して表示できるファイルに関連付けられた非表示のデータもあります。 GroupDocs.Redaction APIを使用すると、これらのメタデータプロパティのいずれかにメタデータ編集を適用できます。必要なメタデータをフィルタリングすることで、それらを変更または削除できます。このガイドでは、JavaでRTFドキュメントからバージョンメタデータを編集する方法について説明します。
次のコードを使用すると、RTFドキュメントから機密データを検索して編集できます。フィルタを設定することで、編集の範囲を設定できます。 MetadataFilter.Versionに。 「Version」プロパティを除くすべてのメタデータアイテムで、正規表現の一致が取り消されたままになります。
final Redactor redactor = new Redactor(filePath); | |
try | |
{ | |
MetadataSearchRedaction redaction = new MetadataSearchRedaction("version number", "--version--"); | |
redaction.setFilter(MetadataFilters.Version); | |
redactor.apply(redaction); | |
SaveOptions options = new SaveOptions(); | |
options.setAddSuffix(true); | |
options.setRasterizeToPDF(false); | |
// Save the document to "*_Redacted.*" file in original format | |
redactor.save(options); | |
} | |
finally { redactor.close(); } |
EraseMetadataRedactionクラスを使用して、ドキュメント内のすべてまたは特定のメタデータを空の(空白または最小の)値に置き換えることができます。次のコードは、RTFドキュメントからメタデータプロパティをフィルタリングして削除する方法を示しています。次の例では、ドキュメントのすべてのプロパティが空白になっています。
final Redactor redactor = new Redactor(filePath); | |
try | |
{ | |
redactor.apply(new EraseMetadataRedaction(MetadataFilters.All)); | |
SaveOptions options = new SaveOptions(); | |
options.setAddSuffix(true); | |
options.setRasterizeToPDF(false); | |
// Save the document to "*_Redacted.*" file in original format | |
redactor.save(options); | |
} | |
finally { redactor.close(); } |
GroupDocs.Redaction for Java APIは、すべての主要なプラットフォームとオペレーティングシステムでサポートされています。完全なシステム要件ガイドについては、システム要件にアクセスしてください。以下のコードを実行する前に、システムに次の前提条件がインストールされていることを確認してください。 :
Introduced and documented by Microsoft, the Rich Text Format (RTF) represents a method of encoding formatted text and graphics for use within applications. The format facilitates cross-platform document exchange with other Microsoft Products, thus serving the purpose of interoperability. This capability makes it a standard of data transfer between word processing software and, hence, contents can be transferred from one operating system to another without losing document formatting. The file format specifications are available by Microsoft for public download and can be referred to from developer’s perspective.
Read More(Bitmap Image File)
(Microsoft Word Binary Format)
(Microsoft Word 2007 Marco File)
(Office 2007+ Word Document)
(Microsoft Word Template Files)
(Microsoft Word 2007+ Template File)
(Microsoft Word Template File )
(Graphical Interchange Format)
(Joint Photographic Expert Group Image)
(Portable Document Format)
(Portable Network Graphic)
(Microsoft PowerPoint Template Files)
(Microsoft PowerPoint Template File)
(PowerPoint Slide Show)
(Macro-enabled Slide Show)
(PowerPoint Slide Show)
(Microsoft PowerPoint 97-2003)
(Macro-enabled Presentation File)
(Open XML presentation Format)
(Tagged Image File Format)
(Microsoft Excel Spreadsheet (Legacy))
(Macro-enabled Spreadsheet)
(Open XML Workbook)
(Excel 97 - 2003 Template)
(Excel Macro-Enabled Template)
(Excel Template)