跳到主要内容

ApplyRedact

应用已添加的涂黑。

语法​

expression.ApplyRedact(includeForms, includeAnnots);

expression - 表示 ApiDocument 类的变量。

参数​

名称必需/可选数据类型默认值描述
includeForms可选booleantrue指定是否在涂黑中包括表单字段。
includeAnnots可选booleantrue指定是否在涂黑中包括注释。

返回值​

boolean

示例​

在 PDF 中永久隐藏敏感内容。

// Can I remove information so it cannot be recovered in a PDF?

// Cover and protect confidential areas in a PDF.

let doc = Api.GetDocument();
let redactAnnot = Api.CreateRedactAnnot([84, 60, 231, 70]);
doc.AddPage(0);
let page = doc.GetPage(0);
page.AddObject(redactAnnot);
doc.ApplyRedact();
console.log('We added a redact annot to first page and applied it');