func ExampleFpdf_WriteAligned() {
	pdf := gofpdf.New("P", "mm", "A4", example.FontDir())
	pdf.SetLeftMargin(50.0)
	pdf.SetRightMargin(50.0)
	pdf.AddPage()
	pdf.SetFont("Helvetica", "", 12)
	pdf.WriteAligned(0, 35, "This text is the default alignment, Left", "")
	pdf.Ln(35)
	pdf.WriteAligned(0, 35, "This text is aligned Left", "L")
	pdf.Ln(35)
	pdf.WriteAligned(0, 35, "This text is aligned Center", "C")
	pdf.Ln(35)
	pdf.WriteAligned(0, 35, "This text is aligned Right", "R")
	pdf.Ln(35)
	line := "This can by used to write justified text"
	leftMargin, _, rightMargin, _ := pdf.GetMargins()
	pageWidth, _ := pdf.GetPageSize()
	pageWidth -= leftMargin + rightMargin
	pdf.SetWordSpacing((pageWidth - pdf.GetStringWidth(line)) / float64(strings.Count(line, " ")))
	pdf.WriteAligned(pageWidth, 35, line, "L")
	fileStr := example.Filename("Fpdf_WriteAligned")
	err := pdf.OutputFileAndClose(fileStr)
	example.Summary(err, fileStr)
	// Output:
	// Successfully generated pdf/Fpdf_WriteAligned.pdf
}
// ExampleFpdf_WriteAligned demonstrates how to align text with the Write function.
ExampleFpdf_WriteAligned demonstrates how to align text with the Write function.
// ExampleFpdf_WriteAligned demonstrates how to align text with the Write function .
func ExampleFpdf_WriteAligned() {
	pdf := gofpdf.New("P", "mm", "A4", example.FontDir())
	pdf.SetLeftMargin(50.0)
	pdf.SetRightMargin(50.0)
	pdf.AddPage()
	pdf.SetFont("Helvetica", "", 12)
	pdf.WriteAligned(0, 35, "This text is the default alignment, Left", "")
	pdf.Ln(35)
	pdf.WriteAligned(0, 35, "This text is aligned Left", "L")
	pdf.Ln(35)
	pdf.WriteAligned(0, 35, "This text is aligned Center", "C")
	pdf.Ln(35)
	pdf.WriteAligned(0, 35, "This text is aligned Right", "R")
	pdf.Ln(35)
	line := "This can by used to write justified text"
	leftMargin, _, rightMargin, _ := pdf.GetMargins()
	pageWidth, _ := pdf.GetPageSize()
	pageWidth -= leftMargin + rightMargin
	pdf.SetWordSpacing((pageWidth - pdf.GetStringWidth(line)) / float64(strings.Count(line, " ")))
	pdf.WriteAligned(pageWidth, 35, line, "L")
	fileStr := example.Filename("Fpdf_WriteAligned")
	err := pdf.OutputFileAndClose(fileStr)
	example.Summary(err, fileStr)
}
func ExampleFpdf_WriteAligned ( ) { pdf := gofpdf . New ( " " , " " , " " , example . FontDir ( ) ) pdf . SetLeftMargin ( 50.0 ) pdf . SetRightMargin ( 50.0 ) pdf . AddPage ( ) pdf . SetFont ( " " , " " , 12 ) pdf . WriteAligned ( 0 , 35 , " " , " " ) pdf . Ln ( 35 ) pdf . WriteAligned ( 0 , 35 , " " , " " ) pdf . Ln ( 35 ) pdf . WriteAligned ( 0 , 35 , " " , " " ) pdf . Ln ( 35 ) pdf . WriteAligned ( 0 , 35 , " " , " " ) pdf . Ln ( 35 ) line := " " leftMargin , _ , rightMargin , _ := pdf . GetMargins ( ) pageWidth , _ := pdf . GetPageSize ( ) pageWidth -= leftMargin + rightMargin pdf . SetWordSpacing ( ( pageWidth - pdf . GetStringWidth ( line ) ) / float64 ( strings . Count ( line , " " ) ) ) pdf . WriteAligned ( pageWidth , 35 , line , " " ) fileStr := example . Filename ( " " ) err := pdf . OutputFileAndClose ( fileStr ) example . Summary ( err , fileStr ) }
ExampleFpdf_WriteAligned demonstrates how to align text with the Write function.
ExampleFpdf_WriteAligned demonstrates how to align text with the Write function .
// Output: // Successfully generated pdf/Fpdf_WriteAligned.pdf