I have added this code in onPrintRequest
in InAppWebViewSettings
. But those settings that I have provided in PrintJobSettings
are not applying in generated documents. And in print preview it is not showing A4 paper size.
I am using InAppWebView 6.0.0 for my project.
onPrintRequest: (controller, url, printJobController) async {
printJobController?.dispose();
PrintJobSettings settings = PrintJobSettings(
handledByClient: true,
jobName:
"${await webViewController?.getTitle() ?? ''} - PDF Document example",
colorMode: PrintJobColorMode.MONOCHROME,
outputType: PrintJobOutputType.GRAYSCALE,
orientation: PrintJobOrientation.PORTRAIT,
margins: EdgeInsets.all(10),
mediaSize: PrintJobMediaSize(
heightMils: 292,
id: DateTime.now().toString(),
widthMils: 210),
numberOfPages: 1);
print('printing');
await controller.printCurrentPage(settings: settings);
return true;
},
I was expecting to apply those settings on generated documents.
New contributor
Md Hemal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.