From d0f2d2e94a89ab84c0c647ebb0873f43593d89fd Mon Sep 17 00:00:00 2001 From: Stanislav Seletskiy Date: Thu, 18 Jul 2019 15:41:13 +0300 Subject: fix bug introduced in #279 --- fpdf.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fpdf.go b/fpdf.go index b3d0b0e..f46680b 100644 --- a/fpdf.go +++ b/fpdf.go @@ -2819,7 +2819,6 @@ 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)) @@ -2830,9 +2829,10 @@ func (f *Fpdf) WriteAligned(width, lineHeight float64, textStr, alignStr string) f.Write(lineHeight, lineStr) f.SetLeftMargin(lMargin) default: + f.SetRightMargin(pageWidth - lMargin - width) f.Write(lineHeight, lineStr) + f.SetRightMargin(rMargin) } - f.SetRightMargin(rMargin) } } -- cgit v1.2.1-24-ge1ad From 20e5ed95b595d65457b8b33d68afdbdd99aa31f9 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 20 Jul 2019 09:41:38 -0400 Subject: Correct placement of pageWidth variable --- fpdf.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fpdf.go b/fpdf.go index a676331..f46680b 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) } -- cgit v1.2.1-24-ge1ad