Loading password-protected PDF’s in Flutter PDF Viewer (SfPdfViewer)

18 Dec 20211 minute to read

When loading a password-protected document without a password or with an invalid password in SfPdfViewer using the password property.The default password dialogue will be displayed.

Password dialog

Customize the visibility of password dialogue

The password-protected document can be loaded by providing the password in the password property of SfPdfViewer.The canShowPasswordDialog property allows the user to customize the password dialogue visibility. The following code example explains the same.

Widget build(BuildContext context) {
  return Scaffold(
      body: Container(
          child: SfPdfViewer.asset(
            canShowPasswordDialog: false,)));