package pdf import ( "encoding/base64" "fmt" "github.com/johnfercher/maroto/pkg/consts" "github.com/johnfercher/maroto/pkg/pdf" "github.com/johnfercher/maroto/pkg/props" "io/ioutil" "log" "os" "time" ) func ToPDF(investorName string) (string, error) { m := pdf.NewMaroto(consts.Portrait, consts.A4) m.SetPageMargins(20, 10, 20) dt := getDate() datetime := dt.Format("2006-01-02 15:04:05") m.Row(10, func() { m.Col(12, func() { m.Text("Declaration By The Investor,", props.Text{ Top: 3, Style: consts.Bold, Align: consts.Center, // Color: getDarkPurpleColor(), }) }) }) m.Row(10, func() { m.Col(12, func() { m.Text(" I, " + investorName + ", after registering with an internet based platform on www.lendbox.in (\"The Website\") to find suitable borrower(s), do hereby declare that:") }) }) m.Row(10, func() { m.Col(12, func() { m.Text("1. That I have read all the material, terms and conditions available at the website of M/s. Transactree Technologies Private Limited (\"The Company\"), owners and operators of the Website (www.lendbox.in);") }) }) m.Row(10, func() { m.Col(12, func() { m.Text("2. That I have unconditionally agreed to abide by the terms and conditions, Privacy Policy and other binding material contained on the Website of the Company;") }) }) m.Row(10, func() { m.Col(12, func() { m.Text("3. That the information and financial details furnished by me on the Website of the Company are true and correct;") }) }) m.Row(25, func() { m.Col(12, func() { m.Text("4. That I have on my own wisdom and judgment agreed to lend through the Company and the Company has had no role to play in making me extend any amount as loan to borrower(s) that have or may register on the Website, as I recognise that M/s. Transactree Technologies Private Limited is only a market platform for persons interested in available and granting of loans, to meet independently. The Company does not intervene or in any way get engaged in any loan transaction and I fully recognise that I have to deal directly with the borrower(s) of such transaction;") }) }) m.Row(20, func() { m.Col(12, func() { m.Text("5. That I have not taken any action from the information available on the Website that has influenced my decision for the loan transaction(s) which I would enter into and I understand that in the event of any dispute with the borrower(s) of such loans, the dispute resolution shall be directly between the borrower(s) and me. The Company or any representative of the Company shall not be impleaded in any manner in a dispute with the borrower(s) as they are not privy to such loan transaction(s);") }) }) m.Row(20, func() { m.Col(12, func() { m.Text("6. That my registration on the Website for the loan transaction(s) or otherwise, does not make in any manner the Company a party or privy to the loan transaction(s) whether entered into or to be entered into by me. The Company or any of the representatives of M/s. Transactree Technologies Private Limited shall not be held responsible for either repayment of the loan(s) extended by me, or loss of money, failure to recover the money, or breach of any confidential information;") }) }) m.Row(15, func() { m.Col(12, func() { m.Text("7. That I have undertaken at my own judgment and information assessment to register on the Website and offer the loan(s) and M/s. Transactree Technologies Private Limited shall not responsible for any inaccuracy or any material accessed by me on The Website;") }) }) m.Row(25, func() { m.Col(12, func() { m.Text("8. That I have a bank account with Investor Bank Name and I shall disburse the loan(s) from this bank account or such other account as may be designated by me and informed in writing to the Company. I undertake that I have not borrowed money from any third party, banks or financial institutions to disburse the loan(s). That the Company has taken an authorisation from the borrower(s) for the NACH mandate and will assist in ensuring that the EMI reach my designated bank account from the designated bank account of the borrower(s) as per the NACH mandate.") }) }) m.Row(20, func() { m.Col(12, func() { m.Text("9. That I fully understand that I can seek such information and material directly from borrower(s) as needed by me as I can research, verify and arrive at a judgment myself. The Company does not need to perform any such or other obligation for me. In the event of loss or damage to the Company due to any action or inaction related to this loan transaction(s), I shall keep the Company harmless and indemnified against such losses;") }) }) m.Row(25, func() { m.Col(12, func() { m.Text("10. That I am authorizing the Company on my behalf to retain, the cheques that have been or may be provided as collateral by the borrower(s) and the said cheques shall be presented to me, in my capacity as the Lender in the event the borrower(s) is unable to meet its obligations of repayment of the loan amount(s) as per the repayment schedule agreed between me and such borrower(s) under the loan agreement(s) to be utilized as collateral. I am aware that the Company has no responsibility whatsoever in recovery of the loan(s) extended or to be extended by me to the borrower(s).") }) }) m.Row(15, func() { m.Col(12, func() { m.Text("11. That the Company may send reminders to the borrower(s) via sms/emails/calls of the monthly due date of each instalment due from the borrower(s) to ensure that the borrower(s) have sufficient funds in their bank accounts to be debited.") }) }) m.Row(15, func() { m.Col(12, func() { m.Text("12. That the Company may send reminders to the borrower(s) through emails/SMS/calls in the event of a delay for the first 90 days of the delay in paying the loan(s) as per the repayment schedule agreed between the borrower(s) and me.") }) }) m.Row(15, func() { m.Col(12, func() { m.Text("13. That the Company may send a legal notice to the defaulting borrower(s) after a delay of 90 days by the borrower(s) in repayment of the loan(s) as per the repayment schedule agreed between the borrower(s) and me, and simultaneously hand over the cheques provided as collateral to me.") }) }) m.Row(20, func() { m.Col(12, func() { m.Text("14. That the Company may after delay of 120 days in repayment of the loan amount(s) as per the repayment schedule agreed between the borrower(s) and me inform the recovery agency as designated by me and the borrower(s) to start collection procedures. The charges for the recovery agency would be incurred by myself and will be based on the loan amount recovered from the borrower(s).") }) }) m.Row(15, func() { m.Col(12, func() { m.Text("15. I confirm that I do not have over ₹ 50,00,000 invested or lent and outstanding across all P2P Lending platforms at the time of sign up and will not exceed the said limit on Lendbox as well. I will inform the Lendbox team in case the said limit is exceeded.") }) }) m.Row(15, func() { m.Col(12, func() { m.Text("16. I confirm that I have not invested or lent over ₹ 50,000 to a single borrower across all P2P Lending platforms of sign up and will not exceed the said limit on Lendbox as well. I will inform the Lendbox team in case the said limit is exceeded.") }) }) m.Row(15, func() { m.Col(12, func() { m.Text("17. That I have given this declaration upon fully reading and understanding material, terms and conditions available at the website of M/s Transactree Technologies Private Limited and at my own volition.") }) }) m.Row(20, func() { m.Col(12, func() { m.Text("Signed at "+datetime+" By " + investorName) }) }) filename := "agreement_" + time.Now().String() + ".pdf" err := m.OutputFileAndClose(filename) if err != nil { fmt.Println("ould not save PDF:", err) os.Exit(1) } fmt.Println("PDF saved successfully") //Read to base64 bytes, err := ioutil.ReadFile(filename) if err != nil { log.Fatal(err) } //var base64Encoding string //base64Encoding = "data:application/pdf;base64," + toBase64(bytes) // Print the full base64 representation of the image return toBase64(bytes), nil /*err := m.OutputFileAndClose("pdfs/agreement_" + time.Now().String() + ".pdf") if err != nil { fmt.Println("ould not save PDF:", err) os.Exit(1) } fmt.Println("PDF saved successfully") return*/ } func toBase64(b []byte) string { return base64.StdEncoding.EncodeToString(b) } func getDate() time.Time { loc, _ := time.LoadLocation("Asia/Kolkata") dt := time.Now().In(loc) return dt }