IsSigned
内容
[
隐藏
]SignatureLine.IsSigned property
表示签名行由数字签名签名。
public bool IsSigned { get; }
例子
演示如何使用个人证书和签名行签署文档。
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
SignatureLineOptions signatureLineOptions = new SignatureLineOptions
{
Signer = "vderyushev",
SignerTitle = "QA",
Email = "vderyushev@aspose.com",
ShowDate = true,
DefaultInstructions = false,
Instructions = "Please sign here.",
AllowComments = true
};
SignatureLine signatureLine = builder.InsertSignatureLine(signatureLineOptions).SignatureLine;
signatureLine.ProviderId = Guid.Parse("CF5A7BB4-8F3C-4756-9DF6-BEF7F13259A2");
Assert.False(signatureLine.IsSigned);
Assert.False(signatureLine.IsValid);
doc.Save(ArtifactsDir + "DocumentBuilder.SignatureLineProviderId.docx");
SignOptions signOptions = new SignOptions
{
SignatureLineId = signatureLine.Id,
ProviderId = signatureLine.ProviderId,
Comments = "Document was signed by vderyushev",
SignTime = DateTime.Now
};
CertificateHolder certHolder = CertificateHolder.Create(MyDir + "morzal.pfx", "aw");
DigitalSignatureUtil.Sign(ArtifactsDir + "DocumentBuilder.SignatureLineProviderId.docx",
ArtifactsDir + "DocumentBuilder.SignatureLineProviderId.Signed.docx", certHolder, signOptions);
// 重新打开我们保存的文档,并验证“IsSigned”和“IsValid”属性都等于“true”,
// 表示签名行包含签名。
doc = new Document(ArtifactsDir + "DocumentBuilder.SignatureLineProviderId.Signed.docx");
Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);
signatureLine = shape.SignatureLine;
Assert.True(signatureLine.IsSigned);
Assert.True(signatureLine.IsValid);
也可以看看
- class SignatureLine
- 命名空间 Aspose.Words.Drawing
- 部件 Aspose.Words