'How to create text with Bulleted lists using pdfkit in node.js?

I have been working since yesterday to generate the report in Pdf format. I have gone through pdfkit module. And It seems pretty cool to use. My requirement is list the text with bullet point. I have tried like this

     var doc = new PDFDocument();
     doc.pipe(fs.createWriteStream('userReport.pdf'));
     doc.fillColor("#B22222")
     .fontSize(25)
     .text('Users Count', 250,60)
     .moveDown(0.5); 

It is creating the text but I want the text with bullet. How to do this?



Solution 1:[1]

Simply, for listing

 .list()

You may check some samples at

https://github.com/devongovett/pdfkit/tree/master/docs

Solution 2:[2]

// list params: array, x, y, other params
doc.list([1, 2, 3], 50, 50, {
  // this is how automatic line wrapping will work if the width is specified
  width: 100,
  align: 'left',
  listType: 'bullet',
  bulletRadius: 0.01, // use this value to almost hide the dots/bullets
});

This is how it works for me, I hope it helps someone

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Profstyle
Solution 2 artch