lohanidamodar / pdf_viewer

A flutter plugin for handling PDF files. Works on both Android & iOS
https://pub.dev/packages/advance_pdf_viewer
BSD 3-Clause "New" or "Revised" License
61 stars 143 forks source link

File name with white space won't able to open the file #87

Open swapnilsinha17 opened 2 years ago

swapnilsinha17 commented 2 years ago

@lohanidamodar

Please help

Faaatman commented 2 years ago

I fixed it with the following:

  Future<File> replaceSpaces(File file) async {
    var newPath = file.path.replaceAll(RegExp(r"\s+"), "%20");
    return await file.copy(newPath);
  }

using RegExp to replace whitespace with %20 which is the URL encoding for a space