I am trying to create the PDF using HTML, CSS in flutter. So, In some cases I have to render the asset image using html and css.
It is rendering in case of android by using the asset file location like (file:///android_asset/...) mentioned in the code below:
makeProfileImage() {
  return '<img src="file:///android_asset/flutter_assets/assets/image_name.jpg">';
}
How to get asset file path like (file:///android_asset/flutter_assets/...) in iOS?
Future<void> printPdf() async {
  print('Print ...');
  await Printing.layoutPdf(onLayout: (PdfPageFormat format) async {
    return await Printing.convertHtml(
        format: PdfPageFormat.a4
            .applyMargin(left: 0, top: 0, right: 0, bottom: 0),
        html: '<html><head>' +
            getRatingbarCss() +
            '<style>.checked {color: red;}</style>' +
            '</head><body style="margin:0;padding:0" bgcolor="white">' +
            makeProfileImage() +
            '<h2 style="color:black;">Star Rating</h2><span class="fa fa-star checked"/><span class="fa fa-star checked"/><span class="fa fa-star checked"/><span class="fa fa-star"/><span class="fa fa-star"/></body></html>');
  });
}
pubspec.yaml
dev_dependencies:
  flutter_test:
    sdk: flutter
  pdf: ^1.3.17
  printing: ^2.0.0
  flutter_full_pdf_viewer: ^1.0.4


