Pdfkit: Feature: Bullet Points

Created on 29 Jul 2014  Â·  10Comments  Â·  Source: foliojs/pdfkit

It'd be nice to have a bullet points option, something like doc.bulletPoints([arrayOfInputTexts], bulletType). It's pretty tough to do standard bullet-pointing, where you have your text indented from your bullets. Especially if you're making your arrayOfInputs programatically and don't know the length of the array at the offset. Any suggestions for options or syntax?

Most helpful comment

So would the option look like so:
to indent and bullet and text

doc.list(['the terms of this Authority'],{bulletIndent:20, textIndent:20});

So the text is getting indented but the bullet stay put... That bulletIndent variable doesn't seem to be doing anything?

All 10 comments

Check out the doc.list method. It does just that! Takes an array of items, including support for sub arrays for multilevel lists. I guess it's not documented, oops. Sorry about that! Source code is here.

Wow, thanks! Thanks for the quick reply too.

Sorry for the double-post, but I'm a l'm a little confused by the 'options' option. What would go there? For example, how would I do bulleting by capital or lowercase letters, or roman numerals? Thanks in advanced!

It only supports circle bullets for now. They are drawn here. I'd accept PRs for other types of bullets if you want to implement them.

The options object takes the same options as the text method, documented here.

I have a list, some texts in one of them need to have a link, does it support?

So would the option look like so:
to indent and bullet and text

doc.list(['the terms of this Authority'],{bulletIndent:20, textIndent:20});

So the text is getting indented but the bullet stay put... That bulletIndent variable doesn't seem to be doing anything?

So would the option look like so:
to indent and bullet and text

doc.list(['the terms of this Authority'],{bulletIndent:20, textIndent:20});

So the text is getting indented but the bullet stay put... That bulletIndent variable doesn't seem to be doing anything?

Bit old I know, but for anyone else who comes across this it seems the bulletIndent is for 2nd and subsequent levels in the hierarchy. To indent the first level you just need to include "indent" which is defined on doc.text options.

doc.list(['the terms of this Authority'],{indent: 20, bulletIndent:20, textIndent:20});

It only supports circle bullets for now. They are drawn here. I'd accept PRs for other types of bullets if you want to implement them.

The options object takes the same options as the text method, documented here.

For anyone who comes across this like I did looking to change the bullets of a list to something different, you can do that now with { listType: 'numbered' }. See here - looks like it'll accept 'numbered', 'lettered', and 'bullet'.

Sorry to hijack this thread – Is there any way / parameter to customise the vertical spacing between list items? Thanks!

Sorry to hijack this thread – Is there any way / parameter to customise the vertical spacing between list items? Thanks!

With {paragraphGap: ...}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GuiRitter picture GuiRitter  Â·  3Comments

balsamiqMichele picture balsamiqMichele  Â·  4Comments

alFReD-NSH picture alFReD-NSH  Â·  4Comments

leore picture leore  Â·  3Comments

liubin picture liubin  Â·  4Comments