Fill rect in jspdf 1

Fill rect in jspdf

var doc = new jsPDF();
doc.setDrawColor(0);
doc.setFillColor(255, 0, 0);
doc.rect(40, 50, 30, 12, 'FD'); //Fill and Border
doc.setFontSize(8);
doc.setFontType('normal');
doc.text('hello', 42, 51);

Here is what the above code is Doing:
1. Create a new document
2. Set the draw color to black
3. Set the fill color to red
4. Draw a rectangle with a fill and border
5. Set the font size to 8
6. Set the font type to normal
7. Write the word “hello” inside the rectangle

Similar Posts