Class: InkAnnot

PDFNet. InkAnnot


new InkAnnot()

An ink annotation (PDF 1.3) represents a freehand "scribble" composed of one or more disjoint paths. When opened, it shall display a pop-up window containing the text of the associated note.

Methods


<static> create(doc, pos)

Creates a new Ink annotation in the specified document.

Parameters:
Name Type Description
doc PDFNet.SDFDoc

A document to which the Ink annotation is added.

pos PDFNet.rect

A rectangle specifying the Ink annotation's bounds in default user space units.

Returns:

A promise that resolves to a newly created blank Ink annotation.

Type
PDFNet.InkAnnot

<static> createFromAnnot(ann)

creates an Ink annotation and initializes it using given annotation object.

Parameters:
Name Type Description
ann PDFNet.Annot

Annot object used to initialize the Ink annotation.

Returns:

A promise that resolves to an object of type: "InkAnnot"

Type
PDFNet.InkAnnot

<static> createFromObj(d)

creates an Ink annotation and initializes it using given Cos/SDF object.

Parameters:
Name Type Description
d PDFNet.Obj

The Cos/SDF object to initialze the annotation with.

Returns:

A promise that resolves to an object of type: "InkAnnot"

Type
PDFNet.InkAnnot

erase(pt1, pt2, width)

Erase a rectangle area formed by pt1pt2 with width

Parameters:
Name Type Description
pt1 PDFNet.point

A point object that is one end of the eraser segment

pt2 PDFNet.point

A point object that is the other end of the eraser segment

width number

The half width of the eraser

Returns:

A promise that resolves to whether an ink stroke was erased

Type
boolean

getPathCount()

Returns number of paths in the annotation.

Returns:

A promise that resolves to an integer representing the number of paths in the 'InkList' entry of the annotation dictionary.

Type
number

getPoint(pathindex, pointindex)

Returns the specific point in a given path.

Parameters:
Name Type Description
pathindex number

path index for each the point is returned. Index starts at 0.

pointindex number

index of point in the path. Index starts at 0.

Returns:

A promise that resolves to a Point object for specified path and point index.

Type
PDFNet.point

getPointCount(pathindex)

Returns number of points in a certain stroked path in the InkList.

Parameters:
Name Type Description
pathindex number

path index for each the point count is returned. Index starts at 0.

See:
  • GetPathCount()
Returns:

A promise that resolves to an integer representing the number of points in the stroked path of the Ink list.

Type
number

setPoint(pathindex, pointindex, pt)

sets the specific point in the Ink List, adding it if needed.

Parameters:
Name Type Description
pathindex number

An unsigned integer indicating the index of the path.

pointindex number

An unsigned integer indicating the index of the point within the stroked path indicated by the parameter "pathindex".

pt PDFNet.point

A Point object that is to be assigned.