From fb50cd2c0d1830203721385118938038506a9a3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emir=20Ribi=C4=87?= Date: Sun, 6 Jan 2019 16:50:22 +0100 Subject: [PATCH 1/4] Update invoice_test.go --- pdf/creator/invoice_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pdf/creator/invoice_test.go b/pdf/creator/invoice_test.go index 3af358e2..8e4297e2 100644 --- a/pdf/creator/invoice_test.go +++ b/pdf/creator/invoice_test.go @@ -204,11 +204,11 @@ func TestInvoiceAdvanced(t *testing.T) { invoice.AddSection("Custom section", "This is a custom section.") // Customize note styles. - noteStyle := invoice.AddressStyle() + noteStyle := invoice.NoteStyle() noteStyle.Font = fontHelvetica noteStyle.FontSize = 12 - noteHeadingStyle := invoice.AddressHeadingStyle() + noteHeadingStyle := invoice.NoteHeadingStyle() noteHeadingStyle.Color = blue noteHeadingStyle.Font = fontHelvetica noteHeadingStyle.FontSize = 14 From 9b6cd8b88ae0b60d3898fb867452e230a8e516b5 Mon Sep 17 00:00:00 2001 From: Adrian-George Bostan Date: Mon, 7 Jan 2019 19:22:08 +0200 Subject: [PATCH 2/4] Start at the top of the page when table block is created on new page --- pdf/creator/table.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pdf/creator/table.go b/pdf/creator/table.go index bb181bf8..4d8454f3 100644 --- a/pdf/creator/table.go +++ b/pdf/creator/table.go @@ -331,7 +331,9 @@ func (table *Table) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, block = NewBlock(ctx.PageWidth, ctx.PageHeight) ulX = ctx.Margins.left ulY = ctx.Margins.top + ctx.Height = ctx.PageHeight - ctx.Margins.top - ctx.Margins.bottom + origHeight = ctx.Height startrow = cell.row - 1 yrel = 0 From d8f4ef1c583364a07647bfc78b213782d14f4c80 Mon Sep 17 00:00:00 2001 From: Adrian-George Bostan Date: Mon, 7 Jan 2019 19:30:30 +0200 Subject: [PATCH 3/4] Increase number of invoice lines for the simple invoice test case --- pdf/creator/invoice_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pdf/creator/invoice_test.go b/pdf/creator/invoice_test.go index 8e4297e2..e8331653 100644 --- a/pdf/creator/invoice_test.go +++ b/pdf/creator/invoice_test.go @@ -51,7 +51,7 @@ func TestInvoiceSimple(t *testing.T) { }) // Add invoice line items. - for i := 0; i < 10; i++ { + for i := 0; i < 75; i++ { invoice.AddLine( fmt.Sprintf("Test product #%d", i+1), "1", From a04a48ec709ddce8a491361b9e4e4dcd9991e3d7 Mon Sep 17 00:00:00 2001 From: Adrian-George Bostan Date: Tue, 8 Jan 2019 18:44:08 +0200 Subject: [PATCH 4/4] Fix note section alignment --- pdf/creator/invoice.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pdf/creator/invoice.go b/pdf/creator/invoice.go index 27d016d8..fcede198 100644 --- a/pdf/creator/invoice.go +++ b/pdf/creator/invoice.go @@ -698,6 +698,7 @@ func (i *Invoice) generateHeaderBlocks(ctx DrawContext) ([]*Block, DrawContext, cell := table.NewCell() cell.SetHorizontalAlignment(CellHorizontalAlignmentLeft) cell.SetVerticalAlignment(CellVerticalAlignmentMiddle) + cell.SetIndent(0) cell.SetContent(i.logo) i.logo.ScaleToHeight(titleParagraph.Height() + 20) @@ -738,6 +739,7 @@ func (i *Invoice) generateInformationBlocks(ctx DrawContext) ([]*Block, DrawCont table.SetMargins(0, 0, 25, 0) cell := table.NewCell() + cell.SetIndent(0) cell.SetContent(addrDivision) cell = table.NewCell()