Printing
#1219
Replies: 1 comment
-
These are totally unrelated plugins and hence it would not apply any flutter_html styling to that printing plugin. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a way to print the result of flutter html to a PDF?
I am using the Printing Plugin which does not display the styling done through flutter_html
Printing.layoutPdf(
onLayout: (PdfPageFormat format) async => await Printing.convertHtml(
format: format,
html: MyHtmlString,
));
Padding(
padding: 8.0,
child: InkWell(
onTap: () {
},
child: Html(
data: MyString,
shrinkWrap: true,
style: {
// tables will have the below background color
"table": Style(
backgroundColor: Color.fromARGB(0x50, 0xee, 0xee, 0xee),
),
// some other granular customizations are also possible
"tr": Style(
border: Border(bottom: BorderSide(color: Colors.grey)),
),
"th": Style(
padding: EdgeInsets.all(6),
backgroundColor: Colors.grey,
),
"td": Style(
padding: EdgeInsets.all(6),
alignment: Alignment.topLeft,
),
// text that renders h1 elements will be red
"h1": Style(color: Colors.red),
},
customRender: {
"table": (context, child) {
return SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: (context.tree as TableLayoutElement).toWidget(context),
);
}
}),
),
)
Beta Was this translation helpful? Give feedback.
All reactions