PDFium Component Docs

CreateAnnotation Yöntem

Bu API girdisi tanımlayıcıları, imzaları, kod bloklarını ve PDF terimlerini özgün biçiminde korur.
Bileşen: TPdf  ·  Birim: PDFium
Create a new annotation.

Söz dizimi

procedure CreateAnnotation(const Annotation: TPdfAnnotation);

AnnotationTPdfAnnotation. A record describing the annotation to create. Key fields include SubType (annotation type, e.g. highlight, text note, ink), Rect (bounding rectangle in PDF user-space coordinates), İçindekiler (the annotation text), and Color (the annotation colour). Fill all relevant fields before passing the record.

Açıklama

CreateAnnotation sağlanan özellikleri kullanarak geçerli sayfaya yeni bir ek açıklama ekler TPdfAnnotation record. The annotation is appended to the page's annotation array and becomes immediately accessible via Annotation[AnnotationCount - 1].

The TPdfAnnotation record captures the annotation type (SubType), its position on the page (Rect, PDF kullanıcı alanı noktalarıyla ve orijini sol altta olacak şekilde), görünür metin ya da ipucu (İçindekiler), and the display colour (Color). Seçilen alt türe ilişkin olan her alanı bu yordamı çağırmadan önce ayarlayın; ayarlanmayan alanlar sıfır değerlerinde bırakılır

After creating annotations, call SaveAs değişiklikleri diske kalıcı olarak yazmak için. Bir ek açıklamayı kaldırmak için şunu kullanın DeleteAnnotation with the appropriate 0-based index.

Örnek

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;

Ayrıca bkz.

Annotation, AnnotationCount, DeleteAnnotation