C#을 사용하여 PDF에 취소선 주석을 추가하는 방법

이 문서의 목적은 **C#**을 사용하여 PDF에 취소선 주석을 추가하는 방법에 대한 지침을 제공하는 것입니다. PDF 파일에 취소선 주석을 추가하면 특정 텍스트나 콘텐츠를 강조하는 데 유용할 수 있습니다. 다행히 일반적으로 사용되는 주석 라이브러리 덕분에 **C#**을 사용하여 PDF에 취소선 주석을 쉽게 삽입할 수 있습니다. 이를 달성하기 위해 따라야 할 필수 단계를 나열했습니다.

C#을 사용하여 PDF에 취소선 주석을 추가하는 단계

  1. NuGet 패키지 관리자를 활용하여 GroupDocs.Annotation for .NET 설치
  2. GroupDocs.Annotation의 네임스페이스 참조를 프로젝트에 포함합니다.
  3. 생성자에 PDF 파일의 경로를 제공하여 Annotator 클래스의 개체를 인스턴스화합니다.
  4. StrikeoutAnnotation 클래스의 새 인스턴스를 만들고 페이지 번호 및 배경색과 같은 속성에 값을 할당합니다.
  5. StrikeoutAnnotation 개체를 매개 변수로 전달하여 Annotator 클래스의 Add 메서드를 호출합니다.
  6. Annotator 클래스의 Save 메서드를 활용하여 결과 PDF를 디스크에 저장합니다.

이 지침은 컴퓨터에 주석 라이브러리를 설치하는 과정을 보여줍니다. 이를 통해 *C#*에서 PDF에 취소선 주석을 만들 수 있습니다. 취소선 주석을 PDF 파일에 삽입하기 위해 추가 소프트웨어가 필요하지 않습니다. 이러한 지침은 Windows, macOS 및 Linux와 같이 일반적으로 사용되는 운영 체제와 호환됩니다. 다음 코드 예제는 PDF에 취소선 주석을 추가하는 방법을 보여줍니다.

C#을 사용하여 PDF에 취소선 주석을 추가하는 코드

using GroupDocs.Annotation;
using GroupDocs.Annotation.Models;
using GroupDocs.Annotation.Models.AnnotationModels;
using System.Collections.Generic;
using System;
namespace AddStrikeoutAnnotationtoPDFUsingCSharp
{
internal class Program
{
static void Main(string[] args)
{
// Set License to avoid the limitations of Annotation library
License lic = new License();
lic.SetLicense(@"GroupDocs.Annotation.lic");
// Instantiate Annotator object by passing path of PDF
// file to its constructor
using (Annotator annotator = new Annotator("input.pdf"))
{
// Create an instance of StrikeoutAnnotation class
// and set some properties
StrikeoutAnnotation strikeout = new StrikeoutAnnotation
{
CreatedOn = DateTime.Now,
FontColor = 65535,
BackgroundColor = 16761035,
Message = "This is strikeout annotation",
Opacity = 0.7,
PageNumber = 0,
Points = new List<Point>
{
new Point(80, 730), new Point(240, 730),
new Point(80, 650), new Point(240, 650)
},
Replies = new List<Reply>
{
new Reply
{
Comment = "First comment",
RepliedOn = DateTime.Now
},
new Reply
{
Comment = "Second comment",
RepliedOn = DateTime.Now
}
}
};
// Add strikeout annotation to Annotator
annotator.Add(strikeout);
// Save the final PDF to disk
annotator.Save("result.pdf");
}
}
}
}

이전 섹션에서는 PDF에서 *C# 취소선 주석에 대해 자세히 설명했습니다. 몇 번의 API 호출만 필요한 기본 코드 예제도 제공했습니다. 주석 라이브러리를 설치하고 입력 및 출력 파일 경로를 업데이트하면 코드를 애플리케이션에 쉽게 통합할 수 있습니다. 축하합니다. C#을 사용하여 PDF 파일에 취소선 주석을 성공적으로 추가했습니다.

이전에 PDF 파일에 밑줄 주석을 추가하는 주제를 다루었습니다. 이 주제에 대한 자세한 내용은 C#을 사용하여 PDF에 밑줄 주석을 추가하는 방법에 대한 가이드를 참조하세요.

 한국인