/ PDF / PathPointType
Search results

PathPointType API in JavaScript PDF API control

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([0, 0, 0], 1);
// Create a new brush
let brush: PdfBrush = new PdfBrush([0, 255, 255]);
// Add path points
let pathPoints: Array<number[]> = [[50, 50], [100, 50], [100, 100], [50, 100], [50, 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.