wapform_report library

Constants

kMaxGroups → const int
kRulerChars → const int
The paper content width (px) for the on-screen preview.
kRulerCharWidthRatio → const double
The ratio of digit-character width to font size.

Functions

customPaperSizeInches(String paper) → (double, double)?
@@@ 2026-08-10 added: custom paper size, format "WIDTHxHEIGHT" (inches), e.g. the 8.5x5.5 pre-printed continuous-form paper common in Taiwan. Shares the same detection logic as named sizes (letter/A4...) -- all three call sites (screen width, CSS @page, PdfPageFormat) call this, so they never disagree. Returns null when it isn't a custom format, leaving normalizePaper to handle the named-size path.
isLandscape(String orient) → bool
Whether this is landscape. Accepts L / landscape / 橫 / 水平 / 1 (case-insensitive).
normalizePaper(String paper) → String
Normalizes the paper name, returning the string used for CSS @page size (A4 / letter / B5 …). Returns A4 for an empty or unrecognized value, consistent with upstream WapPage's default.
pageSizeOf(String paper, String orient) → String
Builds the value for CSS @page's size, e.g. "letter landscape". @@@ 2026-08-10 fix: a custom size (e.g. "8.5x5.5") now uses its inch value directly as the CSS size, instead of always falling back to A4.
paperMm(String paper, String orient) → double
Paper width (mm), taking the short or long edge depending on orientation. Shared by paperWidthPx/printChromeResetCss.
paperWidthPx(String paper, String orient) → double
printChromeResetCss(String pageSize, String paper, String orient) → String
@@@ 2026-08-21 The print-only "strip screen decoration + scale font to match the ruler line" stylesheet.
wapFontFaceCss(String fontAsset) → Future<String>
wapPdfPageFormat(String paper, String orient) → PdfPageFormat
PdfPageFormat reuses the same normalizePaper/isLandscape detection as the on-screen/HTML print path, so all three (screen width, @page size, PdfPageFormat) never disagree. @@@ 2026-08-10 fix: a custom size (e.g. "8.5x5.5") now builds the PdfPageFormat directly from its inch value.