paperWidthPx function

double paperWidthPx(
  1. String paper,
  2. String orient
)

Printable width in pixels of paper in orientation orient.

Implementation

double paperWidthPx(String paper, String orient) {
  const mmPerPx = 96.0 / 25.4;
  const margin = 44.0; // left + right margins combined
  // @@@ the paper-size table is now provided uniformly by paperMm() --
  //     don't copy another one here. Maintaining two separate tables
  //     means one eventually gets updated and the other forgotten.
  final px = paperMm(paper, orient) * mmPerPx - margin;
  return px < 200 ? 200 : px; // lower-bound safety net
}