How to erase vertices from a Polygon annotation?

11 views
Skip to first unread message

Ryan

unread,
May 23, 2017, 4:06:07 PM5/23/17
to PDFTron PDFNet SDK
Question:

How to erase a vertex of a Polygon annot. There is only GetVertex and SetVertex?

Answer:

The vertices are stored under an entry called Vertices, which is an array of numbers, where each vertex is a pair of numbers in order of x,y.

So to erase the nth vertex simply call the following.

Obj vertices = polygon.GetSDFObj().FindObj("Vertices");
if(vertices != null && vertices.IsArray())
{
  vertices
.EraseAt(n*2); // erase x value
  vertices
.EraseAt(n*2); // erase y value
}

This also applies for Polyline annotations.
Reply all
Reply to author
Forward
0 new messages