### Install GoFPDF Package Source: https://github.com/go-pdf/fpdf/blob/main/doc/document.md Installs the go-pdf/fpdf package using the go get command. It also shows how to update to the latest version with verbose output. ```shell go get github.com/go-pdf/fpdf go get -u -v github.com/go-pdf/fpdf/... ``` -------------------------------- ### Generate PDFs with Nonstandard Fonts using go-pdf/fpdf Source: https://github.com/go-pdf/fpdf/blob/main/doc/document.md Demonstrates adding and using non-UTF-8 TrueType or Type1 fonts in PDF generation with go-pdf/fpdf. This requires generating a font definition file and potentially a compressed font file using the MakeFont utility. Once processed, the AddFont method loads the font, and SetFont is used to start using it. ```shell ./makefont --embed --enc=../font/cp1252.map --dst=../font ../font/calligra.ttf ``` ```Go // AddFont loads the font definition file. pdf.AddFont("calligra", "", "../font/calligra.ttf") // SetFont begins using the loaded font. pdf.SetFont("calligra", "", 12) ``` -------------------------------- ### Generate Simple PDF with GoFPDF Source: https://github.com/go-pdf/fpdf/blob/main/doc/document.md Demonstrates how to create a basic PDF file using the GoFPDF library. It initializes a new PDF document, sets the font, adds a 'Hello, world' cell, and saves the output to a file. ```go pdf := fpdf.New("P", "mm", "A4", "") pdf.AddPage() pdf.SetFont("Arial", "B", 16) pdf.Cell(40, 10, "Hello, world") err := pdf.OutputFileAndClose("hello.pdf") ``` -------------------------------- ### Switch Text Direction with RTL() and LTR() in go-pdf/fpdf Source: https://github.com/go-pdf/fpdf/blob/main/doc/document.md Illustrates how to switch text rendering between right-to-left (RTL) and left-to-right (LTR) modes when working with UTF-8 encoded fonts in the go-pdf/fpdf library. This is crucial for languages that require specific text directionality. ```Go // Switch to Right-to-Left mode pdf.RTL() // Switch to Left-to-Right mode pdf.LTR() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.