Hi,
I'm using the go-pdf library to make PDF files, and I want to know if it can make lists like bullet points or numbered lists in a simple way. Currently, I'm using this code:
packagemainimport("github.com/go-pdf/fpdf""log")funcmain(){pdf:=fpdf.New("P","mm","A4","")pdf.AddPage()pdf.SetFont("Arial","B",12)for_,i:=range[]string{"1","2","3"}{pdf.MultiCell(0,10,"- "+i,"","L",false)}err:=pdf.OutputFileAndClose("list.pdf")iferr!=nil{log.Fatal(err)}}
It generates a PDF that looks like this:
- 1
- 2
- 3
Is there an easier way to create lists in go-pdf? Since it's inspired by PHP fpdf, I referred to the official PHP example at http://www.fpdf.org/en/script/script56.php for list formatting. I aim to achieve a similar result where lists look standard, with proper spacing between items and aligned lines when they break.
Am I missing any information in go-pdf's documentation regarding list creation? Is there a specific function for this purpose?
Thanks.
Hi,
I'm using the go-pdf library to make PDF files, and I want to know if it can make lists like bullet points or numbered lists in a simple way. Currently, I'm using this code:
```go
package main
import (
"github.com/go-pdf/fpdf"
"log"
)
func main() {
pdf := fpdf.New("P", "mm", "A4", "")
pdf.AddPage()
pdf.SetFont("Arial", "B", 12)
for _, i := range []string{"1","2","3"} {
pdf.MultiCell(0, 10, "- "+i, "", "L", false)
}
err := pdf.OutputFileAndClose("list.pdf")
if err != nil {
log.Fatal(err)
}
}
```
It generates a PDF that looks like this:
```
- 1
- 2
- 3
```
Is there an easier way to create lists in go-pdf? Since it's inspired by PHP fpdf, I referred to the official PHP example at http://www.fpdf.org/en/script/script56.php for list formatting. I aim to achieve a similar result where lists look standard, with proper spacing between items and aligned lines when they break.
Am I missing any information in go-pdf's documentation regarding list creation? Is there a specific function for this purpose?
Thanks.