raster method

void raster()

Rasterize the document

Implementation

void raster() {
  _previewUpdate?.cancel();
  _previewUpdate = Timer(_updateTime, () {
    if (forcedDpi != null) {
      dpi = forcedDpi!;
    } else {
      final mq = MediaQuery.of(context);
      final double dpr;
      if (!kIsWeb && Platform.isAndroid) {
        if (mq.size.shortestSide * mq.devicePixelRatio < 800) {
          dpr = 2 * mq.devicePixelRatio;
        } else {
          dpr = mq.devicePixelRatio;
        }
      } else {
        dpr = mq.devicePixelRatio;
      }
      dpi =
          (min(mq.size.width - 16, widget.maxPageWidth ?? double.infinity)) *
              dpr /
              pageFormat.width *
              PdfPageFormat.inch;
    }

    _raster();
  });
}