Am working on a pdf report i want to make. am tring to use the font roboto from google.
Downloaded the Roboto font with all the rrf files. here is what am doing to get the font
//Set font**
gofpdf.MakeFont(“font/Roboto/Roboto-Regular.ttf”, “font/cp1252.map”, “font”, nil, true)
pdf.SetFontLocation(“font”)
pdf.AddFont(“Roboto”, “B”, “Roboto-Regular.json”)
//Create header for pages to page*************
pdf.SetHeaderFunc(func() {
//Add Logo******
pdf.Image(“IFM-Site-Logo.png”, 154, 40, 30, 0, false, “”, 0, “”)
//Add Address Field***
pdf.SetY(25)
pdf.SetX(5)
pdf.SetFont(“Times”, “”, 16)
lines := pdf.SplitLines([]byte(Address()), 85)
for _, line := range lines {
pdf.CellFormat(180.0, 5, string(line), "", 2, "L", false, 0, "")
}
now as it is my code will run but the second i do pdf.SetFont(“Roboto”,"", 10) it brakes throws and error indext out of bount for the next line.
Am not sure why this is happening any advice?