printParagraph static method
Print a paragraph of text with automatic word wrapping.
Takes a long text and wraps it to fit the printer width.
text: The paragraph text to printlineWidth: Maximum width of each line in charactersfontFamily: Font family to usefontSize: Font size in pointsfontWeight: Font weight (normal, bold, etc.)breakWords: Whether to break words that are longer than line width
Returns true if printing was successful.
Implementation
static Future<bool> printParagraph(
String text, {
int lineWidth = 48,
String fontFamily = 'Siemreap',
double fontSize = 20,
FontWeight fontWeight = FontWeight.normal,
bool breakWords = false,
}) async {
// Wrap the text into lines
final lines =
TextFormatter.wrapText(text, lineWidth, breakWords: breakWords);
// Print the wrapped lines
return await printLines(
lines,
fontFamily: fontFamily,
fontSize: fontSize,
fontWeight: fontWeight,
);
}