How to open PDF file in flutter windows application

887 views Asked by At

I am able to open PDF file with the below code in flutter windows platform,

Process.run('C:\\Program Files (x86)\\Adobe\\Reader 11.0\\Reader\\AcroRd32.exe', ['$path/$fileName']).then((ProcessResult results) {
    print(results.stdout);
  });

My actual question is, How can we find the executable exact path before open files?.

I have created a new PDF file and saved document's directory. How can I find the .exe path of adobe viewer / chrome / edge to open the file.

Is the solution working for all windows platforms. I mean mobile and computer applications?

1

There are 1 answers

1
atnccetti On

Perhaps you have already solved your problem, but for me it worked as follows:

String testeAcrobat = 'C:\\progra~2\\Adobe\\Acrobat Reader DC\\Reader\\AcroRd32.exe';
        try {
          print('process start');

          ///path of the pdf file to be opened.
          Process.run(testeAcrobat, ['C:\\test.pdf']).then((ProcessResult results) {
            print(results.stdout);
          });
        } catch (e) {
          print(e);
        }