I am trying to find a way to use bold font for inline highlighting in pdfkit
Unfortunately, I cannot find a way to change the font without forcing line breaks (bad for inline highlighting ...).
I tried something like:
pdf.text('Hello ', LEFT, 200).font(bold).text('World!');
but it will output
Hello
World
I also dug up the source, but could not find any way to prevent this.
Anyone have any ideas or workarounds to solve this problem?
EDIT
All I could think of was an ugly hack looking like this:
pdf.text('Hello ', LEFT, 200).moveUp(1).font(bold).text('World!', {indent: pdf.widthOfString('Hello ')});
which works, but far from flexible and maintainable.
m90
source share