How can I dilate or shrink path elements in PDF?

Q: Can I use the scaling operation of Matrix2D, in order to dilate (or
shrink) path elements my PDF? How do i use this function correctly.

The elements should stay on their primary position. What happens to
holes in a path element? Are the holes getting bigger or smaller?
A: Using PDFNet you can implement path dilation/shrinking however it
is a bit more involved than setting the scaling transformation on a
path element. Essentially you could need to obtain all path points
using GetPathPoints/GetPathTypes() methods [you may want to take a
look at ElementReaderAdv sample project for sample code of how to
extract path points]. Then you would adjust path vertices using a
given scaling factor. Something along these lines:

m_pPoints is vertex array of type POINT
m_numpoints is number of vertices in the vertex array
m_rect is the bounding rectangle for the polygon of type RECT

void MyPath.Resize(double xfactor, double yfactor) {
if(xfactor < 0 || yfactor < 0) return;
if(xfactor < 1) xfactor = 1 - xfactor;
if(yfactor < 1) yfactor = 1 - yfactor;

// Find center of polygon
POINT center;
center.x = (long)(m_rect.left + ((m_rect.right - m_rect.left) /
center.y = (long)( + ((m_rect.bottom - /

for(int i=0; i<m_numpoints; i++) {
  long x, y;
  x = (long)((m_pPoints[i].x - center.x) * xfactor);
  y = (long)((m_pPoints[i].y - center.y) * yfactor);
  if(xfactor > 1) m_pPoints[i].x += x;
  else m_pPoints[i].x -= x;

  if(yfactor > 1) m_pPoints[i].y += y;
  else m_pPoints[i].y -= y;

Finally you would update the path points using element.SetPathPoints()
and write the element using ElementWriter..