Pdf Component - PdfShapeType

18 Nov 20261 minute to read

Specifies the supported shape types.

// Create a new PDF document
let document: PdfDocument = new PdfDocument();
// Add a page
let page: PdfPage = document.addPage();
// Create a shape element
let element: PdfShapeElement = { shape: { type: PdfShapeType.Rectangle, bounds: { x: 20, y: 20, width: 200, height: 1000 } },
                                 brush: new PdfBrush({ r: 255, g: 0, b: 0 }),
                                 layoutFormat: { layoutType: PdfLayoutType.paginate, breakType: PdfLayoutBreakType.fitPage } };
// Draw the shape element
page.drawShapeElement(element);
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
  • Arc - Specifies an arc shape.
  • BezierCurve - Specifies a Bezier curve shape.
  • Ellipse - Specifies an ellipse shape.
  • Line - Specifies a line shape.
  • Path - Specifies a path shape.
  • Pie - Specifies a pie shape.
  • Polygon - Specifies a polygon shape.
  • Rectangle - Specifies a rectangle shape.
  • RoundedRectangle - Specifies a rounded rectangle shape.