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