paperMm function
Paper width (mm), taking the short or long edge depending on orientation. Shared by paperWidthPx/printChromeResetCss.
Implementation
double paperMm(String paper, String orient) {
final custom = customPaperSizeInches(paper);
if (custom != null) {
final (w, h) = custom;
final (pw, _) = isLandscape(orient) ? (h, w) : (w, h);
return pw * 25.4;
}
const sizes = <String, List<double>>{
'A3': [297, 420],
'A4': [210, 297],
'A5': [148, 210],
'B5': [176, 250],
'letter': [215.9, 279.4],
'legal': [215.9, 355.6],
};
final wh = sizes[normalizePaper(paper)] ?? sizes['A4']!;
return isLandscape(orient) ? wh[1] : wh[0];
}