namespace UglyToad.PdfPig.Annotations
{
using System;
using System.Collections.Generic;
using Core;
using Tokens;
using Util.JetBrains.Annotations;
///
/// An annotation on a page in a PDF document.
///
public class Annotation
{
///
/// The underlying PDF dictionary which this annotation was created from.
///
[NotNull]
public DictionaryToken AnnotationDictionary { get; }
///
/// The type of this annotation.
///
public AnnotationType Type { get; }
///
/// The rectangle in user space units specifying the location to place this annotation on the page.
///
public PdfRectangle Rectangle { get; }
///
/// The annotation text, or if the annotation does not display text, a description of the annotation's contents. Optional.
///
[CanBeNull]
public string Content { get; }
///
/// The name of this annotation which should be unique per page. Optional.
///
[CanBeNull]
public string Name { get; }
///
/// The date and time the annotation was last modified, can be in any format. Optional.
///
[CanBeNull]
public string ModifiedDate { get; }
///
/// Flags defining the appearance and behaviour of this annotation.
///
public AnnotationFlags Flags { get; }
///
/// Defines the annotation's border.
///
public AnnotationBorder Border { get; }
///
/// Rectangles defined using QuadPoints, for these are the regions used to activate the link,
/// for text markup annotations these are the text regions to apply the markup to.
/// See for more information regarding the order of the points.
///
public IReadOnlyList QuadPoints { get; }
///
/// Create a new .
///
public Annotation(DictionaryToken annotationDictionary, AnnotationType type, PdfRectangle rectangle, string content, string name, string modifiedDate,
AnnotationFlags flags, AnnotationBorder border, IReadOnlyList quadPoints)
{
AnnotationDictionary = annotationDictionary ?? throw new ArgumentNullException(nameof(annotationDictionary));
Type = type;
Rectangle = rectangle;
Content = content;
Name = name;
ModifiedDate = modifiedDate;
Flags = flags;
Border = border;
QuadPoints = quadPoints ?? EmptyArray.Instance;
}
///
public override string ToString()
{
return $"{Type} - {Content}";
}
}
}