From 38c05954600e0c42460640cda5fb48a5023fe168 Mon Sep 17 00:00:00 2001 From: Dan Castrillo <126793278+dvrd@users.noreply.github.com> Date: Wed, 28 Jun 2023 22:25:07 -0400 Subject: [PATCH] feat: Add multiple lines to notes (#13) --- pdf.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pdf.go b/pdf.go index 441e07c32fa79a6ae4c69ea709348df689350bb9..d3b8c739339787614468e681d5a35e19c5810c82 100644 --- a/pdf.go +++ b/pdf.go @@ -5,6 +5,7 @@ import ( "image" "os" "strconv" + "strings" "github.com/signintech/gopdf" ) @@ -98,11 +99,18 @@ func writeNotes(pdf *gopdf.GoPdf, notes string) { pdf.SetTextColor(55, 55, 55) _ = pdf.Cell(nil, "Notes") pdf.Br(18) + _ = pdf.SetFont("Inter", "", 8) pdf.SetTextColor(0, 0, 0) - _ = pdf.Cell(nil, notes) + + notesLines := strings.Split(notes, "\\n") + + for i := 0; i < len(notesLines); i++ { + _ = pdf.Cell(nil, notesLines[i]) + pdf.Br(15) + } + pdf.Br(48) } - func writeFooter(pdf *gopdf.GoPdf, id string) { pdf.SetY(800)