Ann.ColorAlpha := 255;
procedure CreateAnnotation(const Annotation: TPdfAnnotation);
| Annotation | TPdfAnnotation. 만들 주석을 기술하는 레코드. 주요 필드는 Subtype(주석 형식, 예: 하이라이트, 텍스트 메모, 잉크), Rectangle(PDF 사용자 공간 좌표의 경계 사각형), ContentsText(주석 텍스트), HasColor, Color, ColorAlpha입니다. 레코드를 전달하기 전에 관련 필드를 모두 채우세요 |
CreateAnnotation은 TPdfAnnotation 레코드가 제공한 속성으로 현재 페이지에 새 주석을 추가합니다. 주석은 페이지의 주석 배열에 추가되며 Annotation[AnnotationCount - 1]로 즉시 접근할 수 있습니다
TPdfAnnotation 레코드는 주석 형식(Subtype), 페이지상의 위치(Rectangle, 원점이 왼쪽 아래인 PDF 사용자 공간 point), 표시 텍스트나 도구 설명(ContentsText), 표시 색상(HasColor, Color, ColorAlpha)을 담습니다. 이 프로시저를 호출하기 전에 선택한 하위 형식과 관련된 모든 필드를 설정하세요. 설정하지 않은 필드는 기본값으로 남습니다
주석을 만든 뒤 변경 사항을 디스크에 유지하려면 SaveAs를 호출하세요. 주석을 제거하려면 해당 0 기반 인덱스와 함께 DeleteAnnotation을 사용하세요
var
Ann: TPdfAnnotation;
begin
Pdf1.PageNumber := 1;
Ann := Default(TPdfAnnotation);
Ann.Subtype := anHighlight;
Ann.Rectangle.Left := 72.0;
Ann.Rectangle.Bottom := 680.0;
Ann.Rectangle.Right := 300.0;
Ann.Rectangle.Top := 695.0;
Ann.ContentsText := 'Key figure — review before sign-off';
Ann.HasColor := True;
Ann.Color := clYellow;
Ann.ColorAlpha := 255;
Pdf1.CreateAnnotation(Ann);
Pdf1.SaveAs('output_annotated.pdf');
end;