PdfDashStyle

16 Dec 20251 minute to read

Public enum to define the dash style.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Access first page
let page: PdfPage = document.getPage(0);
// Gets the graphics of the PDF page
let graphics: PdfGraphics = page.graphics;
// Create a new pen
let pen: PdfPen = new PdfPen({r: 0, g: 0, b: 0}, 1);
// Set the dash style
pen._dashStyle = PdfDashStyle.dashDot;
// Draw a rectangle using pen
graphics.drawRectangle({x: 150, y: 50, width: 50, height: 50}, pen);
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
  • custom - Specifies the type of custom.
  • dash - Specifies the type of dash.
  • dashDot - Specifies the type of dashDot.
  • dashDotDot - Specifies the type of dashDotDot.
  • dot - Specifies the type of dot.
  • solid - Specifies the type of solid.