jsPDF icon indicating copy to clipboard operation
jsPDF copied to clipboard

Tabulator character (\t) not printing with Roboto font

Open Brank opened this issue 2 years ago • 1 comments

Hi, I have a solution using jsPDF where I generate a document dynamically based on user inputs. I have encounter that if the text to print contains the character \t everything that go after doesn't print in the PDF document.

Currently the PDF is using the font Roboto, in my tests I have found that without adding the Roboto font and use Helveltica for instance it prints ok by putting space between the words that contains \t between them, which I want but with the Roboto font.

I have tried as well to re-load a newer version from Google fonts, but not luck.

The following code should reproduce my problem (previously loaded the Roboto font):

var customText = '<p>This\tis\ta\ttest\tusing\ttab</p><p>This is a test using spaces</p>';
doc.setFont('roboto','normal');
doc.text(customText, 1, 10);

Output: image

Expected output (with Roboto font, this one is the one by default): image

Any idea of why is this happening with a custom font?

Thank you so much in advance.

Best regards,

Brank avatar Sep 28 '22 12:09 Brank

Hi @Brank, I am new to this open source environment, so please can you guide me on what do I have to do here I want to help but I don't know how can I help

Dev-Code24 avatar Oct 04 '22 17:10 Dev-Code24

This issue is stale because it has been open 90 days with no activity. It will be closed soon. Please comment/reopen if this issue is still relevant.

github-actions[bot] avatar Jan 03 '23 01:01 github-actions[bot]