HTML
JPG
PDF
XML
DOCX
PDF
Agregar anotaciones de texto libre a PDF a través de .NET SDK
API para agregar anotaciones a documentos PDF con .NET.
Get StartedCómo adjuntar anotaciones a documentos PDF usando Cloud .NET SDK
Para agregar anotaciones a documentos PDF a través de Cloud .NET SDK, usaremos Aspose.PDF Cloud .NET SDK Este SDK en la nube le permite crear fácilmente aplicaciones basadas en la nube para crear, editar y convertir PDF en C#, ASP.NET u otros lenguajes .NET para varias plataformas en la nube. Abra NuGet el administrador de paquetes, busque Aspose.PDF Cloud e instale. También puede usar el siguiente comando desde la Consola del Administrador de Paquetes.
Comando de la Consola del Administrador de Paquetes
PM> Install-Package Aspose.Pdf-Cloud
Pasos para agregar anotaciones usando .NET SDK
Los desarrolladores de Aspose.PDF Cloud pueden cargar y adjuntar fácilmente anotaciones a documentos PDF en solo unas pocas líneas de código.
- Carga el PDF.
- Crea un cuadro de texto con estilo (con fuentes, colores, alineación).
- Envía la anotación a la página especificada.
- Descarga el documento modificado para uso local.
Este código de ejemplo muestra cómo agregar anotaciones a un documento PDF
using Aspose.Pdf.Cloud.Sdk.Model;
namespace Annotations
{
public class NewFreetextAnnotation
{
public static async Task Append(AnnotationsHelper helper, string documentName, int pageNumber, string outputName, string remoteFolder)
{
await helper.UploadFile(documentName);
List<FreeTextAnnotation> annotations = new List<FreeTextAnnotation>
{
new FreeTextAnnotation(
Name: "Freetext_NEW_Annotation",
Rect: new Rectangle(100,350, 450,400),
Flags: new List<AnnotationFlags>() { AnnotationFlags.Default },
HorizontalAlignment: HorizontalAlignment.Left,
Intent: FreeTextIntent.FreeTextTypeWriter,
Justification: Justification.Center,
RichText: helper.config.NEW_FT_ANNOTATION_TEXT,
Subject: helper.config.NEW_FT_ANNOTATION_SUBJECT,
Contents: helper.config.NEW_FT_ANNOTATION_CONTENTS,
Title: helper.config.NEW_FT_ANNOTATION_DESCRIPTION,
ZIndex: 1,
TextStyle: new TextStyle(
FontSize: 20,
Font: "Arial",
ForegroundColor: new Color( A: 0xFF, R: 0x00, G: 0xFF, B: 0x00),
BackgroundColor: new Color( A: 0xFF, R: 0xFF, G: 0x00, B: 0x00)
),
Modified: "03/27/2025 00:00:00.000 AM"
)
};
AsposeResponse response = await helper.pdfApi.PostPageFreeTextAnnotationsAsync(documentName, pageNumber, annotations, folder: remoteFolder);
if (response == null)
Console.WriteLine("NewFreetextAnnotation(): Unexpected error!");
else if (response.Code < 200 || response.Code > 299)
Console.WriteLine("NewFreetextAnnotation(): Failed to append text annotation to the document.");
else
{
Console.WriteLine("NewFreetextAnnotation(): annotations '{0}' added to the document '{1}.", helper.config.NEW_FT_ANNOTATION_TEXT, documentName);
await helper.DownloadFile(documentName, outputName, "add_text_annotation_");
}
}
}
}