webcontent_converter 0.0.9+2 copy "webcontent_converter: ^0.0.9+2" to clipboard
webcontent_converter: ^0.0.9+2 copied to clipboard

This plugin was made for developer to convert any webcontent, web uri to image bitmap or pdf file. This plugin use WebView on android, WKWebView on Ios and chromium for desktop support.

example/lib/main.dart

import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:webcontent_converter/webcontent_converter.dart';
import 'package:window_manager/window_manager.dart';
import 'route.dart';

void main() async {
  /// [make widget built before other configurations]
  WidgetsFlutterBinding.ensureInitialized();

  if (WebViewHelper.isDesktop) {
    await windowManager.ensureInitialized();

    /// ensure brower is initialized
    var executablePath =
        await ChromeDesktopDirectoryHelper.saveChromeFromAssetToApp();
    WebViewHelper.customBrowserPath = [executablePath];
    print("executablePath $executablePath");
    await WebcontentConverter.ensureInitialized(executablePath: executablePath);
  }
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> with WindowListener {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: "webcontent converter",
      initialRoute: "/",
      routes: routes,
      onGenerateRoute: onGenerateRoute,
    );
  }

  @override
  void initState() {
    if (WebViewHelper.isDesktop) {
      windowManager.addListener(this);
    }
    super.initState();
  }

  @override
  void onWindowClose() {
    log("onWindowClose");

    /// auto close browser
    if (WebViewHelper.isDesktop && windowBrower != null) {
      WebcontentConverter.deinitWebcontentConverter();
    }
    super.onWindowClose();
  }

  @override
  void dispose() {
    if (WebViewHelper.isDesktop) {
      windowManager.removeListener(this);
    }
    super.dispose();
  }
}
30
likes
120
points
50
downloads

Publisher

verified publishermylekha.app

Weekly Downloads

This plugin was made for developer to convert any webcontent, web uri to image bitmap or pdf file. This plugin use WebView on android, WKWebView on Ios and chromium for desktop support.

Repository (GitHub)
View/report issues

Documentation

API reference

License

AGPL-3.0 (license)

Dependencies

archive, dio, easy_logger, flutter, http, js, path, path_provider, puppeteer

More

Packages that depend on webcontent_converter