HTML JPG PDF XML DOCX
  Product Family
PDF

Agregar anotaciones de tachado a PDF a través de .NET SDK

API para agregar anotaciones a documentos PDF con .NET.

Get Started

Cómo agregar anotaciones a documentos PDF usando Cloud .NET SDK

Para agregar anotaciones de tachado a documentos PDF a través de Cloud .NET SDK, utilizaremos Aspose.PDF Cloud .NET SDK Este SDK en la nube te permite crear fácilmente aplicaciones de creación, edición y conversión de PDF basadas en la nube en C#, ASP.NET u otros lenguajes .NET para varias plataformas en la nube. Abre NuGet el administrador de paquetes, busca Aspose.PDF Cloud e instala. También puedes 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 agregar fácilmente anotaciones a documentos PDF con solo unas pocas líneas de código.

  1. Carga el PDF de entrada.
  2. Crea una nueva StrikeOutAnnotation con propiedades como posición, color y texto.
  3. La añade a la página deseada usando Aspose.PDF Cloud API.
  4. Valida la respuesta.
  5. Descarga el documento actualizado localmente.
 

Este código de ejemplo muestra cómo agregar anotaciones a un documento PDF


    using Aspose.Pdf.Cloud.Sdk.Model;

    namespace Annotations
    {
        public class NewStrikeoutAnnotation
        {
            public static async Task Append(AnnotationsHelper helper, string documentName, int pageNumber, string outputName, string remoteFolder)
            {
                await helper.UploadFile(documentName);

                List<StrikeOutAnnotation> annotations = new List<StrikeOutAnnotation>
                {
                    new StrikeOutAnnotation(
                        Name: "Strikeout_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_SO_ANNOTATION_TEXT,
                        Subject: helper.config.NEW_SO_ANNOTATION_SUBJECT,
                        Contents: helper.config.NEW_SO_ANNOTATION_CONTENTS,
                        Title: helper.config.NEW_SO_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.PostPageStrikeOutAnnotationsAsync(documentName, pageNumber, annotations, folder: remoteFolder);

                if (response == null)
                    Console.WriteLine("NewStrikeoutAnnotation(): Unexpected error!");
                else if (response.Code < 200 || response.Code > 299)
                    Console.WriteLine("NewStrikeoutAnnotation(): Failed to append strikeout annotation to the document.");
                else
                {
                    Console.WriteLine("NewStrikeoutAnnotation(): annotations '{0}' added to the document '{1}.", helper.config.NEW_SO_ANNOTATION_TEXT, documentName);
                    await helper.DownloadFile(documentName, outputName, "add_strikeout_annotation_");
                }
            }
        }
    }