HTML JPG PDF XML DOCX
  Product Family
PDF

Adicionar Anotações de Tachado em PDF via .NET SDK

API para adicionar anotações a documentos PDF com .NET.

Get Started

Como anexar anotações a documentos PDF usando Cloud .NET SDK

Para adicionar anotações de tachado a documentos PDF via Cloud .NET SDK, usaremos Aspose.PDF Cloud .NET SDK Este Cloud SDK permite que você construa facilmente aplicativos criadores, editores e conversores de PDF baseados em nuvem em C#, ASP.NET ou outras linguagens .NET para várias plataformas de nuvem. Abra NuGet gerenciador de pacotes, procure por Aspose.PDF Cloud e instale. Você também pode usar o seguinte comando no Console do Gerenciador de Pacotes.

Comando do Console do Gerenciador de Pacotes


    PM> Install-Package Aspose.Pdf-Cloud
     

Passos para adicionar anotações usando .NET SDK

Os desenvolvedores do Aspose.PDF Cloud podem facilmente carregar e anexar anotações a documentos PDF em apenas algumas linhas de código.

  1. Carrega o PDF de entrada.
  2. Cria uma nova StrikeOutAnnotation com propriedades como posição, cor e texto.
  3. Adiciona-o à página desejada usando a API Aspose.PDF Cloud.
  4. Valida a resposta.
  5. Baixa o documento atualizado localmente.
 

Este código de exemplo mostra como adicionar anotações a um 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_");
                }
            }
        }
    }