CPDFAnnotation Class Reference
Inherits from | NSObject |
---|---|
Declared in | CPDFAnnotation.h |
Overview
An annotation in a PDF document.
In addition to its primary textual content, a PDF file can contain annotations that represent links, form elements, highlighting circles, textual notes, and so on. Each annotation is associated with a specific location on a page and may offer interactivity with the user.
This is the base class for all annotations. A CPDFAnnotation object by itself is not useful, only subclasses (like CPDFCircleAnnotation, CPDFTextAnnotation) are interesting. In parsing a PDF however, any unknown or unsupported annotations will be represented as this base class.
– initWithDocument:
Initializes a PDF annotation object.
- (instancetype)initWithDocument:(CPDFDocument *)document
Discussion
Initializes a PDF annotation object.
Subclasses of CPDFAnnotation should use this method to initialize annotation instances. Invoking initWithDocument: directly on a CPDFAnnotation object creates an illegal NULL type.
Declared In
CPDFAnnotation.h
page
Returns the page that the annotation is associated with (may return nil if annotation not associated with a page).
@property (nonatomic, readonly) CPDFPage *page
Discussion
Returns the page that the annotation is associated with (may return nil if annotation not associated with a page).
The addAnnotation: method in the CPDFPage class lets you associate an annotation with a page.
Declared In
CPDFAnnotation.h
type
Returns the type of the annotation. Examples include: “Text”, “Link”, “Line”, etc.
@property (nonatomic, readonly) NSString *type
Discussion
Returns the type of the annotation. Examples include: “Text”, “Link”, “Line”, etc.
The type of the annotation. Types include Line, Link, Text, and so on, referring to the CPDFAnnotation subclasses. In the Adobe PDF Specification, this attribute is called Subtype, and the common “type” for all annotations in the PDF Specification is Annot.
Declared In
CPDFAnnotation.h
bounds
Method to get / set the bounding box for the annotation in page space. Required for all annotations.
@property (nonatomic, assign) CGRect bounds
Discussion
Method to get / set the bounding box for the annotation in page space. Required for all annotations.
Page space is coordinate system with the origin at the lower-left corner of the current page.
Declared In
CPDFAnnotation.h
contents
Method to get / set the textual content (if any) associated with the annotation.
@property (nonatomic, retain) NSString *contents
Discussion
Method to get / set the textual content (if any) associated with the annotation.
Textual content is typically associated with CPDFTextAnnotation and CPDFFreeTextAnnotation annotations.
Declared In
CPDFAnnotation.h
borderWidth
Method to get / set the stroke thickness for the annotation.
@property (nonatomic, assign) CGFloat borderWidth
Discussion
Method to get / set the stroke thickness for the annotation.
For the “geometry” annotations (Circle, Ink, Line, Square), the stroke thickness indicates the line width. CPDFAnnotation markup types (Highlight, Strikethrough, Underline) ignores the stroke thickness.
Declared In
CPDFAnnotation.h
border
Optional border or border style that describes how to draw the annotation border (if any).
@property (nonatomic, retain) CPDFBorder *border
Discussion
Optional border or border style that describes how to draw the annotation border (if any).
For the “geometry” annotations (Circle, Ink, Line, Square), the border indicates the line width and whether to draw with a dash pattern or solid pattern. CPDFAnnotation markup types (Highlight, Strikethrough, Underline) ignores the border.
Declared In
CPDFAnnotation.h
opacity
Method to get / set the opacity for the annotation.
@property (nonatomic, assign) CGFloat opacity
Discussion
Method to get / set the opacity for the annotation.
Declared In
CPDFAnnotation.h
color
Method to get / set the color for the annotation.
@property (nonatomic, retain) CPDFKitPlatformColor *color
Discussion
Method to get / set the color for the annotation.
For many annotations (“Circle”, “Square”) the stroke color. Used for other annotations as well.
Declared In
CPDFAnnotation.h
– modificationDate
Returns the modification date of the annotation.
- (NSDate *)modificationDate
Discussion
Returns the modification date of the annotation.
Declared In
CPDFAnnotation.h
– userName
Returns the name of the user who created the annotation.
- (NSString *)userName
Discussion
Returns the name of the user who created the annotation.
Declared In
CPDFAnnotation.h
– flags
Returns the flags of the annotation.
- (CPDFAnnotationFlags)flags
Discussion
Returns the flags of the annotation.
See Also
Declared In
CPDFAnnotation.h
– setFlags:
– updateAppearanceStream
Update appearance stream for the annotation.
- (void)updateAppearanceStream
Discussion
Update appearance stream for the annotation.
ComPDFKit will update the annotation appearance by default when you modify the annotation properties. You can also manually update the appearance by calling the updateAppearanceStream method, but you must call the updateAppearanceStream method manually when you modify the bounds of CPDFTextAnnotation, CPDFStampAnnotation, CPDFSignatureAnnotation annotations.
Declared In
CPDFAnnotation.h
– drawWithBox:inContext:
Draw method. Draws in page-space relative to origin of “box” passed in and to the given context.
- (void)drawWithBox:(CPDFDisplayBox)box inContext:(CGContextRef)context
Discussion
Draw method. Draws in page-space relative to origin of “box” passed in and to the given context.
Declared In
CPDFAnnotation.h