How to write a text on a line in node.js pdf kit?

Viewed 7464

I am using pdfkit node module to generate a pdf. My problem is that I want to insert a text on a dashed line. This is what I am doing:

doc.moveDown(2)
        .moveTo(x+leftMargin, doc.y)
        .lineTo(doc.x, doc.y)
        .lineWidth(0.5)
        .dash(3,{space:3})
        .fillAndStroke(defBlackColor)
        .fill(defBlackColor)
        .fontSize(defFontSize)
    .text('Layover:'+' '+ obj.layover,x + leftMargin + xincr/2,doc.y);

But it returns text just below the dashed line, like this:enter image description here

And I want to get:enter image description here

How can I achieve it?

1 Answers
Related