Unable to remove the page outer margin of the pdf which is created using html/css in flutter iOS Unable to remove the page outer margin of the pdf which is created using html/css in flutter iOS flutter flutter

Unable to remove the page outer margin of the pdf which is created using html/css in flutter iOS


Finally this will resolve the issue of printing:

We have to set the margin using copyWith(..). applyMargin(..) will only increase the margin from what you already have. And you also have to use the provided paper format:

await Printing.layoutPdf(onLayout: (PdfPageFormat format) async {  return await Printing.convertHtml(      format: format.copyWith(marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0),      html: '<?xml version="1.0"?><html><body style="margin:0;padding:0" bgcolor="#144434"><h1 style="color:white">Test Layout Margin</h1></body></html>');});


try this

css

@media print {  body {    margin: 0 !important;    padding:0 !important;    border:0 !important;    outline:0 !important;  }}