2

Guys I'm using file_picker to get files from the device. I use open_file to display the file. Is there any way to get the number of pages from the file? I have already seen the possibility with .pdf, but I would like to get from .docs as well.

1 Answers1

0

Try Flutter FileReader https://pub.dev/packages/flutter_filereader

A local file view widget,Support a variety of file types, such as Doc Eexcl PPT TXT and so on,Android is implemented by Tencent X5,iOS is implemented by WKWebView

import 'package:flutter/material.dart';
import 'package:flutter_filereader/flutter_filereader.dart';

class FileReaderPage extends StatefulWidget {
  final String filePath;

  FileReaderPage({Key: Key, this.filePath});

  @override
  _FileReaderPageState createState() => _FileReaderPageState();
}

class _FileReaderPageState extends State<FileReaderPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("doc"),
      ),
      body: FileReaderView(
        filePath: widget.filePath,
      ),
    );
  }
}

OR open_document

Opening pdf, xlsx, docs, ppt and zip files # https://pub.dev/packages/open_document

flakerimi
  • 2,580
  • 3
  • 29
  • 49
  • 1
    Thanks for your answer, I've tried them but couldn't find any implementation. Besides that ```flutter_filereader``` is crashing my app with its web view. – Ricardo Oscar Kanitz Jul 15 '21 at 15:22