文件註釋解決方案

使用免費的跨平臺應用程式和 API 從 PDF 文件中刪除註釋

如何使用「檔庫.PDF」對 PDF 檔進行註釋

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

用於編輯文件中的註釋和註釋的高代碼 API

本機 API,用於使用 .NET、.NET Core、Java C++和安卓對 PDF 文件進行批注。 這些是您添加到檔中以擴展文本內容,進行編輯,為其他使用者註釋的其他物件。還可以使文檔中的文本更具可讀性,突出顯示它,下劃線或添加全新的文本。

<% annotation0.feature-page02.h2 %>

<% annotation0.feature-page02.text01 %>

添加插入記號批註 - C#。

// 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 caretAnnotation1 = new CaretAnnotation(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(caretAnnotation1);
document.Save(System.IO.Path.Combine(_dataDir, "sample_caret.pdf"));

<% annotation0.feature-page03.h2 %>

<% annotation0.feature-page03.text01 %>

添加圓圈註釋 - Java。

// Load the PDF file
Document document = new com.aspose.pdf.Document(_dataDir + "appartments.pdf");
Page page = document.getPages().get_Item(1);

// Create Polygon Annotation
CircleAnnotation circleAnnotation = new CircleAnnotation(page, new Rectangle(270, 160, 483, 383));
circleAnnotation.setTitle("John Smith");
circleAnnotation.setColor(Color.getRed());
circleAnnotation.setInteriorColor(Color.getMistyRose());
circleAnnotation.setOpacity(0.5);
circleAnnotation.setPopup(new PopupAnnotation(page, new Rectangle(842, 316, 1021, 459)));

// Add annotation to the page
page.getAnnotations().add(circleAnnotation);
document.save(_dataDir + "appartments_mod.pdf");

<% annotation0.feature-page04.h2 %>

<% annotation0.feature-page04.text01 %>

添加自由文本註釋 - C++。

String _dataDir("C:\\Samples\\");

// Load the PDF file
auto document = MakeObject<Document>(_dataDir + u"sample.pdf");
auto page = document->get_Pages()->idx_get(1);

auto defaultAppearance = MakeObject<DefaultAppearance>();
defaultAppearance->set_FontName(u"Helvetica");
defaultAppearance->set_FontSize(12);
defaultAppearance->set_TextColor(System::Drawing::Color::get_Blue());

auto freeTextAnnotation = MakeObject<FreeTextAnnotation>(page, new Rectangle(300.0, 770.0, 400.0, 790.0), defaultAppearance);

freeTextAnnotation->set_RichText(u"Free Text Demo");
page->get_Annotations()->Add(freeTextAnnotation);
document->Save(_dataDir + u"sample_freetext.pdf");