Click or drag to resize
Pdftools logo

RectangleAnnotationCreate Method

Create a rectangle annotation.

The returned rectangle annotation is not yet part of any page. It can be added to a page's list of annotations.

Namespace: PdfTools.Toolbox.Pdf.Annotations
Assembly: PdfTools.Toolbox (in PdfTools.Toolbox.dll) Version: 1.1.0+5820e9ca9ca173983539ffc40abc227fb62e6928
Syntax
C#
public static RectangleAnnotation Create(
	Document targetDocument,
	Rectangle boundingBox,
	Stroke stroke,
	Paint fill
)

Parameters

targetDocument  Document
The output document with which the returned object is associated.
boundingBox  Rectangle
The location on the page.
stroke  Stroke
The stroking parameters used for stroking the rectangle. The stroking paint is used as the annotation's main paint. If then the rectangle is not stroked.
fill  Paint
The paint used for filling the rectangle. If then the rectangle is not filled.

Return Value

RectangleAnnotation
The newly created rectangle annotation.
Exceptions
ExceptionCondition
ArgumentExceptionif the targetDocument is
ArgumentExceptionif the targetDocument is read-only
ArgumentExceptionif the stroke and fill arguments are both
ArgumentExceptionif the stroke argument is not associated with the targetDocument
ArgumentExceptionif the stroke's Paint has a ColorSpace other than a device color space
ArgumentExceptionif the stroke's Paint has a non-Transparency with BlendMode other than Normal
ArgumentExceptionif the stroke argument's LineCapStyle is other than Butt
ArgumentExceptionif the stroke argument's LineJoinStyle is other than Miter
ArgumentExceptionif the stroke argument's MiterLimit is other than 10
ArgumentExceptionif the stroke argument's DashPhase is other than 0
ArgumentExceptionif the fill has a ColorSpace other than a device color space
ArgumentExceptionif the fill has a non-Transparency with BlendMode other than Normal
ArgumentExceptionif the fill argument is not associated with the targetDocument
ArgumentNullExceptionif targetDocument is .
See Also