通過 C++ 在 PDF 文檔中添加 Strikeout 註釋

構建您自己的C++應用程式,以使用本機 API 操作文件檔中的註釋和作者。

為了註釋PDF檔,我們將使用[Aspose.PDF for C++](https://products.aspose.com/pdf/cpp/)API,這是一個功能豐富,功能強大且易於使用的文檔操作API,適用於C++平臺。打開 [NuGet](https://www.nuget.org/packages/aspose.pdf) 包管理器,搜索“.PDF”並安裝。您也可以從程式包管理器主控台使用以下命令。

Package Manager Console

PM > Install-Package Aspose.PDF.Cpp

通過 C++ 添加 Strikeout 註釋


您需要 [Aspose.PDF](https://releases.aspose.com/pdf/cpp/) 來嘗試環境中的代碼。

  • 在文檔類的實例中載入 PDF
  • 創建新頁面或獲取對現有頁面的引用
  • 創建 Strikeout 批注
  • 從頁面 Add 中調用 Strikeout 批注的方法
  • 再次保存檔

系統要求


所有主要操作系統都支援 C++ 的 Aspose.PDF。只需確保滿足以下先決條件即可。

  • 微軟視窗或相容的作業系統,C++運行時環境適用於視窗 32 位、視窗 64 位和 Linux 64 位。
  • 開發環境,如微軟視覺工作室。
  • 用於專案中引用的C++ DLL 的.PDF。

從 PDF 添加 Strikeout 註釋 - C++

Example

    // Load the PDF file
    Document document = new Document(System.IO.Path.Combine(_dataDir, "sample.pdf"));
    // This annotation is used to indicate the insertion of text
    var StrikeoutAnnotation1 = new StrikeoutAnnotation(document.Pages[1], new Rectangle(299.988, 713.664, 308.708, 720.769))
    {
        Title = "Aspose User",
        Subject = "Inserted text 1",
        Flags = AnnotationFlags.Print,
        Color = Color.Blue
    };
    document.Pages[1].Annotations.Add(StrikeoutAnnotation1);
    document.Save(System.IO.Path.Combine(_dataDir, "sample_Strikeout.pdf"));