PPTX
DOCX
XLSX
PDF
ODP
PDF
PDF 文件密文解決方案
使用免費的跨平臺應用程式和 API 查找和刪除 PDF 文件中的內容
如何編輯 PDF 檔
為了編輯PDF文件,我們將使用[Aspose.PDF](https://products.aspose.com/pdf)API,這是一個功能豐富,功能強大且易於使用的文檔操作API,適用於任何平臺。打開 [NuGet](https://www.nuget.org/packages/aspose.pdf) 包管理器,搜索“.PDF”並安裝。您也可以從程式包管理器主控台使用以下命令。
密文文檔
<% redaction.feature-section-col1.content-01 %>
- 載入包含文件實例的 PDF。 創建文本碎片以搜索詞作為參數的吸收物件。
- 設定搜尋選項。
- 迴圈遍歷每個片段收集以進行密文。
- 儲存檔。
系統要求
只需確保滿足以下先決條件即可。
+微軟視窗或相容的操作系統與.NET框架,.NET Core和PHP,VBScript,德爾福,C++通過COM互操作。 +開發環境,如微軟視覺工作室。
- 為專案中引用的 .NET DLL 提供.PDF。
密文 - C#。
Document doc = new Document(dataDir + "test.pdf");
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber(searchTerm);
TextSearchOptions textSearchOptions = new TextSearchOptions(true);
textFragmentAbsorber.TextSearchOptions = textSearchOptions;
doc.Pages.Accept(textFragmentAbsorber);
TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;
foreach (TextFragment textFragment in textFragmentCollection)
{
Page page = textFragment.Page;
Rectangle annotationRectangle = textFragment.Rectangle;
Annotations.RedactionAnnotation annot = new Annotations.RedactionAnnotation(page, annotationRectangle);
annot.FillColor = Color.Black;
doc.Pages[textFragment.Page.Number].Annotations.Add(annot, true);
annot.Redact();
}
doc.Save(dataDir + "output.pdf");