func ExampleFpdf_MultiCell() {
	pdf := gofpdf.New("P", "mm", "A4", "")
	titleStr := "20000 Leagues Under the Seas"
	pdf.SetTitle(titleStr, false)
	pdf.SetAuthor("Jules Verne", false)
	pdf.SetHeaderFunc(func() {
		// Arial bold 15
		pdf.SetFont("Arial", "B", 15)
		// Calculate width of title and position
		wd := pdf.GetStringWidth(titleStr) + 6
		pdf.SetX((210 - wd) / 2)
		// Colors of frame, background and text
		pdf.SetDrawColor(0, 80, 180)
		pdf.SetFillColor(230, 230, 0)
		pdf.SetTextColor(220, 50, 50)
		// Thickness of frame (1 mm)
		pdf.SetLineWidth(1)
		// Title
		pdf.CellFormat(wd, 9, titleStr, "1", 1, "C", true, 0, "")
		// Line break
		pdf.Ln(10)
	})
	pdf.SetFooterFunc(func() {
		// Position at 1.5 cm from bottom
		pdf.SetY(-15)
		// Arial italic 8
		pdf.SetFont("Arial", "I", 8)
		// Text color in gray
		pdf.SetTextColor(128, 128, 128)
		// Page number
		pdf.CellFormat(0, 10, fmt.Sprintf("Page %d", pdf.PageNo()),
			"", 0, "C", false, 0, "")
	})
	chapterTitle := func(chapNum int, titleStr string) {
		// 	// Arial 12
		pdf.SetFont("Arial", "", 12)
		// Background color
		pdf.SetFillColor(200, 220, 255)
		// Title
		pdf.CellFormat(0, 6, fmt.Sprintf("Chapter %d : %s", chapNum, titleStr),
			"", 1, "L", true, 0, "")
		// Line break
		pdf.Ln(4)
	}
	chapterBody := func(fileStr string) {
		// Read text file
		txtStr, err := ioutil.ReadFile(fileStr)
		if err != nil {
			pdf.SetError(err)
		}
		// Times 12
		pdf.SetFont("Times", "", 12)
		// Output justified text
		pdf.MultiCell(0, 5, string(txtStr), "", "", false)
		// Line break
		pdf.Ln(-1)
		// Mention in italics
		pdf.SetFont("", "I", 0)
		pdf.Cell(0, 5, "(end of excerpt)")
	}
	printChapter := func(chapNum int, titleStr, fileStr string) {
		pdf.AddPage()
		chapterTitle(chapNum, titleStr)
		chapterBody(fileStr)
	}
	printChapter(1, "A RUNAWAY REEF", example.TextFile("20k_c1.txt"))
	printChapter(2, "THE PROS AND CONS", example.TextFile("20k_c2.txt"))
	fileStr := example.Filename("Fpdf_MultiCell")
	err := pdf.OutputFileAndClose(fileStr)
	example.Summary(err, fileStr)
	// Output:
	// Successfully generated pdf/Fpdf_MultiCell.pdf
}
// ExampleFpdf_MultiCell demonstrates word-wrapping, line justification and
// page-breaking.
ExampleFpdf_MultiCell demonstrates word-wrapping, line justification and
page-breaking.
// ExampleFpdf_MultiCell demonstrates word - wrapping line justification and // page - breaking .
func ExampleFpdf_MultiCell() {
	pdf := gofpdf.New("P", "mm", "A4", "")
	titleStr := "20000 Leagues Under the Seas"
	pdf.SetTitle(titleStr, false)
	pdf.SetAuthor("Jules Verne", false)
	pdf.SetHeaderFunc(func() {
		pdf.SetFont("Arial", "B", 15)
		wd := pdf.GetStringWidth(titleStr) + 6
		pdf.SetX((210 - wd) / 2)
		pdf.SetDrawColor(0, 80, 180)
		pdf.SetFillColor(230, 230, 0)
		pdf.SetTextColor(220, 50, 50)
		pdf.SetLineWidth(1)
		pdf.CellFormat(wd, 9, titleStr, "1", 1, "C", true, 0, "")
		pdf.Ln(10)
	})
	pdf.SetFooterFunc(func() {
		pdf.SetY(-15)
		pdf.SetFont("Arial", "I", 8)
		pdf.SetTextColor(128, 128, 128)
		pdf.CellFormat(0, 10, fmt.Sprintf("Page %d", pdf.PageNo()),
			"", 0, "C", false, 0, "")
	})
	chapterTitle := func(chapNum int, titleStr string) {
		pdf.SetFont("Arial", "", 12)
		pdf.SetFillColor(200, 220, 255)
		pdf.CellFormat(0, 6, fmt.Sprintf("Chapter %d : %s", chapNum, titleStr),
			"", 1, "L", true, 0, "")
		pdf.Ln(4)
	}
	chapterBody := func(fileStr string) {
		txtStr, err := ioutil.ReadFile(fileStr)
		if err != nil {
			pdf.SetError(err)
		}
		pdf.SetFont("Times", "", 12)
		pdf.MultiCell(0, 5, string(txtStr), "", "", false)
		pdf.Ln(-1)
		pdf.SetFont("", "I", 0)
		pdf.Cell(0, 5, "(end of excerpt)")
	}
	printChapter := func(chapNum int, titleStr, fileStr string) {
		pdf.AddPage()
		chapterTitle(chapNum, titleStr)
		chapterBody(fileStr)
	}
	printChapter(1, "A RUNAWAY REEF", example.TextFile("20k_c1.txt"))
	printChapter(2, "THE PROS AND CONS", example.TextFile("20k_c2.txt"))
	fileStr := example.Filename("Fpdf_MultiCell")
	err := pdf.OutputFileAndClose(fileStr)
	example.Summary(err, fileStr)
}
func ExampleFpdf_MultiCell ( ) { pdf := gofpdf . New ( " " , " " , " " , " " ) titleStr := " " pdf . SetTitle ( titleStr , false ) pdf . SetAuthor ( " " , false ) pdf . SetHeaderFunc ( func ( ) { pdf . SetFont ( " " , " " , 15 ) wd := pdf . GetStringWidth ( titleStr ) + 6 pdf . SetX ( ( 210 - wd ) / 2 ) pdf . SetDrawColor ( 0 , 80 , 180 ) pdf . SetFillColor ( 230 , 230 , 0 ) pdf . SetTextColor ( 220 , 50 , 50 ) pdf . SetLineWidth ( 1 ) pdf . CellFormat ( wd , 9 , titleStr , " " , 1 , " " , true , 0 , " " ) pdf . Ln ( 10 ) } ) pdf . SetFooterFunc ( func ( ) { pdf . SetY ( - 15 ) pdf . SetFont ( " " , " " , 8 ) pdf . SetTextColor ( 128 , 128 , 128 ) pdf . CellFormat ( 0 , 10 , fmt . Sprintf ( " " , pdf . PageNo ( ) ) , " " , 0 , " " , false , 0 , " " ) } ) chapterTitle := func ( chapNum int , titleStr string ) { pdf . SetFont ( " " , " " , 12 ) pdf . SetFillColor ( 200 , 220 , 255 ) pdf . CellFormat ( 0 , 6 , fmt . Sprintf ( " " , chapNum , titleStr ) , " " , 1 , " " , true , 0 , " " ) pdf . Ln ( 4 ) } chapterBody := func ( fileStr string ) { txtStr , err := ioutil . ReadFile ( fileStr ) if err != nil { pdf . SetError ( err ) } pdf . SetFont ( " " , " " , 12 ) pdf . MultiCell ( 0 , 5 , string ( txtStr ) , " " , " " , false ) pdf . Ln ( - 1 ) pdf . SetFont ( " " , " " , 0 ) pdf . Cell ( 0 , 5 , " " ) } printChapter := func ( chapNum int , titleStr , fileStr string ) { pdf . AddPage ( ) chapterTitle ( chapNum , titleStr ) chapterBody ( fileStr ) } printChapter ( 1 , " " , example . TextFile ( " " ) ) printChapter ( 2 , " " , example . TextFile ( " " ) ) fileStr := example . Filename ( " " ) err := pdf . OutputFileAndClose ( fileStr ) example . Summary ( err , fileStr ) }
ExampleFpdf_MultiCell demonstrates word-wrapping, line justification and
page-breaking.
ExampleFpdf_MultiCell demonstrates word - wrapping line justification and page - breaking .
// Arial bold 15 // Calculate width of title and position // Colors of frame, background and text // Thickness of frame (1 mm) // Title // Line break // Position at 1.5 cm from bottom // Arial italic 8 // Text color in gray // Page number // 	// Arial 12 // Background color // Title // Line break // Read text file // Times 12 // Output justified text // Line break // Mention in italics // Output: // Successfully generated pdf/Fpdf_MultiCell.pdf