summaryrefslogtreecommitdiff
path: root/fpdf.go
diff options
context:
space:
mode:
Diffstat (limited to 'fpdf.go')
-rw-r--r--fpdf.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/fpdf.go b/fpdf.go
index 35496c2..b3d0b0e 100644
--- a/fpdf.go
+++ b/fpdf.go
@@ -2800,8 +2800,8 @@ func (f *Fpdf) WriteLinkID(h float64, displayStr string, linkID int) {
func (f *Fpdf) WriteAligned(width, lineHeight float64, textStr, alignStr string) {
lMargin, _, rMargin, _ := f.GetMargins()
+ pageWidth, _ := f.GetPageSize()
if width == 0 {
- pageWidth, _ := f.GetPageSize()
width = pageWidth - (lMargin + rMargin)
}
@@ -2819,6 +2819,7 @@ func (f *Fpdf) WriteAligned(width, lineHeight float64, textStr, alignStr string)
lineStr := string(lineBt)
lineWidth := f.GetStringWidth(lineStr)
+ f.SetLeftMargin(lMargin + (width - lineWidth) - 2.01*f.cMargin)
switch alignStr {
case "C":
f.SetLeftMargin(lMargin + ((width - lineWidth) / 2))
@@ -2831,6 +2832,7 @@ func (f *Fpdf) WriteAligned(width, lineHeight float64, textStr, alignStr string)
default:
f.Write(lineHeight, lineStr)
}
+ f.SetRightMargin(rMargin)
}
}