flutter_html_to_pdf icon indicating copy to clipboard operation
flutter_html_to_pdf copied to clipboard

Generated report cut in half on iOS, correct on Android

Open dominolog opened this issue 3 years ago • 5 comments

I use below html to generate pdf.

<!DOCTYPE html>
<html>
<head>
    <style>
      body {
          font-family: Arial;
      }
      p {
          color: #000000;
      }
      h4 {
          color: #000000;
      }
      h2 {
          color: #000000;
      }
      h1 {
          color: #9c0054;
      }

      a {
           color: #9c0054;
      }

      .main {
        text-align: center;
      }


    </style>
</head>
<body>
<div class="main">
    <br/><br/><br/>
    <h2>Wynik FIB-4</h2>
    <h3>wygenerowany przez aplikację FIB-4 Kalkulator</h3>
    <br/>
    <h1>{{result}}</h1>
    <br/>
    <p>{{description}}</p>
    <p>
        <a href="https://www.mp.pl/medycynarodzinna/wytyczne/218262,zalecenia-polskiej-grupy-ekspertow-nafld-2019">Zalecenia
            Polskiej Grupy Ekspertów NAFLD 2019. Medycyna Praktyczna 10/2019.</a></p>
</div>
</body>
</html>

The code for generation as below:

void prepareReportAndSend() async {
    String report = await rootBundle.loadString("assets/pages/result.html");
    report = report.replaceAll("{{result}}", resultText)
               .replaceAll("{{description}}", descText);
    Directory tempDir = await getTemporaryDirectory();
    String tempPath = tempDir.path;
    var generatedPdfFile = await FlutterHtmlToPdf.convertFromHtmlContent(
        report, tempPath, "raport_fib-4");
    var additionalFile = globals.attachementFile.path;
    var body = "Dzień dobry\n\nW załączeniu Twój wynik FIB-4 oraz ulotka informacyjna „Czym grozi stłuszczenie Wątroby?”, a także zalecenia dietetyczne opracowane przez specjalistę.";
    await sendEmailAsync(
        "FIB-4 wynik", [], body, [generatedPdfFile.path, additionalFile]);
  }

The problem is the generated report is incorrect on iOS. The PDF looks like cut. It works correct on Android. Any ideas? raport_IOS.pdf raport_Android.pdf

dominolog avatar Sep 18 '20 08:09 dominolog

There is data loss in iOS between pages. How to work around this?

Felipe00 avatar Jan 16 '21 06:01 Felipe00

Any updates about it? I'm getting the same results. @Afur Could you debug it and try to solve please?

RogerBrusamarello avatar Nov 18 '21 21:11 RogerBrusamarello

same issue.

Hieuntdz avatar Nov 29 '21 07:11 Hieuntdz

Hello ✋ Unfortunately I am currently too busy to work on the development of this library. Any kind of contribution will be welcomed and published. 🙏

Afur avatar Nov 29 '21 21:11 Afur

@dominolog Did you solve the problem?

demirdev avatar Feb 07 '22 19:02 demirdev