diff --git a/logos/nbit-logo.png b/logos/nbit-logo.png new file mode 100644 index 0000000..f171c3a Binary files /dev/null and b/logos/nbit-logo.png differ diff --git a/mkinvoice.go b/mkinvoice.go index 80c33fa..295cc27 100644 --- a/mkinvoice.go +++ b/mkinvoice.go @@ -30,14 +30,16 @@ var pdf *gofpdf.Fpdf var y_pos float64 var invoice_data InvoiceData const margin_top = 7 +const logo_top = 6 +const logo_height = 23 const line_spacing = 4 const tabstop_left = 20 -const tabstop_header_label = 80 -const tabstop_header_value = 100 +const tabstop_left_2 = 32 const tabstop_address = 10 const tabstop_count = 10 const tabstop_price = 10 -const tabstop_total = 10 +const tabstop_total = 170 +const tabstop_logo = 155 func ReadInvoiceData(filename string) { invoice_data.invoice_number = "1" @@ -68,19 +70,29 @@ func SetupInvoice() { } func PrintPageHeader(firstPage bool) { + var opt gofpdf.ImageOptions + pdf.AddPage() y_pos = margin_top pdf.SetFont("Dejavusans-Bold", "", 9) WriteText(tabstop_left, y_pos, "nbit Informatik GmbH") pdf.SetFont("Dejavusans", "", 9) - WriteText(tabstop_header_label, y_pos, "Tel.") - WriteText(tabstop_header_value, y_pos, "+41 31 792 00 40") y_pos = y_pos + line_spacing WriteText(tabstop_left, y_pos, "Kirchweg 2") - WriteText(tabstop_header_label, y_pos, "EMal") - WriteText(tabstop_header_value, y_pos, "joerg.lehmann@nbit.ch") y_pos = y_pos + line_spacing WriteText(tabstop_left, y_pos, "3510 Konolfingen") + y_pos = y_pos + line_spacing + y_pos = y_pos + line_spacing + WriteText(tabstop_left, y_pos, "Tel.") + WriteText(tabstop_left_2, y_pos, "+41 31 792 00 40") + y_pos = y_pos + line_spacing + WriteText(tabstop_left, y_pos, "EMail") + WriteText(tabstop_left_2, y_pos, "joerg.lehmann@nbit.ch") + y_pos = y_pos + line_spacing + + opt.ImageType = "png" + opt.ReadDpi = true + pdf.ImageOptions("logos/nbit-logo.png", tabstop_logo, logo_top, 0, logo_height, false, opt, 0, "") } func main() {