From fecb37db6c13d7d8adbc8c2d0d4681e07a28ab78 Mon Sep 17 00:00:00 2001 From: Guillermo Pascual Date: Fri, 2 Dec 2016 13:43:36 +0200 Subject: Issue #53 - Support for alignment tag on basic HTML (#95) * Added tag support to the html basic parser. Also added a test line for the RIGHT alignment on fpdf_test ExampleFpdf_HTMLBasicNew * Updated the reference PDF for HTMLBasicNew --- htmlbasic.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'htmlbasic.go') diff --git a/htmlbasic.go b/htmlbasic.go index ee3be7d..9e4eca4 100644 --- a/htmlbasic.go +++ b/htmlbasic.go @@ -169,7 +169,7 @@ func (html *HTMLBasicType) Write(lineHt float64, htmlStr string) { putLink(hrefStr, el.Str) hrefStr = "" } else { - if alignStr == "C" { + if alignStr == "C" || alignStr == "R" { html.pdf.WriteAligned(0, lineHt, el.Str, alignStr) } else { html.pdf.Write(lineHt, el.Str) @@ -188,6 +188,12 @@ func (html *HTMLBasicType) Write(lineHt float64, htmlStr string) { case "center": html.pdf.Ln(lineHt) alignStr = "C" + case "right": + html.pdf.Ln(lineHt) + alignStr = "R" + case "left": + html.pdf.Ln(lineHt) + alignStr = "L" case "a": hrefStr, ok = el.Attr["href"] if !ok { @@ -205,6 +211,9 @@ func (html *HTMLBasicType) Write(lineHt float64, htmlStr string) { case "center": html.pdf.Ln(lineHt) alignStr = "L" + case "right": + html.pdf.Ln(lineHt) + alignStr = "L" } } } -- cgit v1.2.1-24-ge1ad