PDF 文件電子簽名解決方案

使用免費的跨平臺應用程式和 API 對 PDF 文件進行數位簽名。

如何將數位簽名添加到 PDF 檔

為了添加登錄PDF文件,我們將使用[Aspose.PDF](https://products.aspose.com/pdf)API,這是一個功能豐富,功能強大且易於使用的文檔操作API。打開 [NuGet](https://www.nuget.org/packages/aspose.pdf) 包管理器,搜索“aspose.PDF然後安裝。您也可以從程式包管理器主控台使用以下命令。使用簽名對 PDF 文件進行簽名時,您基本上可以「按原樣」確認其內容。因此,之後所做的任何其他更改都會使簽名無效,因此,您將知道文檔是否被更改。

您可以使用以下分類和方法進行PDF簽名

  1. 課程 [文檔管理員簽名](https://reference.aspose.com/pdf/net/aspose.pdf.forms/docmdpsignature)。
  2. 枚舉 [文檔管理器訪問許可權](https://reference.aspose.com/pdf/net/aspose.pdf.forms/docmdpaccesspermissions)。
  3. [已認證]Ks(https://reference.aspose.com/pdf/net/aspose.pdf.facades/pdffilesignature/properties/iscertified) 類中的屬性 [已認證](https://reference.aspose.com/pdf/net/aspose.pdf.facades/pdffilesignature)。

使用數位簽名對 PDF 進行簽名。

<% signature0.code-block.subtitle %>

   var esign_doc = new Document("My File.pdf");
    var page = esign_doc.PdfDocument.Pages[1];
    // Create text stamp
    TextStamp textStamp = new TextStamp(getFormattedText("digital signature text"));
    // Set whether stamp is background
    // textStamp.Background = true;
    textStamp.HorizontalAlignment = HorizontalAlignment.Right;
    textStamp.VerticalAlignment = VerticalAlignment.Bottom;
    textStamp.TextAlignment = HorizontalAlignment.Center;
    textStamp.TextState.Font = FontRepository.FindFont("Arial");
    textStamp.TextState.FontSize = 50;
    textStamp.Width = page.PageInfo.Width / 3;
    textStamp.TextState.ForegroundColor = Color.FromRgb(System.Drawing.Color.Aqua);
    page.AddStamp(textStamp);

    esign_doc.Save("esignedFile.pdf", SaveFormat.Pdf);