Class FreeText
- java.lang.Object
-
- com.pdf_tools.fourheights.pdftoolbox.internal.NativeBase
-
- com.pdf_tools.fourheights.pdftoolbox.internal.NativeObject
-
- com.pdf_tools.fourheights.pdftoolbox.pdf.annotations.Annotation
-
- com.pdf_tools.fourheights.pdftoolbox.pdf.annotations.MarkupAnnotation
-
- com.pdf_tools.fourheights.pdftoolbox.pdf.annotations.FreeText
-
public class FreeText extends MarkupAnnotation
An annotation that displays text
For a free-text annotation, the annotation's content is used as text to be displayed as the annotation's visual manifestation on the page.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FreeText
create(Document targetDocument, Rectangle boundingBox, java.lang.String content, Paint paint)
Create a free-text annotation.static FreeText
create(Document targetDocument, Rectangle boundingBox, java.lang.String content, Paint paint, Stroke stroke)
Create a free-text annotation.HorizontalAlignment
getAlignment()
The text alignment (Getter)double
getFontSize()
The font size (Getter)Paint
getPaint()
The paint for the text background and the popup (Getter)void
setFontSize(double value)
The font size (Setter)-
Methods inherited from class com.pdf_tools.fourheights.pdftoolbox.pdf.annotations.MarkupAnnotation
getInfo, getLocked, getReplies
-
Methods inherited from class com.pdf_tools.fourheights.pdftoolbox.pdf.annotations.Annotation
copy, getBoundingBox, getHidden, getId, getNoPrint, getNoRotate, getNoZoom
-
Methods inherited from class com.pdf_tools.fourheights.pdftoolbox.internal.NativeObject
equals, hashCode
-
-
-
-
Method Detail
-
create
public static FreeText create(Document targetDocument, Rectangle boundingBox, java.lang.String content, Paint paint)
Create a free-text annotation.
The returned free-text annotation is not yet part of any page. It can be added to a page's list of annotations.- Parameters:
targetDocument
- The output document with which the returned object is associated.boundingBox
- The location on the page.content
- The text content.paint
- This paint used for the background of the free text annotation. Ifnull
, the background is transparent.- Returns:
- The newly created free text annotation.
- Throws:
java.lang.IllegalArgumentException
- if thetargetDocument
has already been closedjava.lang.IllegalArgumentException
- if thetargetDocument
is read-onlyjava.lang.IllegalArgumentException
- if thepaint
has apdftoolbox.pdf.content.Paint.getColorSpace
other than a device color spacejava.lang.IllegalArgumentException
- if thepaint
has a non-null
pdftoolbox.pdf.content.Paint.getTransparency
withpdftoolbox.pdf.content.Transparency.getBlendMode
other thanpdftoolbox.pdf.content.BlendMode.NORMAL
java.lang.IllegalArgumentException
- if thepaint
argument is not associated with thetargetDocument
java.lang.IllegalArgumentException
- if thestroke
'spdftoolbox.pdf.content.Stroke.getPaint
has apdftoolbox.pdf.content.Paint.getColorSpace
other than a device color spacejava.lang.IllegalArgumentException
- if thestroke
'spdftoolbox.pdf.content.Stroke.getPaint
has a non-null
pdftoolbox.pdf.content.Paint.getTransparency
withpdftoolbox.pdf.content.Transparency.getBlendMode
other thanpdftoolbox.pdf.content.BlendMode.NORMAL
java.lang.IllegalArgumentException
- if thestroke
'spdftoolbox.pdf.content.Stroke.getLineCapStyle
is other thanpdftoolbox.pdf.content.LineCapStyle.BUTT
java.lang.IllegalArgumentException
- if thestroke
'spdftoolbox.pdf.content.Stroke.getLineJoinStyle
is other thanpdftoolbox.pdf.content.LineJoinStyle.MITER
java.lang.IllegalArgumentException
- if thestroke
'spdftoolbox.pdf.content.Stroke.getMiterLimit
is other than 10java.lang.IllegalArgumentException
- if thestroke
'spdftoolbox.pdf.content.Stroke.getDashPhase
is other than 0java.lang.IllegalArgumentException
- iftargetDocument
isnull
java.lang.IllegalArgumentException
- ifboundingBox
isnull
-
create
public static FreeText create(Document targetDocument, Rectangle boundingBox, java.lang.String content, Paint paint, Stroke stroke)
Create a free-text annotation.
The returned free-text annotation is not yet part of any page. It can be added to a page's list of annotations.- Parameters:
targetDocument
- The output document with which the returned object is associated.boundingBox
- The location on the page.content
- The text content.paint
- This paint used for the background of the free text annotation. Ifnull
, the background is transparent.stroke
- The stroking parameters used for stroking the rectangle. The stroking paint is used as the annotation's main paint.- Returns:
- The newly created free text annotation.
- Throws:
java.lang.IllegalArgumentException
- if thetargetDocument
has already been closedjava.lang.IllegalArgumentException
- if thetargetDocument
is read-onlyjava.lang.IllegalArgumentException
- if thepaint
has apdftoolbox.pdf.content.Paint.getColorSpace
other than a device color spacejava.lang.IllegalArgumentException
- if thepaint
has a non-null
pdftoolbox.pdf.content.Paint.getTransparency
withpdftoolbox.pdf.content.Transparency.getBlendMode
other thanpdftoolbox.pdf.content.BlendMode.NORMAL
java.lang.IllegalArgumentException
- if thepaint
argument is not associated with thetargetDocument
java.lang.IllegalArgumentException
- if thestroke
'spdftoolbox.pdf.content.Stroke.getPaint
has apdftoolbox.pdf.content.Paint.getColorSpace
other than a device color spacejava.lang.IllegalArgumentException
- if thestroke
'spdftoolbox.pdf.content.Stroke.getPaint
has a non-null
pdftoolbox.pdf.content.Paint.getTransparency
withpdftoolbox.pdf.content.Transparency.getBlendMode
other thanpdftoolbox.pdf.content.BlendMode.NORMAL
java.lang.IllegalArgumentException
- if thestroke
'spdftoolbox.pdf.content.Stroke.getLineCapStyle
is other thanpdftoolbox.pdf.content.LineCapStyle.BUTT
java.lang.IllegalArgumentException
- if thestroke
'spdftoolbox.pdf.content.Stroke.getLineJoinStyle
is other thanpdftoolbox.pdf.content.LineJoinStyle.MITER
java.lang.IllegalArgumentException
- if thestroke
'spdftoolbox.pdf.content.Stroke.getMiterLimit
is other than 10java.lang.IllegalArgumentException
- if thestroke
'spdftoolbox.pdf.content.Stroke.getDashPhase
is other than 0java.lang.IllegalArgumentException
- iftargetDocument
isnull
java.lang.IllegalArgumentException
- ifboundingBox
isnull
-
getFontSize
public double getFontSize()
The font size (Getter)
Default value: 12.
Note: the font size has no effect when rich text is used
- Throws:
java.lang.IllegalStateException
- if the object has already been closed
-
setFontSize
public void setFontSize(double value)
The font size (Setter)
Default value: 12.
Note: the font size has no effect when rich text is used
- Throws:
java.lang.IllegalStateException
- if the object has already been closedjava.lang.UnsupportedOperationException
- if the document is read-onlyjava.lang.IllegalArgumentException
- if the given value is smaller than 0.0
-
getAlignment
public HorizontalAlignment getAlignment()
The text alignment (Getter)
- Throws:
java.lang.IllegalStateException
- if the object has already been closed
-
getPaint
public Paint getPaint() throws CorruptException
The paint for the text background and the popup (Getter)
- Throws:
java.lang.IllegalStateException
- if the object has already been closedCorruptException
- if the PDF is corrupt and the annotation's paint cannot be read
-
-