libre_office_kit_converter_plugin 0.0.2 copy "libre_office_kit_converter_plugin: ^0.0.2" to clipboard
libre_office_kit_converter_plugin: ^0.0.2 copied to clipboard

Flutter plugin for document conversion powered by LibreOffice

example/lib/main.dart

import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:libre_office_kit_converter_plugin/libre_office_kit_converter_plugin.dart';
import 'package:open_file/open_file.dart';
import 'package:path_provider/path_provider.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final _libreOfficeKitConverterPlugin = LibreOfficeKitConverterPlugin();

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Plugin example app')),
        body: SizedBox(
          width: double.infinity,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              ElevatedButton(
                onPressed: () {
                  _libreOfficeKitConverterPlugin.init();
                },
                child: Text("Init"),
              ),
              SizedBox(height: 30),
              ElevatedButton(
                onPressed: () async {
                  final outputDir = await getApplicationCacheDirectory();
                  final picker = await FilePicker.platform.pickFiles();
                  if (picker != null && picker.isSinglePick) {
                    final file = picker.files.first;
                    if (file.path != null) {
                      final result = await _libreOfficeKitConverterPlugin.convert(
                        filePath: file.path!,
                        outputFilePath:
                            '${outputDir.absolute.path}/converted_new_test.pdf',
                      );
                      OpenFile.open(result);
                    }
                  }
                },
                child: Text("Convert"),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
3
likes
160
points
0
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter plugin for document conversion powered by LibreOffice

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on libre_office_kit_converter_plugin

Packages that implement libre_office_kit_converter_plugin