PdfViewer.custom constructor

PdfViewer.custom({
  1. required int fileSize,
  2. required FutureOr<int> read(
    1. Uint8List buffer,
    2. int position,
    3. int size
    ),
  3. required String sourceName,
  4. PdfPasswordProvider? passwordProvider,
  5. bool firstAttemptByEmptyPassword = true,
  6. Key? key,
  7. PdfViewerController? controller,
  8. PdfViewerParams params = const PdfViewerParams(),
  9. int initialPageNumber = 1,
})

Create PdfViewer from a custom source.

fileSize is the size of the PDF file. read is the function to read the PDF file. sourceName can be any arbitrary string to identify the source of the PDF; Neither of read/fileSize identify the source if such name is explicitly specified. passwordProvider is used to provide password for encrypted PDF. See PdfPasswordProvider for more info. firstAttemptByEmptyPassword is used to determine whether the first attempt to open the PDF is by empty password or not. For more info, see PdfPasswordProvider. controller is the controller to control the viewer. params is the parameters to customize the viewer. initialPageNumber is the page number to show initially.

Implementation

PdfViewer.custom({
  required int fileSize,
  required FutureOr<int> Function(Uint8List buffer, int position, int size)
      read,
  required String sourceName,
  PdfPasswordProvider? passwordProvider,
  bool firstAttemptByEmptyPassword = true,
  super.key,
  this.controller,
  this.params = const PdfViewerParams(),
  this.initialPageNumber = 1,
}) : documentRef = PdfDocumentRefCustom(
        fileSize: fileSize,
        read: read,
        sourceName: sourceName,
        passwordProvider: passwordProvider,
        firstAttemptByEmptyPassword: firstAttemptByEmptyPassword,
      );