PdfViewer.data constructor

PdfViewer.data(
  1. Uint8List data, {
  2. required String sourceName,
  3. PdfPasswordProvider? passwordProvider,
  4. bool firstAttemptByEmptyPassword = true,
  5. bool useProgressiveLoading = true,
  6. Key? key,
  7. PdfViewerController? controller,
  8. PdfViewerParams params = const PdfViewerParams(),
  9. int initialPageNumber = 1,
})

Create PdfViewer from a byte data.

  • data is the byte data.
  • sourceName must be some ID, e.g., file name or URL, to identify the source of the PDF. If sourceName is not unique for each source, the viewer may not work correctly.
  • 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.data(
  Uint8List data, {
  required String sourceName,
  PdfPasswordProvider? passwordProvider,
  bool firstAttemptByEmptyPassword = true,
  bool useProgressiveLoading = true,
  super.key,
  this.controller,
  this.params = const PdfViewerParams(),
  this.initialPageNumber = 1,
}) : documentRef = PdfDocumentRefData(
       data,
       sourceName: sourceName,
       passwordProvider: passwordProvider,
       firstAttemptByEmptyPassword: firstAttemptByEmptyPassword,
       useProgressiveLoading: useProgressiveLoading,
     );