summaryrefslogtreecommitdiff
path: root/fpdf.go
diff options
context:
space:
mode:
Diffstat (limited to 'fpdf.go')
-rw-r--r--fpdf.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/fpdf.go b/fpdf.go
index e192c51..493e98e 100644
--- a/fpdf.go
+++ b/fpdf.go
@@ -1040,10 +1040,16 @@ func (f *Fpdf) CellFormat(w, h float64, txtStr string, borderStr string, ln int,
// A simpler version of CellFormat with no fill, border, links or special
// alignment.
func (f *Fpdf) Cell(w, h float64, txtStr string) {
- // dbg("Cell. h is %.2f", h)
f.CellFormat(w, h, txtStr, "", 0, "L", false, 0, "")
}
+// A simpler printf-style version of CellFormat with no fill, border, links or
+// special alignment. See documentation for the fmt package for details on
+// fmtStr and args.
+func (f *Fpdf) Cellf(w, h float64, fmtStr string, args ...interface{}) {
+ f.CellFormat(w, h, sprintf(fmtStr, args...), "", 0, "L", false, 0, "")
+}
+
// This method allows printing text with line breaks. They can be automatic (as
// soon as the text reaches the right border of the cell) or explicit (via the
// \n character). As many cells as necessary are output, one below the other.
@@ -1263,6 +1269,12 @@ func (f *Fpdf) Write(h float64, txtStr string) {
f.write(h, txtStr, 0, "")
}
+// Like Write but uses printf-style formatting. See the documentation for
+// pckage fmt for mor details on fmtStr and args.
+func (f *Fpdf) Writef(h float64, fmtStr string, args ...interface{}) {
+ f.write(h, sprintf(fmtStr, args...), 0, "")
+}
+
// Write text that when clicked launches an external URL. See Write() for
// argument details.
func (f *Fpdf) WriteLinkString(h float64, displayStr, targetStr string) {