jsPDF setLineWidth not working as expected

1.7k views Asked by At

All,

I have created a jsPDF function that contains of several lines between the text. For some unknown reason the first line of the document is not the width that I set it to. Although I set the command for it:

doc.setLineWidth(0,5);

Is there a reason why the command doesn't work on the first line but does on all the next lines?

doc.setLineWidth(0,5);
doc.line(20, varHeight += 5, 200, varHeight) // horizontal line

Second problem I have is the placement of the lines. I have some blocks of text which are separated by a dividing line. I want to check if we are at the bottom of the page every time I draw a line. If we are at the bottom we don't need the line.

var pageHeight = doc.internal.pageSize.height;
function draw_the_line(h,j){
if (h <= pageHeight - 150)
   {
    doc.line(20, j, 200, j);
   } 
};

The code doesn't work. The line will be drawn even at the end of the page.

Tnx in advance.

Marco

0

There are 0 answers