/ PDF / PdfLineCap
Search results

PdfLineCap API in JavaScript PDF API control

Public enum to define the line cap.

// 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;
// Set the line cap
pen._lineCap = PdfLineCap.round;
// Draw a rectangle using pen
graphics.drawRectangle(150, 50, 50, 50, pen);
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
  • flat - Specifies the type of flat.
  • round - Specifies the type of round.
  • square - Specifies the type of square.