generatePdf method
Implementation
Future<pdf.Document> generatePdf(PdfPageFormat format, Test test) async {
final pdf1 = pdf.Document();
int index = 1;
Interpretations2 interpretations = test.autoInterpretations != null
? Interpretations2.fromMap(test)
: Interpretations2.withData(test.bpmEntries, test.gAge ?? 32);
Interpretations2? interpretations2 = (test.bpmEntries2).isNotEmpty
? Interpretations2.withData(test.bpmEntries2, test.gAge ?? 32)
: null;
FhrPdfView2 fhrPdfView = FhrPdfView2(test.lengthOfTest!);
final paths = await fhrPdfView.getNSTGraph(test, interpretations);
for (int i = 0; i < paths!.length; i++) {
final mImage = paths[i];
pdf1.addPage(
pdf.Page(
pageFormat: format,
margin: pdf.EdgeInsets.zero,
build: (context) {
return PfdBasePage(
data: test,
interpretation: interpretations,
interpretation2: interpretations2,
index: index + i,
total: paths.length,
body: pdf.Image(pdf.MemoryImage(mImage.bytes)),
);
},
),
);
}
return pdf1;
}