/ PDF / PdfDashStyle
Search results

PdfDashStyle API in JavaScript PDF API control

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([0, 0, 0], 1);
// Set the dash style
pen._dashStyle = PdfDashStyle.dashDot;
// Draw a rectangle using pen
graphics.drawRectangle(150, 50, 50, 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.