I am writing a text into a pdf like this:
var splitTitle = doc.splitTextToSize(str, 180);
doc.text(15, 15, splitTitle);
This is the output:
What I want to do is to draw a rectangle around the text. The text height can be dynamic depending on the length of the text, so how do I proceed?
Getting the text dimensions by using getTextDimensions()
solved the issue:
doc.rect(15,15,doc.getTextDimensions(splitTitle).w,doc.getTextDimensions(splitTitle).h)