首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PDF证书为空同步组件

PDF证书为空同步组件
EN

Stack Overflow用户
提问于 2018-12-17 15:20:06
回答 1查看 153关注 0票数 1

我使用同步组件的Word到PDF转换,然后应用签名从PDF.pfx文件提供的同步融合。下面是代码参考:

打开PDF文档并应用签名:

代码语言:javascript
复制
PdfLoadedDocument document = new PdfLoadedDocument("WordtoPDF8.pdf");
PdfLoadedPage page = document.Pages[0] as PdfLoadedPage;

//Creates a signature field.

PdfSignatureField signatureField = new PdfSignatureField(page, "SignatureField");

        signatureField.Bounds = new RectangleF(0, 0, 100, 100);

        signatureField.Signature = new PdfSignature(document, page, new PdfCertificate(@"C:\Users\someUser\AppData\Local\Syncfusion\EssentialStudio\14.4.0.15\Common\Data\PDF\PDF.pfx", "syncfusion"), "SignatureField");

        signatureField.Signature.Reason = "I am author of this document";

        //Adds the field.

        document.Form.Fields.Add(signatureField);

        //Saves the certified PDF document.



        document.Save();
        //Closes the document
        document.Close(true);

现在打开文档并使用以下代码读取签名:

代码语言:javascript
复制
 PdfLoadedDocument loadedDocument = new PdfLoadedDocument("WordtoPDF8.pdf");

        //Gets the page of the document

        PdfLoadedPage page1 = loadedDocument.Pages[0] as PdfLoadedPage;

        //Gets the signature field from the PDF document
        PdfLoadedField field = null;;
        loadedDocument.Form.Fields.TryGetField("syncfusion",out field);
        PdfLoadedSignatureField field2 = loadedDocument.Form.Fields[0] as PdfLoadedSignatureField;

        //Get PDF Certificate instance from signature field

        PdfCertificate certificate2 = field2.Signature.Certificate;

        //Get the certificate details

        string subjectName = certificate2.SubjectName;
        string issuerName = certificate2.IssuerName;

我得到的问题是,当我得到certificate2时,它是空的。我不知道问题出在哪里。我们将非常感谢您的帮助。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-12-19 01:35:27

最近提供了从现有签名PDF文档中检索证书详细信息的支持,即从v16.4.0.42开始。请参考下面的链接下载最新的essential studio。

https://www.syncfusion.com/forums/141547/essential-studio-2018-volume-4-release-v16-4-0-42-is-available-for-download

请检查以上最新版本以解决PdfCertificate空问题。注意:我在Syncfusion工作。

你好,迪利·巴布。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53810540

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档