diff --git a/pdfhelper/pdf.go b/pdfhelper/pdf.go index d1e2c2d..66bd4ac 100644 --- a/pdfhelper/pdf.go +++ b/pdfhelper/pdf.go @@ -253,3 +253,15 @@ func (pdf *Helper) InsertPageNumber(x, y float64, format string) { num := fmt.Sprintf(format, pdf.PageNo()) pdf.Column(x, y, []FormatedCell{{10, 1, num, "DejaVuSans", "", 8, NOBORDER, LEFT}}) } + +func (pdf *Helper) WriteSuperscript( + txt, script string, + x, y float64, + fontFamily, fontStyle string, + fontSize float64) { + + scriptOffsetX := x + pdf.TextLength(txt, fontFamily, fontStyle, fontSize) + scriptOffsetY := y - fontSize*0.3 + pdf.Column(x, y, []FormatedCell{{5.0, 5.0, txt, fontFamily, fontStyle, 6, NOBORDER, LEFT}}) + pdf.Column(scripttxtOffset, scriptOffsetY, []FormatedCell{{5.0, 5.0, script, fontFamily, fontStyle, 6, NOBORDER, LEFT}}) +}