PathPointType

16 Dec 20251 minute to read

Public Enum to define the types of points and segments in a path.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Access the first page
let page: PdfPage = document.getPage(0);
// Create a new pen
let pen: PdfPen = new PdfPen({r: 0, g: 0, b: 0}, 1);
// Create a new brush
let brush: PdfBrush = new PdfBrush({r: 0, g: 255, b: 255});
// Add path points
let pathPoints: Array<Point> = [{x: 50, y: 50}, {x: 100, y: 50}, {x: 100, y: 100}, {x: 50, y: 100}, {x: 50, y: 50}];
// Add path types
let pathTypes: PathPointType[] = [0, 1, 1, 1, 1];
// Create a new PDF path
let path: PdfPath = new PdfPath(pathPoints, pathTypes);
// Draw the path to the PDF page
page.graphics.drawPath(path, pen, brush);
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
  • bezier - A Bezier curve segment.
  • closePath - Closes the current path.
  • dashMode - Indicates that the segment has dashed line style.
  • line - A straight line segment.
  • pathMarker - Indicates a marker point in the path.
  • pathTypeMask - A mask for extracting the type of a point.
  • start - The starting point of a path.