HTML
JPG
PDF
XML
DOCX
PDF
Cloud .NET SDK を使用して PDF ドキュメントに注釈を追加する方法
Cloud .NET SDK を介して PDF ドキュメントに注釈を追加するには、次のものを使用します。 Aspose.PDF Cloud .NET SDK この Cloud SDK を使用すると、C#、ASP.NET、またはその他の .NET 言語でさまざまなクラウドプラットフォーム向けのクラウドベースの PDF クリエーター、エディター、コンバーターアプリを簡単に構築できます。開く NuGet パッケージマネージャーで検索し、 Aspose.PDF Cloud をインストールします。パッケージ マネージャー コンソールから次のコマンドを使用することもできます。
パッケージマネージャーコンソールコマンド
PM> Install-Package Aspose.Pdf-Cloud
.NET SDK を使用して注釈を追加する手順
Aspose.PDF Cloud 開発者は、わずか数行のコードで PDF ドキュメントに注釈を簡単にロードして追加できます。
- PDF をクラウドストレージにアップロードします。
- 豊富なメタデータを持つ緑色の下線注釈を作成します。
- 特定のページに適用します。
- サーバーの応答を処理します。
- 更新されたファイルをダウンロードします。
このサンプルコードでは、PDF ドキュメントに下線注釈を追加する方法を示します
using Aspose.Pdf.Cloud.Sdk.Model;
namespace Annotations
{
public class NewUnderlineAnnotation
{
public static async Task Append(AnnotationsHelper helper, string documentName, int pageNumber, string outputName, string remoteFolder)
{
await helper.UploadFile(documentName);
List<UnderlineAnnotation> annotations = new List<UnderlineAnnotation>
{
new UnderlineAnnotation(
Name: "Underline_NEW_Annotation",
Rect: new Rectangle(100,350, 450,400),
Flags: new List<AnnotationFlags>() { AnnotationFlags.Default },
HorizontalAlignment: HorizontalAlignment.Left,
VerticalAlignment: VerticalAlignment.Top,
RichText: helper.config.NEW_UL_ANNOTATION_TEXT,
Subject: helper.config.NEW_UL_ANNOTATION_SUBJECT,
Contents: helper.config.NEW_UL_ANNOTATION_CONTENTS,
Title: helper.config.NEW_UL_ANNOTATION_DESCRIPTION,
ZIndex: 1,
Color: new Color(A: 0xFF, R: 0x00, G: 0xFF, B: 0x00),
QuadPoints: new List<Point>() {
new Point(X: 10, Y: 10),
new Point(X: 20, Y: 10),
new Point(X: 10, Y: 20),
new Point(X: 10, Y: 10)
},
Modified: "03/27/2025 00:00:00.000 AM"
)
};
AsposeResponse response = await helper.pdfApi.PostPageUnderlineAnnotationsAsync(documentName, pageNumber, annotations, folder: remoteFolder);
if (response == null)
Console.WriteLine("NewUnderlineAnnotation(): Unexpected error!");
else if (response.Code < 200 || response.Code > 299)
Console.WriteLine("NewUnderlineAnnotation(): Failed to append underline annotation to the document.");
else
{
Console.WriteLine("NewUnderlineAnnotation(): annotations '{0}' added to the document '{1}.", helper.config.NEW_UL_ANNOTATION_TEXT, documentName);
await helper.DownloadFile(documentName, outputName, "add_underline_annotation_");
}
}
}
}