最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Bullet points in jspdf - Stack Overflow

programmeradmin3浏览0评论

I'm trying to build a pdf page using jspdf, manually not from the html, I'm not able to get bullet points in the pdf page, I need the bullet before the text rendered like this doc.text('/bulletpoint/'+data,60,60); I've tried "u2022" for the bullet it doesn't work.

I'm trying to build a pdf page using jspdf, manually not from the html, I'm not able to get bullet points in the pdf page, I need the bullet before the text rendered like this doc.text('/bulletpoint/'+data,60,60); I've tried "u2022" for the bullet it doesn't work.

Share Improve this question asked May 29, 2020 at 11:57 rbcrbc 511 silver badge5 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 5

Try this:

doc.text('\u2022 ' + your text here);

jsPDF has native inbuilt PDF symbol and Zapfdingbats font so you simply use either the octal \154 or say for Star of David style just use literal A see https://stackoverflow./a/72802213/10802527

Or simpler use mid height "bullet" from symbol's but may need to use a slightly larger font size

    doc.setFontSize(14);
    doc.text('My test page', 0.5, 0.5);

    doc.setFont("Zapfdingbats");
    doc.setFontStyle("normal");
    doc.text("\154 abcdefghijkl", 1, 1);

    doc.setFont("Symbol");
    doc.setFontSize(20);
    doc.text('·', 0.3, 0.5);

Just use an oversized dot. that worked for me perfectly.

发布评论

评论列表(0)

  1. 暂无评论