ArrayPointCollection Class
A collection of point arrays that specify ink annotation paths.
Declaration
public class ArrayPointCollection extends TrackedObjectCollection<PointF[]>
Remarks
Call the InkAnnotation.setInks(value) method to specify ink annotation paths. Each collection item is a PointF array that specifies a single path.
The collection implements the java.util.List interface and does not accept null items. If you add or insert a null item or replace an item with null, the API throws an ArgumentNullException. If you pass an index outside the collection bounds, the API throws an ArgumentOutOfRangeException.
Refer to the following help topic for additional information: Drawing Annotations.
Example
Add a Freehand Drawing to a Page
The following code snippet adds a freehand drawing to the first page:

package pdf;
import com.devexpress.docs.pdf.*;
import com.devexpress.system.drawing.*;
import java.nio.channels.*;
import java.nio.file.*;
import java.util.List;
public class Main {
public static void main(String[] args) throws Exception {
try (FileChannel fileChannel = FileChannel.open(Path.of("Document.pdf"));
PdfDocument pdfDocument = new PdfDocument(fileChannel)) {
Page page = pdfDocument.getPages().getFirst();
createInkAnnotation(page);
try (WritableByteChannel channel =
FileChannel.open(Path.of("Result.pdf"),
StandardOpenOption.CREATE,
StandardOpenOption.WRITE,
StandardOpenOption.TRUNCATE_EXISTING)) {
pdfDocument.save(channel);
}
}
}
static void createInkAnnotation(Page page) {
List<PointF[]> inks = List.of(
new PointF[] { new PointF(100, 300),
new PointF(120, 290),
new PointF(150, 305),
new PointF(180, 295)
},
new PointF[] {
new PointF(210, 320),
new PointF(240, 340),
new PointF(270, 330)
}
);
InkAnnotation annotation = new InkAnnotation(new RectangleF(80, 780, 260, 120));
annotation.setInks(new ArrayPointCollection(inks));
annotation.setTitle("Reviewer");
annotation.setContent("Handwritten note.");
annotation.setColor(PdfColor.getBlue());
page.getAnnotations().add(annotation);
}
}
Inherited Members
Inheritance
Constructors
ArrayPointCollection() Constructor
Initializes a new instance of the ArrayPointCollection class.
Declaration
public ArrayPointCollection()
ArrayPointCollection(Iterable<PointF[]> points) Constructor
Initializes a new instance of the ArrayPointCollection class with the specified point arrays.
Declaration
public ArrayPointCollection(Iterable<PointF[]> points)
Parameters
| Name | Type | Description |
|---|---|---|
| points | java.lang.Iterable<com.devexpress.system.drawing.PointF[]> | Point arrays to add to the collection. |
Exceptions
| Type | Description |
|---|---|
| ArgumentNullException | Thrown if the |
Methods
getSource() Method
Returns the internal collection that stores collection items.
Declaration
public ArrayPointCollection getSource()
Returns
| Type | Description |
|---|---|
| com.devexpress.docs.pdf.internal.ArrayPointCollection | The internal collection. |
Remarks
The getSource() method supports the internal infrastructure of the PDF Document API. Do not call the getSource() method in your code.
objectClone() Method
Returns a copy of the collection.
Declaration
public ArrayPointCollection objectClone()
Returns
| Type | Description |
|---|---|
ArrayPointCollection |
A new collection that contains the same point arrays. |
Remarks
The objectClone method does not copy point arrays. The copy and the source collection contain the same PointF array instances.