I tried to put a text from a JSON together in JSPDF with a "Lable" which is supposed to be BOLD and a comment which should be written normally.
so something like this:
LABLE:COMENTAR
LABLE2:COMENTAR2
LABLE3:COMENTAR3
I have tried following:
var doc = new jsPDF();
doc.setFont("Helvetica");
doc.setFontSize(25);
var comDim= doc.getTextDimensions(coment.coment);
var labledim = doc.getTextDimensions(coment.lable);
doc.setFontStyle('bold');
doc.text(21, currentDistance, '- '+coment.lable+':');
doc.setFontStyle('normal');
doc.text(labledim.w, currentDistance, coment.coment);
doc.save('Storecheck.pdf');
which brings me the following result:
But the gaps between the label and the comment are too big and unfortunately, the text is not wrapped. Which is really bad because I can't say how long the text is.
I would be very grateful for a hint or approach, maybe there is an example somewhere.